2023-11-14 07:34 AM
Hi,
When I select use Binary Font in GFX, I would like to determine this in my app so I install the font. How to do that please ?
Thank you
Solved! Go to Solution.
2023-11-20 05:27 AM
Hello @ferro,
There are no direct way to determine this, however, you can check if tables created for a font is empty or not. You can check this by using the getCharWidth(constUnicode::UnicodeChar c) for an arbitrary character. Just make sure that you have used this character with your font. If the character is available but BinaryFont is set, then the returned value from that function will be 0.
I hope this helps
2023-11-20 05:27 AM
Hello @ferro,
There are no direct way to determine this, however, you can check if tables created for a font is empty or not. You can check this by using the getCharWidth(constUnicode::UnicodeChar c) for an arbitrary character. Just make sure that you have used this character with your font. If the character is available but BinaryFont is set, then the returned value from that function will be 0.
I hope this helps
2023-11-21 07:00 AM
Hi @Mohammad MORADI ESFAHANIASL
Thanks. I did that but I realised asking for number of glyphs in a font is more pleasing approach (0 if font not installed/present) as we disscuss here:
You can add a function to ConstFont.hpp file that returns the number of glyphs for you. For instance, add this function in the public section of the class definition:
uint16_t getNumberOfGlyphs() const { return listSize; }
then you can easily use it wherever you want. Like:
const ConstFont* fn = (const ConstFont*)(textArea1.getTypedText().getFont());
uint16_t numberOfGlyphs = fn->getNumberOfGlyphs();
touchgfx_printf("%d\n",numberOfGlyphs);
I hope this helps you, good luck
2023-11-28 04:29 AM
Nice to hear