TTFFontEncoder.h 809 B

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