filters
TTFont.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef TTFONT_H
00012 #define TTFONT_H
00013
00014 #include <aconf.h>
00015
00016 #if !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
00017
00018 #ifdef USE_GCC_PRAGMAS
00019 #pragma interface
00020 #endif
00021
00022 #if HAVE_FREETYPE_FREETYPE_H
00023 #include <freetype/freetype.h>
00024 #include <freetype/ftxpost.h>
00025 #else
00026 #include <freetype.h>
00027 #include <ftxpost.h>
00028 #endif
00029 #include "gtypes.h"
00030 #include "SFont.h"
00031
00032
00033
00034 class TTFontEngine: public SFontEngine {
00035 public:
00036
00037 TTFontEngine(Display *displayA, Visual *visualA, int depthA,
00038 Colormap colormapA, GBool aaA);
00039 GBool isOk() { return ok; }
00040 virtual ~TTFontEngine();
00041
00042 private:
00043
00044 TT_Engine engine;
00045 GBool aa;
00046 Gulong palette[5];
00047 GBool ok;
00048
00049 friend class TTFontFile;
00050 friend class TTFont;
00051 };
00052
00053
00054
00055 enum TTFontIndexMode {
00056 ttFontModeUnicode,
00057 ttFontModeCharCode,
00058 ttFontModeCharCodeOffset,
00059 ttFontModeCodeMap,
00060 ttFontModeCIDToGIDMap
00061 };
00062
00063 class TTFontFile: public SFontFile {
00064 public:
00065
00066
00067 TTFontFile(TTFontEngine *engineA, char *fontFileName,
00068 char **fontEnc, GBool pdfFontHasEncoding);
00069
00070
00071 TTFontFile(TTFontEngine *engineA, char *fontFileName,
00072 Gushort *cidToGIDA, int cidToGIDLenA);
00073
00074 GBool isOk() { return ok; }
00075 virtual ~TTFontFile();
00076
00077 private:
00078
00079 TTFontEngine *engine;
00080 TT_Face face;
00081 TT_CharMap charMap;
00082 TTFontIndexMode mode;
00083 int charMapOffset;
00084 Guchar *codeMap;
00085 Gushort *cidToGID;
00086 int cidToGIDLen;
00087 GBool ok;
00088
00089 friend class TTFont;
00090 };
00091
00092
00093
00094 struct TTFontCacheTag {
00095 Gushort code;
00096 Gushort mru;
00097 };
00098
00099 class TTFont: public SFont {
00100 public:
00101
00102 TTFont(TTFontFile *fontFileA, double *m);
00103 GBool isOk() { return ok; }
00104 virtual ~TTFont();
00105 virtual GBool drawChar(Drawable d, int w, int h, GC gc,
00106 int x, int y, int r, int g, int b,
00107 CharCode c, Unicode u);
00108
00109 private:
00110
00111 GBool getGlyphPixmap(CharCode c, Unicode u);
00112
00113 TTFontFile *fontFile;
00114 TT_Instance instance;
00115 TT_Glyph glyph;
00116 TT_Raster_Map ras;
00117 XImage *image;
00118 TT_Matrix matrix;
00119 TT_F26Dot6 xOffset, yOffset;
00120 Guchar *cache;
00121 TTFontCacheTag *cacheTags;
00122 int cacheSets;
00123 int cacheAssoc;
00124 GBool ok;
00125 };
00126
00127 #endif // !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
00128
00129 #endif
|