I recently saw that when sfml loads a font from memory by receiving a const char*.
How does this represent a font?
I also saw the arial.hpp file only contains a huge array of numbers(chars), which you can feed into the LoadFont function.
the font class in SFML also holds an image, but I don’t know how it gets set since there’s no load/set function for it, and images are made out of unsigned chars, not char arrays like what the arial font is made of.
How does all this stuff fit together, and how do I create and load a font?
(sfml specific steps would be nice also)
As far as I can tell, there is no
LoadFontfunction in SFML. There are Font::LoadFromFile and Font::LoadFromMemory. I’ll assume you’re talking about those.From the documentaiton for Font::LoadFromMemory:
It is for cases when you have loaded something into memory. That is, if you’re not using the normal filesystem. Maybe you have all of your data in .zip files, so using standard file IO won’t be useful. You load it into a block of memory (the aforementioned array of bytes), and pass it to this function.
The 2.0 documentation is more complete, as it lists the font formats that are accepted.