1 //========================================================================
5 // An X wrapper for the FreeType TrueType font rasterizer.
7 // Copyright 2001-2003 Glyph & Cog, LLC
9 //========================================================================
16 #if !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
18 #ifdef USE_GCC_PRAGMAS
22 #if HAVE_FREETYPE_FREETYPE_H
23 #include <freetype/freetype.h>
24 #include <freetype/ftxpost.h>
32 //------------------------------------------------------------------------
34 class TTFontEngine: public SFontEngine {
37 TTFontEngine(Display *displayA, Visual *visualA, int depthA,
38 Colormap colormapA, GBool aaA);
39 GBool isOk() { return ok; }
40 virtual ~TTFontEngine();
49 friend class TTFontFile;
53 //------------------------------------------------------------------------
55 enum TTFontIndexMode {
58 ttFontModeCharCodeOffset,
63 class TTFontFile: public SFontFile {
66 // 8-bit font, TrueType or Type 1/1C
67 TTFontFile(TTFontEngine *engineA, char *fontFileName,
68 char **fontEnc, GBool pdfFontHasEncoding);
71 TTFontFile(TTFontEngine *engineA, char *fontFileName,
72 Gushort *cidToGIDA, int cidToGIDLenA);
74 GBool isOk() { return ok; }
75 virtual ~TTFontFile();
92 //------------------------------------------------------------------------
94 struct TTFontCacheTag {
96 Gushort mru; // valid bit (0x8000) and MRU index
99 class TTFont: public SFont {
102 TTFont(TTFontFile *fontFileA, double *m);
103 GBool isOk() { return ok; }
105 virtual GBool drawChar(Drawable d, int w, int h, GC gc,
106 int x, int y, int r, int g, int b,
107 CharCode c, Unicode u);
111 GBool getGlyphPixmap(CharCode c, Unicode u);
113 TTFontFile *fontFile;
114 TT_Instance instance;
119 TT_F26Dot6 xOffset, yOffset;
120 Guchar *cache; // glyph pixmap cache
121 TTFontCacheTag *cacheTags; // cache tags, i.e., char codes
122 int cacheSets; // number of sets in cache
123 int cacheAssoc; // cache associativity (glyphs per set)
127 #endif // !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)