I’m trying to serialise some fonts to embed them in my application using typeface->serialise and the corresponding constructor to load them later… for example:
//...
OutputStream* out = testFile.createOutputStream();
Typeface* tf = new Typeface(T("Arial"), false, false);
tf->serialise(*out);
//...
…however, by stepping into the Typeface constructor I see that the glyphs are not loaded by default, and I do not see how to “populate” it manually before calling serialise. Usually this is an indicator that I’m either doing something horribly wrong, or overlooking the obvious Could someone enlighten me as to the proper usage of serialise?
//...
OutputStream* out = testFile.createOutputStream();
Typeface* tf = new Typeface(T("LegalFontName"), false, false);
//Here's the important part.
for (int i = 0; i < 256; ++i)
tf->getGlyph(i);
tf->serialise(*out);
//...
Unfortunately not. Non-Latin unicode character sets are not included. Ideally I’d like only to getGlyph on the characters are in the font. Now I just get the Kanji/Katakana/Hiragana charset codes and it seems to work fine. And not from “Arial” mind you. Quite illegal code you have there…
Yes, I seem to remember having some issues with doing that on certain platforms, which is why it’s not there. I think it was on the mac where I couldn’t find a way of discovering which glyphs were used.