00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef FOFITRUETYPE_H
00010 #define FOFITRUETYPE_H
00011
00012 #include <aconf.h>
00013
00014 #ifdef USE_GCC_PRAGMAS
00015 #pragma interface
00016 #endif
00017
00018 #include "gtypes.h"
00019 #include "FoFiBase.h"
00020
00021 class GHash;
00022 struct TrueTypeTable;
00023 struct TrueTypeCmap;
00024
00025
00026
00027
00028
00029 class FoFiTrueType: public FoFiBase {
00030 public:
00031
00032
00033 static FoFiTrueType *make(char *fileA, int lenA);
00034
00035
00036 static FoFiTrueType *load(char *fileName);
00037
00038 virtual ~FoFiTrueType();
00039
00040
00041 int getNumCmaps();
00042
00043
00044 int getCmapPlatform(int i);
00045
00046
00047 int getCmapEncoding(int i);
00048
00049
00050
00051 int findCmap(int platform, int encoding);
00052
00053
00054 Gushort mapCodeToGID(int i, int c);
00055
00056
00057
00058
00059 int mapNameToGID(char *name);
00060
00061
00062
00063
00064
00065
00066
00067
00068 int getEmbeddingRights();
00069
00070
00071
00072
00073
00074
00075
00076 void convertToType42(char *psName, char **encoding,
00077 Gushort *codeToGID,
00078 FoFiOutputFunc outputFunc, void *outputStream);
00079
00080
00081
00082
00083
00084
00085 void convertToCIDType2(char *psName, Gushort *cidMap, int nCIDs,
00086 FoFiOutputFunc outputFunc, void *outputStream);
00087
00088
00089
00090
00091
00092
00093 void convertToType0(char *psName, Gushort *cidMap, int nCIDs,
00094 FoFiOutputFunc outputFunc, void *outputStream);
00095
00096
00097
00098
00099 void writeTTF(FoFiOutputFunc outputFunc, void *outputStream);
00100
00101 private:
00102
00103 FoFiTrueType(char *fileA, int lenA, GBool freeFileDataA);
00104 void cvtEncoding(char **encoding,
00105 FoFiOutputFunc outputFunc,
00106 void *outputStream);
00107 void cvtCharStrings(char **encoding,
00108 Gushort *codeToGID,
00109 FoFiOutputFunc outputFunc,
00110 void *outputStream);
00111 void cvtSfnts(FoFiOutputFunc outputFunc,
00112 void *outputStream, GString *name);
00113 void dumpString(Guchar *s, int length,
00114 FoFiOutputFunc outputFunc,
00115 void *outputStream);
00116 Guint computeTableChecksum(Guchar *data, int length);
00117 void parse();
00118 void readPostTable();
00119 int seekTable(char *tag);
00120
00121 TrueTypeTable *tables;
00122 int nTables;
00123 TrueTypeCmap *cmaps;
00124 int nCmaps;
00125 int nGlyphs;
00126 int locaFmt;
00127 int bbox[4];
00128 GHash *nameToGID;
00129
00130 GBool parsedOk;
00131 };
00132
00133 #endif