1
0

font.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef __FONT_H
  2. #define __FONT_H
  3. #include <bfc/ptrlist.h>
  4. #include <bfc/string/StringW.h>
  5. class ifc_canvas;
  6. class svc_font;
  7. class svc_fontMaker;
  8. class FontDef {
  9. public:
  10. StringW filename;
  11. StringW path;
  12. StringW id;
  13. int allowmapping;
  14. int isbitmap;
  15. int scriptid;
  16. };
  17. class Font {
  18. public:
  19. static void init();
  20. static svc_font *installTrueTypeFont(const wchar_t *filename, const wchar_t *path, const wchar_t *id, int scriptid, int allowmapping, int isreload); // call this to install a new font
  21. static void installBitmapFont(const wchar_t *filename, const wchar_t *path, const wchar_t *id, int charwidth, int charheight, int hspacing, int vspacing, int scriptid, int allowmapping);
  22. static void uninstallAll(int isttfreload=0);
  23. static void uninstallByScriptId(int scriptid);
  24. static svc_font *requestSkinFont(const wchar_t *id, int *size=NULL, int *gotdefault=NULL); // call this to get a Font pointer to a font id, pass your size if you have one, so that the mapper can do its job.
  25. static void dispatchTextOut(ifc_canvas *c, int style, int x, int y, int w, int h, const wchar_t *txt);
  26. static int dispatchGetInfo(ifc_canvas *c, const wchar_t *font, int infoid, const wchar_t *txt, int *w, int *h);
  27. static int useTrueTypeOverride(const wchar_t *txt);
  28. static const wchar_t *getTrueTypeOverride();
  29. static int getTrueTypeOverrideScale();
  30. static int getNumFonts() { return fontlist.getNumItems(); }
  31. static FontDef *enumFontDef(int n) { return fontdefs.enumItem(n); }
  32. static int getNumFontDefs() { return fontdefs.getNumItems(); }
  33. static const wchar_t *getFontMapping(const wchar_t *id, int *size);
  34. private:
  35. static void deleteFont(svc_font *font);
  36. static svc_font *newTrueTypeFont();
  37. static PtrList<svc_font> fontlist;
  38. static PtrList<FontDef> fontdefs;
  39. StringW font_id;
  40. int scriptid;
  41. static StringW mapping;
  42. };
  43. #endif