1 //========================================================================
5 // An X wrapper for the FreeType TrueType font rasterizer.
7 // Copyright 2001-2002 Glyph & Cog, LLC
9 //========================================================================
14 #if !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
20 #if HAVE_FREETYPE_FREETYPE_H
21 #include <freetype/freetype.h>
22 #include <freetype/ftxpost.h>
30 //------------------------------------------------------------------------
32 class TTFontEngine: public SFontEngine {
35 TTFontEngine(Display *displayA, Visual *visualA, int depthA,
36 Colormap colormapA, GBool aaA);
37 GBool isOk() { return ok; }
38 virtual ~TTFontEngine();
47 friend class TTFontFile;
51 //------------------------------------------------------------------------
53 enum TTFontIndexMode {
56 ttFontModeCharCodeOffset,
61 class TTFontFile: public SFontFile {
64 // 8-bit font, TrueType or Type 1/1C
65 TTFontFile(TTFontEngine *engineA, char *fontFileName,
66 char **fontEnc, GBool pdfFontHasEncoding);
69 TTFontFile(TTFontEngine *engineA, char *fontFileName,
70 Gushort *cidToGIDA, int cidToGIDLenA);
72 GBool isOk() { return ok; }
73 virtual ~TTFontFile();
90 //------------------------------------------------------------------------
92 struct TTFontCacheTag {
94 Gushort mru; // valid bit (0x8000) and MRU index
97 class TTFont: public SFont {
100 TTFont(TTFontFile *fontFileA, double *m);
101 GBool isOk() { return ok; }
103 virtual GBool drawChar(Drawable d, int w, int h, GC gc,
104 int x, int y, int r, int g, int b,
105 CharCode c, Unicode u);
109 GBool getGlyphPixmap(CharCode c, Unicode u);
111 TTFontFile *fontFile;
112 TT_Instance instance;
117 TT_F26Dot6 xOffset, yOffset;
118 Guchar *cache; // glyph pixmap cache
119 TTFontCacheTag *cacheTags; // cache tags, i.e., char codes
120 int cacheSets; // number of sets in cache
121 int cacheAssoc; // cache associativity (glyphs per set)
125 #endif // !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)