I am new to this group, and I am not a Java developer or programmer. Some very basic stuff ahead...
For a project at uni, I would like to generate a font (ttf or otf) with a basic set of 26 characters (A-Z), which are generated based on various inputs (camera, live data,...), which are not based on any previously loaded font.
However, I run into problems to define a simple glyph table. I guess it is an easy task, but my programming skills are very limited. That's how far I've got:
FontFactory fontFactory = FontFactory.getInstance();
Font.Builder fontBuilder = fontFactory.newFontBuilder();
CMapTable.Builder cmapTableBuilder = (CMapTable.Builder) fontBuilder.newTableBuilder(Tag.cmap);
CMap.Builder cmapBuilder = cmapTableBuilder.newCMapBuilder(CMapId.MAC_ROMAN, CMapFormat.Format0);
CMapFormat0.Builder cmapFormat0Builder = (CMapFormat0.Builder) cmapBuilder;
LocaTable.Builder locaBuilder = (LocaTable.Builder) fontBuilder.newTableBuilder(Tag.loca);
GlyphTable.Builder glyphTableBuilder = (GlyphTable.Builder) fontBuilder.newTableBuilder(Tag.glyf);
// define glyphs here
Font newFont = fontBuilder.build();
File dstFontFile = TestFontUtils.serializeFont(newFont, ".ttf");
System.out.println(dstFontFile);
I don't know how the glyph definition could work and I couldn't find any example code. Also, saving the .ttf file is not working with this code yet... hope someone can help me.
Thanks in advance for looking into the topic!
Andreas