The use of a cache goes back to the similarity between images and fonts. When the font is rendering the first time, it's a good idea to cache the result in memory so that the next time you need to use it, your application can just grab it from memory rather than having to compute the glyph data from scratch again. The font engine extracts the data from the file and constructs the glyph (mini image) in memory at run time, then pushes it to the display. Going from font file to screenĪs font files contain only raw data, your GUI application typically needs a font engine to render a font. The two main types for embedded systems are: TrueType, developed by Apple, and OpenType, co-developed by Microsoft and Adobe.īoth font file formats contain just the data for the fonts - if the files contained the images for the glyphs too, the font file would be far to massive.
With fonts, there's a whole bunch of different formats. With regular images, there are multiple formats including that include PNG, JPEG, and Bitmap. With a font file, it’s just the data that's needed to render them as a mini image at runtime. They're essentially mini images but they aren’t encoded the same way you’d see in a PNG image file.
If you think about a string that's rendered to a computer screen, that string is just a collection of individual glyphs representing each character. One of the things that we can look back on is the fact that there's a lot of similarities between fonts and images. In one of our last live embedded talks, we talked about the nature of embedded images and how selecting the right image format can have a large impact on building out your embedded GUI from a performance perspective, but also in terms of what you can actually fit in the resources that you have (RAM and Flash). Optimizing graphics memory in embedded systems You can also jump straight ahead to the question and answer portion of the session by clicking here.