TTFFontEncoder.h 901 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <ft2build.h>
  2. #include FT_FREETYPE_H
  3. #include "Font.h"
  4. #define START_INDEX 32
  5. #define END_INDEX 127
  6. #define GLYPH_PADDING 4
  7. namespace gameplay
  8. {
  9. // Structure of TTF Glyph.
  10. class TTFGlyph
  11. {
  12. public:
  13. unsigned int index;
  14. unsigned int width;
  15. float uvCoords[4];
  16. };
  17. /**
  18. * Writes the font gpb file.
  19. *
  20. * @param inFilePath Input file path to the tiff file.
  21. * @param outFilePath Output file path to write the gpb to.
  22. * @param fontSizes List of sizes to generate for the font.
  23. * @param id ID string of the font in the ref table.
  24. * @param fontpreview True if the pgm font preview file should be written. (For debugging)
  25. *
  26. * @return 0 if successful, -1 if error.
  27. */
  28. int writeFont(const char* inFilePath, const char* outFilePath, std::vector<unsigned int>& fontSize, const char* id, bool fontpreview, Font::FontFormat fontFormat);
  29. }