diff options
Diffstat (limited to 'fofi')
-rw-r--r-- | fofi/FoFiBase.cc | 36 | ||||
-rw-r--r-- | fofi/FoFiBase.h | 22 | ||||
-rw-r--r-- | fofi/FoFiIdentifier.cc | 152 | ||||
-rw-r--r-- | fofi/FoFiTrueType.cc | 84 | ||||
-rw-r--r-- | fofi/FoFiTrueType.h | 18 | ||||
-rw-r--r-- | fofi/FoFiType1.cc | 32 | ||||
-rw-r--r-- | fofi/FoFiType1.h | 4 | ||||
-rw-r--r-- | fofi/FoFiType1C.cc | 268 | ||||
-rw-r--r-- | fofi/FoFiType1C.h | 50 |
9 files changed, 333 insertions, 333 deletions
diff --git a/fofi/FoFiBase.cc b/fofi/FoFiBase.cc index 713d071d..ff1d92ca 100644 --- a/fofi/FoFiBase.cc +++ b/fofi/FoFiBase.cc @@ -34,7 +34,7 @@ // FoFiBase //------------------------------------------------------------------------ -FoFiBase::FoFiBase(const char *fileA, int lenA, GBool freeFileDataA) { +FoFiBase::FoFiBase(const char *fileA, int lenA, bool freeFileDataA) { file = (const Guchar *)fileA; len = lenA; freeFileData = freeFileDataA; @@ -82,11 +82,11 @@ char *FoFiBase::readFile(const char *fileName, int *fileLen) { return buf; } -int FoFiBase::getS8(int pos, GBool *ok) const { +int FoFiBase::getS8(int pos, bool *ok) const { int x; if (pos < 0 || pos >= len) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -96,19 +96,19 @@ int FoFiBase::getS8(int pos, GBool *ok) const { return x; } -int FoFiBase::getU8(int pos, GBool *ok) const { +int FoFiBase::getU8(int pos, bool *ok) const { if (pos < 0 || pos >= len) { - *ok = gFalse; + *ok = false; return 0; } return file[pos]; } -int FoFiBase::getS16BE(int pos, GBool *ok) const { +int FoFiBase::getS16BE(int pos, bool *ok) const { int x; if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -119,11 +119,11 @@ int FoFiBase::getS16BE(int pos, GBool *ok) const { return x; } -int FoFiBase::getU16BE(int pos, GBool *ok) const { +int FoFiBase::getU16BE(int pos, bool *ok) const { int x; if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -131,11 +131,11 @@ int FoFiBase::getU16BE(int pos, GBool *ok) const { return x; } -int FoFiBase::getS32BE(int pos, GBool *ok) const { +int FoFiBase::getS32BE(int pos, bool *ok) const { int x; if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -148,11 +148,11 @@ int FoFiBase::getS32BE(int pos, GBool *ok) const { return x; } -Guint FoFiBase::getU32BE(int pos, GBool *ok) const { +Guint FoFiBase::getU32BE(int pos, bool *ok) const { Guint x; if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -162,11 +162,11 @@ Guint FoFiBase::getU32BE(int pos, GBool *ok) const { return x; } -Guint FoFiBase::getU32LE(int pos, GBool *ok) const { +Guint FoFiBase::getU32LE(int pos, bool *ok) const { Guint x; if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos+3]; @@ -176,12 +176,12 @@ Guint FoFiBase::getU32LE(int pos, GBool *ok) const { return x; } -Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) const { +Guint FoFiBase::getUVarBE(int pos, int size, bool *ok) const { Guint x; int i; if (pos < 0 || pos + size > len || pos > INT_MAX - size) { - *ok = gFalse; + *ok = false; return 0; } x = 0; @@ -191,7 +191,7 @@ Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) const { return x; } -GBool FoFiBase::checkRegion(int pos, int size) const { +bool FoFiBase::checkRegion(int pos, int size) const { return pos >= 0 && pos < INT_MAX - size && size < INT_MAX - pos && diff --git a/fofi/FoFiBase.h b/fofi/FoFiBase.h index 51652985..73842769 100644 --- a/fofi/FoFiBase.h +++ b/fofi/FoFiBase.h @@ -42,26 +42,26 @@ public: protected: - FoFiBase(const char *fileA, int lenA, GBool freeFileDataA); + FoFiBase(const char *fileA, int lenA, bool freeFileDataA); static char *readFile(const char *fileName, int *fileLen); // S = signed / U = unsigned // 8/16/32/Var = word length, in bytes // BE = big endian - int getS8(int pos, GBool *ok) const; - int getU8(int pos, GBool *ok) const; - int getS16BE(int pos, GBool *ok) const; - int getU16BE(int pos, GBool *ok) const; - int getS32BE(int pos, GBool *ok) const; - Guint getU32BE(int pos, GBool *ok) const; - Guint getU32LE(int pos, GBool *ok) const; - Guint getUVarBE(int pos, int size, GBool *ok) const; + int getS8(int pos, bool *ok) const; + int getU8(int pos, bool *ok) const; + int getS16BE(int pos, bool *ok) const; + int getU16BE(int pos, bool *ok) const; + int getS32BE(int pos, bool *ok) const; + Guint getU32BE(int pos, bool *ok) const; + Guint getU32LE(int pos, bool *ok) const; + Guint getUVarBE(int pos, int size, bool *ok) const; - GBool checkRegion(int pos, int size) const; + bool checkRegion(int pos, int size) const; const Guchar *file; int len; - GBool freeFileData; + bool freeFileData; }; #endif diff --git a/fofi/FoFiIdentifier.cc b/fofi/FoFiIdentifier.cc index ded16e23..5cd7506a 100644 --- a/fofi/FoFiIdentifier.cc +++ b/fofi/FoFiIdentifier.cc @@ -44,22 +44,22 @@ public: // Read a big-endian unsigned 16-bit integer. Fills in *val and // returns true if successful. - virtual GBool getU16BE(int pos, int *val) = 0; + virtual bool getU16BE(int pos, int *val) = 0; // Read a big-endian unsigned 32-bit integer. Fills in *val and // returns true if successful. - virtual GBool getU32BE(int pos, Guint *val) = 0; + virtual bool getU32BE(int pos, Guint *val) = 0; // Read a little-endian unsigned 32-bit integer. Fills in *val and // returns true if successful. - virtual GBool getU32LE(int pos, Guint *val) = 0; + virtual bool getU32LE(int pos, Guint *val) = 0; // Read a big-endian unsigned <size>-byte integer, where 1 <= size // <= 4. Fills in *val and returns true if successful. - virtual GBool getUVarBE(int pos, int size, Guint *val) = 0; + virtual bool getUVarBE(int pos, int size, Guint *val) = 0; // Compare against a string. Returns true if equal. - virtual GBool cmp(int pos, const char *s) = 0; + virtual bool cmp(int pos, const char *s) = 0; }; @@ -71,11 +71,11 @@ public: static MemReader *make(const char *bufA, int lenA); ~MemReader(); int getByte(int pos) override; - GBool getU16BE(int pos, int *val) override; - GBool getU32BE(int pos, Guint *val) override; - GBool getU32LE(int pos, Guint *val) override; - GBool getUVarBE(int pos, int size, Guint *val) override; - GBool cmp(int pos, const char *s) override; + bool getU16BE(int pos, int *val) override; + bool getU32BE(int pos, Guint *val) override; + bool getU32LE(int pos, Guint *val) override; + bool getUVarBE(int pos, int size, Guint *val) override; + bool cmp(int pos, const char *s) override; private: @@ -104,56 +104,56 @@ int MemReader::getByte(int pos) { return buf[pos] & 0xff; } -GBool MemReader::getU16BE(int pos, int *val) { +bool MemReader::getU16BE(int pos, int *val) { if (pos < 0 || pos > len - 2) { - return gFalse; + return false; } *val = ((buf[pos] & 0xff) << 8) + (buf[pos+1] & 0xff); - return gTrue; + return true; } -GBool MemReader::getU32BE(int pos, Guint *val) { +bool MemReader::getU32BE(int pos, Guint *val) { if (pos < 0 || pos > len - 4) { - return gFalse; + return false; } *val = ((buf[pos] & 0xff) << 24) + ((buf[pos+1] & 0xff) << 16) + ((buf[pos+2] & 0xff) << 8) + (buf[pos+3] & 0xff); - return gTrue; + return true; } -GBool MemReader::getU32LE(int pos, Guint *val) { +bool MemReader::getU32LE(int pos, Guint *val) { if (pos < 0 || pos > len - 4) { - return gFalse; + return false; } *val = (buf[pos] & 0xff) + ((buf[pos+1] & 0xff) << 8) + ((buf[pos+2] & 0xff) << 16) + ((buf[pos+3] & 0xff) << 24); - return gTrue; + return true; } -GBool MemReader::getUVarBE(int pos, int size, Guint *val) { +bool MemReader::getUVarBE(int pos, int size, Guint *val) { int i; if (size < 1 || size > 4 || pos < 0 || pos > len - size) { - return gFalse; + return false; } *val = 0; for (i = 0; i < size; ++i) { *val = (*val << 8) + (buf[pos + i] & 0xff); } - return gTrue; + return true; } -GBool MemReader::cmp(int pos, const char *s) { +bool MemReader::cmp(int pos, const char *s) { int n; n = (int)strlen(s); if (pos < 0 || len < n || pos > len - n) { - return gFalse; + return false; } return !memcmp(buf + pos, s, n); } @@ -166,16 +166,16 @@ public: static FileReader *make(const char *fileName); ~FileReader(); int getByte(int pos) override; - GBool getU16BE(int pos, int *val) override; - GBool getU32BE(int pos, Guint *val) override; - GBool getU32LE(int pos, Guint *val) override; - GBool getUVarBE(int pos, int size, Guint *val) override; - GBool cmp(int pos, const char *s) override; + bool getU16BE(int pos, int *val) override; + bool getU32BE(int pos, Guint *val) override; + bool getU32LE(int pos, Guint *val) override; + bool getUVarBE(int pos, int size, Guint *val) override; + bool cmp(int pos, const char *s) override; private: FileReader(FILE *fA); - GBool fillBuf(int pos, int len); + bool fillBuf(int pos, int len); FILE *f; char buf[1024]; @@ -208,77 +208,77 @@ int FileReader::getByte(int pos) { return buf[pos - bufPos] & 0xff; } -GBool FileReader::getU16BE(int pos, int *val) { +bool FileReader::getU16BE(int pos, int *val) { if (!fillBuf(pos, 2)) { - return gFalse; + return false; } *val = ((buf[pos - bufPos] & 0xff) << 8) + (buf[pos - bufPos + 1] & 0xff); - return gTrue; + return true; } -GBool FileReader::getU32BE(int pos, Guint *val) { +bool FileReader::getU32BE(int pos, Guint *val) { if (!fillBuf(pos, 4)) { - return gFalse; + return false; } *val = ((buf[pos - bufPos] & 0xff) << 24) + ((buf[pos - bufPos + 1] & 0xff) << 16) + ((buf[pos - bufPos + 2] & 0xff) << 8) + (buf[pos - bufPos + 3] & 0xff); - return gTrue; + return true; } -GBool FileReader::getU32LE(int pos, Guint *val) { +bool FileReader::getU32LE(int pos, Guint *val) { if (!fillBuf(pos, 4)) { - return gFalse; + return false; } *val = (buf[pos - bufPos] & 0xff) + ((buf[pos - bufPos + 1] & 0xff) << 8) + ((buf[pos - bufPos + 2] & 0xff) << 16) + ((buf[pos - bufPos + 3] & 0xff) << 24); - return gTrue; + return true; } -GBool FileReader::getUVarBE(int pos, int size, Guint *val) { +bool FileReader::getUVarBE(int pos, int size, Guint *val) { int i; if (size < 1 || size > 4 || !fillBuf(pos, size)) { - return gFalse; + return false; } *val = 0; for (i = 0; i < size; ++i) { *val = (*val << 8) + (buf[pos - bufPos + i] & 0xff); } - return gTrue; + return true; } -GBool FileReader::cmp(int pos, const char *s) { +bool FileReader::cmp(int pos, const char *s) { int n; n = (int)strlen(s); if (!fillBuf(pos, n)) { - return gFalse; + return false; } return !memcmp(buf - bufPos + pos, s, n); } -GBool FileReader::fillBuf(int pos, int len) { +bool FileReader::fillBuf(int pos, int len) { if (pos < 0 || len < 0 || len > (int)sizeof(buf) || pos > INT_MAX - (int)sizeof(buf)) { - return gFalse; + return false; } if (pos >= bufPos && pos + len <= bufPos + bufLen) { - return gTrue; + return true; } if (fseek(f, pos, SEEK_SET)) { - return gFalse; + return false; } bufPos = pos; bufLen = (int)fread(buf, 1, sizeof(buf), f); if (bufLen < len) { - return gFalse; + return false; } - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -289,16 +289,16 @@ public: static StreamReader *make(int (*getCharA)(void *data), void *dataA); ~StreamReader(); int getByte(int pos) override; - GBool getU16BE(int pos, int *val) override; - GBool getU32BE(int pos, Guint *val) override; - GBool getU32LE(int pos, Guint *val) override; - GBool getUVarBE(int pos, int size, Guint *val) override; - GBool cmp(int pos, const char *s) override; + bool getU16BE(int pos, int *val) override; + bool getU32BE(int pos, Guint *val) override; + bool getU32LE(int pos, Guint *val) override; + bool getUVarBE(int pos, int size, Guint *val) override; + bool cmp(int pos, const char *s) override; private: StreamReader(int (*getCharA)(void *data), void *dataA); - GBool fillBuf(int pos, int len); + bool fillBuf(int pos, int len); int (*getChar)(void *data); void *data; @@ -329,68 +329,68 @@ int StreamReader::getByte(int pos) { return buf[pos - bufPos] & 0xff; } -GBool StreamReader::getU16BE(int pos, int *val) { +bool StreamReader::getU16BE(int pos, int *val) { if (!fillBuf(pos, 2)) { - return gFalse; + return false; } *val = ((buf[pos - bufPos] & 0xff) << 8) + (buf[pos - bufPos + 1] & 0xff); - return gTrue; + return true; } -GBool StreamReader::getU32BE(int pos, Guint *val) { +bool StreamReader::getU32BE(int pos, Guint *val) { if (!fillBuf(pos, 4)) { - return gFalse; + return false; } *val = ((buf[pos - bufPos] & 0xff) << 24) + ((buf[pos - bufPos + 1] & 0xff) << 16) + ((buf[pos - bufPos + 2] & 0xff) << 8) + (buf[pos - bufPos + 3] & 0xff); - return gTrue; + return true; } -GBool StreamReader::getU32LE(int pos, Guint *val) { +bool StreamReader::getU32LE(int pos, Guint *val) { if (!fillBuf(pos, 4)) { - return gFalse; + return false; } *val = (buf[pos - bufPos] & 0xff) + ((buf[pos - bufPos + 1] & 0xff) << 8) + ((buf[pos - bufPos + 2] & 0xff) << 16) + ((buf[pos - bufPos + 3] & 0xff) << 24); - return gTrue; + return true; } -GBool StreamReader::getUVarBE(int pos, int size, Guint *val) { +bool StreamReader::getUVarBE(int pos, int size, Guint *val) { int i; if (size < 1 || size > 4 || !fillBuf(pos, size)) { - return gFalse; + return false; } *val = 0; for (i = 0; i < size; ++i) { *val = (*val << 8) + (buf[pos - bufPos + i] & 0xff); } - return gTrue; + return true; } -GBool StreamReader::cmp(int pos, const char *s) { +bool StreamReader::cmp(int pos, const char *s) { const int n = (int)strlen(s); if (!fillBuf(pos, n)) { - return gFalse; + return false; } const int posDiff = pos - bufPos; return !memcmp(buf + posDiff, s, n); } -GBool StreamReader::fillBuf(int pos, int len) { +bool StreamReader::fillBuf(int pos, int len) { int c; if (pos < 0 || len < 0 || len > (int)sizeof(buf) || pos > INT_MAX - (int)sizeof(buf)) { - return gFalse; + return false; } if (pos < bufPos) { - return gFalse; + return false; } // if requested region will not fit in the current buffer... @@ -410,7 +410,7 @@ GBool StreamReader::fillBuf(int pos, int len) { bufLen = 0; while (bufPos < pos) { if ((c = (*getChar)(data)) < 0) { - return gFalse; + return false; } ++bufPos; } @@ -420,12 +420,12 @@ GBool StreamReader::fillBuf(int pos, int len) { // read the rest of the requested data while (bufPos + bufLen < pos + len) { if ((c = (*getChar)(data)) < 0) { - return gFalse; + return false; } buf[bufLen++] = (char)c; } - return gTrue; + return true; } } diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc index f7b9ab58..612adc3c 100644 --- a/fofi/FoFiTrueType.cc +++ b/fofi/FoFiTrueType.cc @@ -166,24 +166,24 @@ struct cmpTrueTypeTableTagFunctor { struct T42Table { const char *tag; // 4-byte tag - GBool required; // required by the TrueType spec? + bool required; // required by the TrueType spec? }; // TrueType tables to be embedded in Type 42 fonts. // NB: the table names must be in alphabetical order here. #define nT42Tables 11 static T42Table t42Tables[nT42Tables] = { - { "cvt ", gTrue }, - { "fpgm", gTrue }, - { "glyf", gTrue }, - { "head", gTrue }, - { "hhea", gTrue }, - { "hmtx", gTrue }, - { "loca", gTrue }, - { "maxp", gTrue }, - { "prep", gTrue }, - { "vhea", gFalse }, - { "vmtx", gFalse } + { "cvt ", true }, + { "fpgm", true }, + { "glyf", true }, + { "head", true }, + { "hhea", true }, + { "hmtx", true }, + { "loca", true }, + { "maxp", true }, + { "prep", true }, + { "vhea", false }, + { "vmtx", false } }; #define t42HeadTable 3 #define t42LocaTable 6 @@ -270,7 +270,7 @@ static const char *macGlyphNames[258] = { FoFiTrueType *FoFiTrueType::make(const char *fileA, int lenA, int faceIndexA) { FoFiTrueType *ff; - ff = new FoFiTrueType(fileA, lenA, gFalse, faceIndexA); + ff = new FoFiTrueType(fileA, lenA, false, faceIndexA); if (!ff->parsedOk) { delete ff; return nullptr; @@ -286,7 +286,7 @@ FoFiTrueType *FoFiTrueType::load(const char *fileName, int faceIndexA) { if (!(fileA = FoFiBase::readFile(fileName, &lenA))) { return nullptr; } - ff = new FoFiTrueType(fileA, lenA, gTrue, faceIndexA); + ff = new FoFiTrueType(fileA, lenA, true, faceIndexA); if (!ff->parsedOk) { delete ff; return nullptr; @@ -294,14 +294,14 @@ FoFiTrueType *FoFiTrueType::load(const char *fileName, int faceIndexA) { return ff; } -FoFiTrueType::FoFiTrueType(const char *fileA, int lenA, GBool freeFileDataA, int faceIndexA): +FoFiTrueType::FoFiTrueType(const char *fileA, int lenA, bool freeFileDataA, int faceIndexA): FoFiBase(fileA, lenA, freeFileDataA) { tables = nullptr; nTables = 0; cmaps = nullptr; nCmaps = 0; - parsedOk = gFalse; + parsedOk = false; faceIndex = faceIndexA; gsubFeatureTable = 0; gsubLookupList = 0; @@ -342,12 +342,12 @@ int FoFiTrueType::mapCodeToGID(int i, Guint c) const { Guint segCnt, segEnd, segStart, segDelta, segOffset; Guint cmapFirst, cmapLen; int pos, a, b, m; - GBool ok; + bool ok; if (i < 0 || i >= nCmaps) { return 0; } - ok = gTrue; + ok = true; pos = cmaps[i].offset; switch (cmaps[i].fmt) { case 0: @@ -442,19 +442,19 @@ int FoFiTrueType::mapNameToGID(const char *name) const { return gid->second; } -GBool FoFiTrueType::getCFFBlock(char **start, int *length) const { +bool FoFiTrueType::getCFFBlock(char **start, int *length) const { int i; if (!openTypeCFF || !tables) { - return gFalse; + return false; } i = seekTable("CFF "); if (!checkRegion(tables[i].offset, tables[i].len)) { - return gFalse; + return false; } *start = (char *)file + tables[i].offset; *length = tables[i].len; - return gTrue; + return true; } int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) const { @@ -477,12 +477,12 @@ int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) const { int FoFiTrueType::getEmbeddingRights() const { int i, fsType; - GBool ok; + bool ok; if ((i = seekTable("OS/2")) < 0) { return 4; } - ok = gTrue; + ok = true; fsType = getU16BE(tables[i].offset + 8, &ok); if (!ok) { return 4; @@ -520,14 +520,14 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding, void *outputStream) const { GooString *buf; int maxUsedGlyph; - GBool ok; + bool ok; if (openTypeCFF) { return; } // write the header - ok = gTrue; + ok = true; buf = GooString::format("%!PS-TrueTypeFont-{0:2g}\n", (double)getS32BE(0, &ok) / 65536.0); (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); @@ -549,14 +549,14 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding, // write the guts of the dictionary cvtEncoding(encoding, outputFunc, outputStream); cvtCharStrings(encoding, codeToGID, outputFunc, outputStream); - cvtSfnts(outputFunc, outputStream, nullptr, gFalse, &maxUsedGlyph); + cvtSfnts(outputFunc, outputStream, nullptr, false, &maxUsedGlyph); // end the dictionary and define the font (*outputFunc)(outputStream, "FontName currentdict end definefont pop\n", 40); } void FoFiTrueType::convertToType1(const char *psName, const char **newEncoding, - GBool ascii, FoFiOutputFunc outputFunc, + bool ascii, FoFiOutputFunc outputFunc, void *outputStream) const { char *start; int length; @@ -574,12 +574,12 @@ void FoFiTrueType::convertToType1(const char *psName, const char **newEncoding, void FoFiTrueType::convertToCIDType2(const char *psName, int *cidMap, int nCIDs, - GBool needVerticalMetrics, + bool needVerticalMetrics, FoFiOutputFunc outputFunc, void *outputStream) const { GooString *buf; int cid, maxUsedGlyph; - GBool ok; + bool ok; int i, j, k; if (openTypeCFF) { @@ -587,7 +587,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName, } // write the header - ok = gTrue; + ok = true; buf = GooString::format("%!PS-TrueTypeFont-{0:2g}\n", (double)getS32BE(0, &ok) / 65536.0); (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); @@ -720,7 +720,7 @@ void FoFiTrueType::convertToCIDType0(const char *psName, int *cidMap, int nCIDs, } void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, - GBool needVerticalMetrics, + bool needVerticalMetrics, int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) const { @@ -934,14 +934,14 @@ void FoFiTrueType::cvtCharStrings(char **encoding, void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, void *outputStream, GooString *name, - GBool needVerticalMetrics, + bool needVerticalMetrics, int *maxUsedGlyph) const { Guchar headData[54]; TrueTypeLoca *locaTable; Guchar *locaData; TrueTypeTable newTables[nT42Tables]; Guchar tableDir[12 + nT42Tables*16]; - GBool ok; + bool ok; Guint checksum; int nNewTables; int glyfTableLen, length, pos, glyfPos, i, j, k, vmtxTabLength; @@ -965,7 +965,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, 0, 1 // number of advance heights in vmtx table }; Guchar *vmtxTab; - GBool needVhea, needVmtx; + bool needVhea, needVmtx; int advance; // construct the 'head' table, zero out the font checksum @@ -999,7 +999,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, pos = tables[i].offset; i = seekTable("glyf"); glyfTableLen = tables[i].len; - ok = gTrue; + ok = true; for (i = 0; i <= nGlyphs; ++i) { locaTable[i].idx = i; if (locaFmt) { @@ -1318,7 +1318,7 @@ void FoFiTrueType::parse() { Guint topTag; int pos, ver, i, j; - parsedOk = gTrue; + parsedOk = true; // look for a collection (TTC) topTag = getU32BE(0, &parsedOk); @@ -1333,7 +1333,7 @@ void FoFiTrueType::parse() { if (!parsedOk) return; if (! dircount) { - parsedOk = gFalse; + parsedOk = false; return; } @@ -1392,7 +1392,7 @@ void FoFiTrueType::parse() { (!openTypeCFF && seekTable("loca") < 0) || (!openTypeCFF && seekTable("glyf") < 0) || (openTypeCFF && seekTable("CFF ") < 0)) { - parsedOk = gFalse; + parsedOk = false; return; } @@ -1445,10 +1445,10 @@ void FoFiTrueType::parse() { void FoFiTrueType::readPostTable() { std::string name; int tablePos, postFmt, stringIdx, stringPos; - GBool ok; + bool ok; int i, j, n, m; - ok = gTrue; + ok = true; if ((i = seekTable("post")) < 0) { return; } @@ -1474,7 +1474,7 @@ void FoFiTrueType::readPostTable() { stringIdx = 0; stringPos = tablePos + 34 + 2*n; for (i = 0; i < n; ++i) { - ok = gTrue; + ok = true; j = getU16BE(tablePos + 34 + 2*i, &ok); if (j < 258) { nameToGID[macGlyphNames[j]] = i; diff --git a/fofi/FoFiTrueType.h b/fofi/FoFiTrueType.h index e364112c..3f2a1b7d 100644 --- a/fofi/FoFiTrueType.h +++ b/fofi/FoFiTrueType.h @@ -55,7 +55,7 @@ public: // Returns true if this an OpenType font containing CFF data, false // if it's a TrueType font (or OpenType font with TrueType data). - GBool isOpenTypeCFF() const { return openTypeCFF; } + bool isOpenTypeCFF() const { return openTypeCFF; } // Return the number of cmaps defined by this font. int getNumCmaps() const; @@ -118,7 +118,7 @@ public: // otherwise it will be left as binary data. If <psName> is // non-NULL, it will be used as the PostScript font name. (Only // useful for OpenType CFF fonts.) - void convertToType1(const char *psName, const char **newEncoding, GBool ascii, + void convertToType1(const char *psName, const char **newEncoding, bool ascii, FoFiOutputFunc outputFunc, void *outputStream) const; // Convert to a Type 2 CIDFont, suitable for embedding in a @@ -127,7 +127,7 @@ public: // font). The <cidMap> array maps CIDs to GIDs; it has <nCIDs> // entries. (Not useful for OpenType CFF fonts.) void convertToCIDType2(const char *psName, int *cidMap, int nCIDs, - GBool needVerticalMetrics, + bool needVerticalMetrics, FoFiOutputFunc outputFunc, void *outputStream) const; // Convert to a Type 0 CIDFont, suitable for embedding in a @@ -142,7 +142,7 @@ public: // table in the font). The <cidMap> array maps CIDs to GIDs; it has // <nCIDs> entries. (Not useful for OpenType CFF fonts.) void convertToType0(const char *psName, int *cidMap, int nCIDs, - GBool needVerticalMetrics, + bool needVerticalMetrics, int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) const; @@ -155,7 +155,7 @@ public: // Returns a pointer to the CFF font embedded in this OpenType font. // If successful, sets *<start> and *<length>, and returns true. // Otherwise returns false. (Only useful for OpenType CFF fonts). - GBool getCFFBlock(char **start, int *length) const; + bool getCFFBlock(char **start, int *length) const; // setup vert/vrt2 GSUB for default lang int setupGSUB(const char *scriptName); @@ -165,7 +165,7 @@ public: private: - FoFiTrueType(const char *fileA, int lenA, GBool freeFileDataA, int faceIndexA); + FoFiTrueType(const char *fileA, int lenA, bool freeFileDataA, int faceIndexA); void cvtEncoding(char **encoding, FoFiOutputFunc outputFunc, void *outputStream) const; @@ -175,7 +175,7 @@ private: void *outputStream) const; void cvtSfnts(FoFiOutputFunc outputFunc, void *outputStream, GooString *name, - GBool needVerticalMetrics, + bool needVerticalMetrics, int *maxUsedGlyph) const; void dumpString(const Guchar *s, int length, FoFiOutputFunc outputFunc, @@ -198,9 +198,9 @@ private: int locaFmt; int bbox[4]; std::unordered_map<std::string,int> nameToGID; - GBool openTypeCFF; + bool openTypeCFF; - GBool parsedOk; + bool parsedOk; int faceIndex; Guint gsubFeatureTable; Guint gsubLookupList; diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc index 83faa4a1..00fb9591 100644 --- a/fofi/FoFiType1.cc +++ b/fofi/FoFiType1.cc @@ -42,7 +42,7 @@ //------------------------------------------------------------------------ FoFiType1 *FoFiType1::make(const char *fileA, int lenA) { - return new FoFiType1(fileA, lenA, gFalse); + return new FoFiType1(fileA, lenA, false); } FoFiType1 *FoFiType1::load(const char *fileName) { @@ -52,10 +52,10 @@ FoFiType1 *FoFiType1::load(const char *fileName) { if (!(fileA = FoFiBase::readFile(fileName, &lenA))) { return nullptr; } - return new FoFiType1(fileA, lenA, gTrue); + return new FoFiType1(fileA, lenA, true); } -FoFiType1::FoFiType1(const char *fileA, int lenA, GBool freeFileDataA): +FoFiType1::FoFiType1(const char *fileA, int lenA, bool freeFileDataA): FoFiBase(fileA, lenA, freeFileDataA) { name = nullptr; @@ -66,7 +66,7 @@ FoFiType1::FoFiType1(const char *fileA, int lenA, GBool freeFileDataA): fontMatrix[3] = 0.001; fontMatrix[4] = 0; fontMatrix[5] = 0; - parsed = gFalse; + parsed = false; undoPFB(); } @@ -214,9 +214,9 @@ void FoFiType1::parse() { char c; int n, code, base, i, j; char *tokptr; - GBool gotMatrix, continueLine; + bool gotMatrix, continueLine; - gotMatrix = gFalse; + gotMatrix = false; for (i = 1, line = (char *)file; i <= 100 && line && (!name || !encoding); ++i) { @@ -247,7 +247,7 @@ void FoFiType1::parse() { for (j = 0; j < 256; ++j) { encoding[j] = nullptr; } - continueLine = gFalse; + continueLine = false; for (j = 0, line = getNextLine(line); j < 300 && line && (line1 = getNextLine(line)); ++j, line = line1) { @@ -256,7 +256,7 @@ void FoFiType1::parse() { n = 255; } if (continueLine) { - continueLine = gFalse; + continueLine = false; if ((line1 - firstLine) + 1 > (int)sizeof(buf)) break; p = firstLine; @@ -287,7 +287,7 @@ void FoFiType1::parse() { } else if (*p >= '0' && *p <= '9') { base = 10; } else if (*p == '\n' || *p == '\r') { - continueLine = gTrue; + continueLine = true; break; } else { break; @@ -297,7 +297,7 @@ void FoFiType1::parse() { } for (; *p == ' ' || *p == '\t'; ++p) ; if (*p == '\n' || *p == '\r') { - continueLine = gTrue; + continueLine = true; break; } else if (*p != '/') { break; @@ -313,7 +313,7 @@ void FoFiType1::parse() { } for (p = p2; *p == ' ' || *p == '\t'; ++p) ; if (*p == '\n' || *p == '\r') { - continueLine = gTrue; + continueLine = true; break; } if (strncmp(p, "put", 3)) { @@ -353,24 +353,24 @@ void FoFiType1::parse() { } } } - gotMatrix = gTrue; + gotMatrix = true; } else { line = getNextLine(line); } } - parsed = gTrue; + parsed = true; } // Undo the PFB encoding, i.e., remove the PFB headers. void FoFiType1::undoPFB() { - GBool ok; + bool ok; Guchar *file2; int pos1, pos2, type; Guint segLen; - ok = gTrue; + ok = true; if (getU8(0, &ok) != 0x80 || !ok) { return; } @@ -394,6 +394,6 @@ void FoFiType1::undoPFB() { gfree((char*)file); } file = file2; - freeFileData = gTrue; + freeFileData = true; len = pos2; } diff --git a/fofi/FoFiType1.h b/fofi/FoFiType1.h index 7902be53..313b2981 100644 --- a/fofi/FoFiType1.h +++ b/fofi/FoFiType1.h @@ -57,7 +57,7 @@ public: private: - FoFiType1(const char *fileA, int lenA, GBool freeFileDataA); + FoFiType1(const char *fileA, int lenA, bool freeFileDataA); char *getNextLine(char *line) const; void parse(); @@ -66,7 +66,7 @@ private: char *name; char **encoding; double fontMatrix[6]; - GBool parsed; + bool parsed; }; #endif diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc index 2312f3af..d079f0b5 100644 --- a/fofi/FoFiType1C.cc +++ b/fofi/FoFiType1C.cc @@ -46,7 +46,7 @@ static char hexChars[17] = "0123456789ABCDEF"; FoFiType1C *FoFiType1C::make(const char *fileA, int lenA) { FoFiType1C *ff; - ff = new FoFiType1C(fileA, lenA, gFalse); + ff = new FoFiType1C(fileA, lenA, false); if (!ff->parse()) { delete ff; return nullptr; @@ -62,7 +62,7 @@ FoFiType1C *FoFiType1C::load(const char *fileName) { if (!(fileA = FoFiBase::readFile(fileName, &lenA))) { return nullptr; } - ff = new FoFiType1C(fileA, lenA, gTrue); + ff = new FoFiType1C(fileA, lenA, true); if (!ff->parse()) { delete ff; return nullptr; @@ -70,7 +70,7 @@ FoFiType1C *FoFiType1C::load(const char *fileName) { return ff; } -FoFiType1C::FoFiType1C(const char *fileA, int lenA, GBool freeFileDataA): +FoFiType1C::FoFiType1C(const char *fileA, int lenA, bool freeFileDataA): FoFiBase(fileA, lenA, freeFileDataA) { name = nullptr; @@ -119,9 +119,9 @@ char **FoFiType1C::getEncoding() const { GooString *FoFiType1C::getGlyphName(int gid) const { char buf[256]; - GBool ok; + bool ok; - ok = gTrue; + ok = true; if (gid < 0 || gid >= charsetLength) return nullptr; getString(charset[gid], buf, &ok); @@ -188,7 +188,7 @@ void FoFiType1C::getFontMatrix(double *mat) const { } } -void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GBool ascii, +void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bool ascii, FoFiOutputFunc outputFunc, void *outputStream) { int psNameLen; @@ -198,7 +198,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GB GooString *buf; char buf2[256]; const char **enc; - GBool ok; + bool ok; int i; if (psName) { @@ -209,7 +209,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GB } // write header and font dictionary, up to encoding - ok = gTrue; + ok = true; (*outputFunc)(outputStream, "%!FontType1-1.0: ", 17); (*outputFunc)(outputStream, psName, psNameLen); if (topDict.versionSID != 0) { @@ -450,7 +450,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GB } // set up subroutines - ok = gTrue; + ok = true; getIndex(privateDicts[0].subrsOffset, &subrIdx, &ok); if (!ok) { subrIdx.pos = -1; @@ -462,7 +462,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GB eexecWrite(&eb, buf->getCString()); delete buf; for (i = 0; i < nGlyphs; ++i) { - ok = gTrue; + ok = true; getIndexVal(&charStringsIdx, i, &val, &ok); if (ok && i < charsetLength) { getString(charset[i], buf2, &ok); @@ -499,7 +499,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, int nCIDs, gdBytes; GooString *buf; char buf2[256]; - GBool ok; + bool ok; int gid, offset, n, i, j, k; // compute the CID count and build the CID-to-GID mapping @@ -541,7 +541,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, for (i = 0; i < nCIDs; ++i) { charStringOffsets[i] = charStrings->getLength(); if ((gid = cidMap[i]) >= 0) { - ok = gTrue; + ok = true; getIndexVal(&charStringsIdx, gid, &val, &ok); if (ok) { getIndex(privateDicts[fdSelect ? fdSelect[gid] : 0].subrsOffset, @@ -550,7 +550,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, subrIdx.pos = -1; } cvtGlyph(val.pos, val.len, charStrings, - &subrIdx, &privateDicts[fdSelect ? fdSelect[gid] : 0], gTrue); + &subrIdx, &privateDicts[fdSelect ? fdSelect[gid] : 0], true); } } } @@ -580,14 +580,14 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, (*outputFunc)(outputStream, "/CIDFontType 0 def\n", 19); (*outputFunc)(outputStream, "/CIDSystemInfo 3 dict dup begin\n", 32); if (topDict.registrySID > 0 && topDict.orderingSID > 0) { - ok = gTrue; + ok = true; getString(topDict.registrySID, buf2, &ok); if (ok) { (*outputFunc)(outputStream, " /Registry (", 13); (*outputFunc)(outputStream, buf2, strlen(buf2)); (*outputFunc)(outputStream, ") def\n", 6); } - ok = gTrue; + ok = true; getString(topDict.orderingSID, buf2, &ok); if (ok) { (*outputFunc)(outputStream, " /Ordering (", 13); @@ -842,7 +842,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, int nCIDs; GooString *buf; Type1CEexecBuf eb; - GBool ok; + bool ok; int fd, i, j, k; // compute the CID count and build the CID-to-GID mapping @@ -955,7 +955,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, (*outputFunc)(outputStream, "currentfile eexec\n", 18); eb.outputFunc = outputFunc; eb.outputStream = outputStream; - eb.ascii = gTrue; + eb.ascii = true; eb.r1 = 55665; eb.line = 0; @@ -1084,7 +1084,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, } // set up the subroutines - ok = gTrue; + ok = true; getIndex(privateDicts[fd].subrsOffset, &subrIdx, &ok); if (!ok) { subrIdx.pos = -1; @@ -1094,7 +1094,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, eexecWrite(&eb, "2 index /CharStrings 256 dict dup begin\n"); // write the .notdef CharString - ok = gTrue; + ok = true; getIndexVal(&charStringsIdx, 0, &val, &ok); if (ok) { eexecCvtGlyph(&eb, ".notdef", val.pos, val.len, @@ -1104,7 +1104,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, // write the CharStrings for (j = 0; j < 256 && i+j < nCIDs; ++j) { if (cidMap[i+j] >= 0) { - ok = gTrue; + ok = true; getIndexVal(&charStringsIdx, cidMap[i+j], &val, &ok); if (ok) { buf = GooString::format("c{0:02x}", j); @@ -1181,7 +1181,7 @@ void FoFiType1C::eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName, // generate the charstring charBuf = new GooString(); - cvtGlyph(offset, nBytes, charBuf, subrIdx, pDict, gTrue); + cvtGlyph(offset, nBytes, charBuf, subrIdx, pDict, true); buf = GooString::format("/{0:s} {1:d} RD ", glyphName, charBuf->getLength()); eexecWrite(eb, buf->getCString()); @@ -1195,9 +1195,9 @@ void FoFiType1C::eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName, void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, Type1CIndex *subrIdx, Type1CPrivateDict *pDict, - GBool top) { + bool top) { Type1CIndexVal val; - GBool ok, dFP; + bool ok, dFP; double d, dx, dy; Gushort r2; Guchar byte; @@ -1211,14 +1211,14 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)134); nOps = 0; nHints = 0; - firstOp = gTrue; - openPath = gFalse; + firstOp = true; + openPath = false; } pos = offset; while (pos < offset + nBytes) { - ok = gTrue; - pos = getOp(pos, gTrue, &ok); + ok = true; + pos = getOp(pos, true, &ok); if (!ok) { break; } @@ -1228,13 +1228,13 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0001: // hstem if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps & 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 hstem", nOps); } d = 0; - dFP = gFalse; + dFP = false; for (k = 0; k < nOps; k += 2) { // convert Type 2 edge hints (-20 or -21) to Type 1 ghost hints if (ops[k+1].num < 0) { @@ -1258,13 +1258,13 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0003: // vstem if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps & 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 vstem", nOps); } d = 0; - dFP = gFalse; + dFP = false; for (k = 0; k < nOps; k += 2) { // convert Type 2 edge hints (-20 or -21) to Type 1 ghost hints if (ops[k+1].num < 0) { @@ -1288,11 +1288,11 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0004: // vmoveto if (firstOp) { cvtGlyphWidth(nOps == 2, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (openPath) { charBuf->append((char)9); - openPath = gFalse; + openPath = false; } if (nOps != 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 vmoveto", nOps); @@ -1311,7 +1311,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)5); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0006: // hlineto if (nOps < 1) { @@ -1322,7 +1322,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)((k & 1) ? 7 : 6)); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0007: // vlineto if (nOps < 1) { @@ -1333,7 +1333,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)((k & 1) ? 6 : 7)); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0008: // rrcurveto if (nOps < 6 || nOps % 6 != 0) { @@ -1349,7 +1349,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x000a: // callsubr if (nOps >= 1) { @@ -1357,10 +1357,10 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, ? 107 : (subrIdx->len < 33900) ? 1131 : 32768; k = subrBias + (int)ops[nOps - 1].num; --nOps; - ok = gTrue; + ok = true; getIndexVal(subrIdx, k, &val, &ok); if (likely(ok && val.pos != offset)) { - cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, gFalse); + cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, false); } } else { //~ error(-1, "Too few args to Type 2 callsubr"); @@ -1373,14 +1373,14 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x000e: // endchar / seac if (firstOp) { cvtGlyphWidth(nOps == 1 || nOps == 5, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (openPath) { charBuf->append((char)9); - openPath = gFalse; + openPath = false; } if (nOps == 4) { - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[0].num, ops[0].isFP, charBuf); cvtNum(ops[1].num, ops[1].isFP, charBuf); cvtNum(ops[2].num, ops[2].isFP, charBuf); @@ -1397,7 +1397,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // this op is ignored, but we need the glyph width if (firstOp) { cvtGlyphWidth(nOps > 0, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } nOps = 0; break; @@ -1409,7 +1409,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // ignored if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps & 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 hstemhm", nOps); @@ -1421,7 +1421,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // ignored if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps > 0) { if (nOps & 1) { @@ -1437,7 +1437,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // ignored if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps > 0) { if (nOps & 1) { @@ -1452,11 +1452,11 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0015: // rmoveto if (firstOp) { cvtGlyphWidth(nOps == 3, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (openPath) { charBuf->append((char)9); - openPath = gFalse; + openPath = false; } if (nOps != 2) { //~ error(-1, "Wrong number of args (%d) to Type 2 rmoveto", nOps); @@ -1469,11 +1469,11 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0016: // hmoveto if (firstOp) { cvtGlyphWidth(nOps == 2, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (openPath) { charBuf->append((char)9); - openPath = gFalse; + openPath = false; } if (nOps != 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 hmoveto", nOps); @@ -1486,7 +1486,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // ignored if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps & 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 vstemhm", nOps); @@ -1511,7 +1511,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[k+1].num, ops[k].isFP, charBuf); charBuf->append((char)5); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0019: // rlinecurve if (nOps < 8 || (nOps - 6) % 2 != 0) { @@ -1530,7 +1530,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[k+5].num, ops[k+5].isFP, charBuf); charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x001a: // vvcurveto if (nOps < 4 || !(nOps % 4 == 0 || (nOps-1) % 4 == 0)) { @@ -1541,7 +1541,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[1].num, ops[1].isFP, charBuf); cvtNum(ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[3].num, ops[3].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[4].num, ops[4].isFP, charBuf); charBuf->append((char)8); k = 5; @@ -1549,16 +1549,16 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, k = 0; } for (; k < nOps; k += 4) { - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k].num, ops[k].isFP, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k+3].num, ops[k+3].isFP, charBuf); charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x001b: // hhcurveto if (nOps < 4 || !(nOps % 4 == 0 || (nOps-1) % 4 == 0)) { @@ -1570,7 +1570,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[3].num, ops[3].isFP, charBuf); cvtNum(ops[4].num, ops[4].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); k = 5; } else { @@ -1578,24 +1578,24 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, } for (; k < nOps; k += 4) { cvtNum(ops[k].num, ops[k].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); cvtNum(ops[k+3].num, ops[k+3].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x001d: // callgsubr if (nOps >= 1) { k = gsubrBias + (int)ops[nOps - 1].num; --nOps; - ok = gTrue; + ok = true; getIndexVal(&gsubrIdx, k, &val, &ok); if (likely(ok && val.pos != offset)) { - cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, gFalse); + cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, false); } } else { //~ error(-1, "Too few args to Type 2 callgsubr"); @@ -1623,7 +1623,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, } if (k == nOps-5) { if (k % 8 == 0) { - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k].num, ops[k].isFP, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); @@ -1631,7 +1631,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[k+4].num, ops[k+4].isFP, charBuf); } else { cvtNum(ops[k].num, ops[k].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); cvtNum(ops[k+4].num, ops[k+4].isFP, charBuf); @@ -1640,7 +1640,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x001f: // hvcurveto if (nOps < 4 || !(nOps % 4 == 0 || (nOps-1) % 4 == 0)) { @@ -1664,13 +1664,13 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, if (k == nOps-5) { if (k % 8 == 0) { cvtNum(ops[k].num, ops[k].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); cvtNum(ops[k+4].num, ops[k+4].isFP, charBuf); cvtNum(ops[k+3].num, ops[k+3].isFP, charBuf); } else { - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k].num, ops[k].isFP, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); @@ -1680,7 +1680,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0c00: // dotsection (should be Type 1 only?) // ignored @@ -1716,21 +1716,21 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, //~ error(-1, "Wrong number of args (%d) to Type 2 hflex", nOps); } cvtNum(ops[0].num, ops[0].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[1].num, ops[1].isFP, charBuf); cvtNum(ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[3].num, ops[3].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); cvtNum(ops[4].num, ops[4].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[5].num, ops[5].isFP, charBuf); cvtNum(-ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[6].num, ops[6].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0c23: // flex if (nOps != 13) { @@ -1751,7 +1751,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[11].num, ops[11].isFP, charBuf); charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0c24: // hflex1 if (nOps != 9) { @@ -1762,10 +1762,10 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[3].num, ops[3].isFP, charBuf); cvtNum(ops[4].num, ops[4].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); cvtNum(ops[5].num, ops[5].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[6].num, ops[6].isFP, charBuf); cvtNum(ops[7].num, ops[7].isFP, charBuf); cvtNum(ops[8].num, ops[8].isFP, charBuf); @@ -1773,7 +1773,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, ops[1].isFP | ops[3].isFP | ops[7].isFP, charBuf); charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0c25: // flex1 if (nOps != 11) { @@ -1803,7 +1803,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, } charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; default: //~ error(-1, "Illegal Type 2 charstring op: %04x", @@ -1825,10 +1825,10 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, } } -void FoFiType1C::cvtGlyphWidth(GBool useOp, GooString *charBuf, +void FoFiType1C::cvtGlyphWidth(bool useOp, GooString *charBuf, Type1CPrivateDict *pDict) { double w; - GBool wFP; + bool wFP; int i; if (useOp) { @@ -1842,12 +1842,12 @@ void FoFiType1C::cvtGlyphWidth(GBool useOp, GooString *charBuf, w = pDict->defaultWidthX; wFP = pDict->defaultWidthXFP; } - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(w, wFP, charBuf); charBuf->append((char)13); } -void FoFiType1C::cvtNum(double x, GBool isFP, GooString *charBuf) const { +void FoFiType1C::cvtNum(double x, bool isFP, GooString *charBuf) const { Guchar buf[12]; int y, n; @@ -1974,12 +1974,12 @@ void FoFiType1C::writePSString(const char *s, FoFiOutputFunc outputFunc, (*outputFunc)(outputStream, buf, i); } -GBool FoFiType1C::parse() { +bool FoFiType1C::parse() { Type1CIndex fdIdx; Type1CIndexVal val; int i; - parsedOk = gTrue; + parsedOk = true; // some tools embed Type 1C fonts with an extra whitespace char at // the beginning @@ -1994,7 +1994,7 @@ GBool FoFiType1C::parse() { getIndex(topDictIdx.endPos, &stringIdx, &parsedOk); getIndex(stringIdx.endPos, &gsubrIdx, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } gsubrBias = (gsubrIdx.len < 1240) ? 107 : (gsubrIdx.len < 33900) ? 1131 : 32768; @@ -2002,7 +2002,7 @@ GBool FoFiType1C::parse() { // read the first font name getIndexVal(&nameIdx, 0, &val, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } name = new GooString((char *)&file[val.pos], val.len); @@ -2018,7 +2018,7 @@ GBool FoFiType1C::parse() { } else { getIndex(topDict.fdArrayOffset, &fdIdx, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } nFDs = fdIdx.len; privateDicts = (Type1CPrivateDict *) @@ -2026,7 +2026,7 @@ GBool FoFiType1C::parse() { for (i = 0; i < nFDs; ++i) { getIndexVal(&fdIdx, i, &val, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } readFD(val.pos, val.len, &privateDicts[i]); } @@ -2042,17 +2042,17 @@ GBool FoFiType1C::parse() { // check for parse errors in the private dict(s) if (!parsedOk) { - return gFalse; + return false; } // get the charstrings index if (topDict.charStringsOffset <= 0) { - parsedOk = gFalse; - return gFalse; + parsedOk = false; + return false; } getIndex(topDict.charStringsOffset, &charStringsIdx, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } nGlyphs = charStringsIdx.len; @@ -2060,21 +2060,21 @@ GBool FoFiType1C::parse() { if (topDict.firstOp == 0x0c1e) { readFDSelect(); if (!parsedOk) { - return gFalse; + return false; } } // read the charset if (!readCharset()) { - parsedOk = gFalse; - return gFalse; + parsedOk = false; + return false; } // for 8-bit fonts: build the encoding if (topDict.firstOp != 0x0c14 && topDict.firstOp != 0x0c1e) { buildEncoding(); if (!parsedOk) { - return gFalse; + return false; } } @@ -2104,7 +2104,7 @@ void FoFiType1C::readTopDict() { topDict.fontMatrix[3] = 0.001; topDict.fontMatrix[4] = 0; topDict.fontMatrix[5] = 0; - topDict.hasFontMatrix = gFalse; + topDict.hasFontMatrix = false; topDict.uniqueID = 0; topDict.fontBBox[0] = 0; topDict.fontBBox[1] = 0; @@ -2129,7 +2129,7 @@ void FoFiType1C::readTopDict() { pos = topDictPtr.pos; nOps = 0; while (pos < topDictPtr.pos + topDictPtr.len) { - pos = getOp(pos, gFalse, &parsedOk); + pos = getOp(pos, false, &parsedOk); if (!parsedOk) { break; } @@ -2157,7 +2157,7 @@ void FoFiType1C::readTopDict() { topDict.fontMatrix[3] = ops[3].num; topDict.fontMatrix[4] = ops[4].num; topDict.fontMatrix[5] = ops[5].num; - topDict.hasFontMatrix = gTrue; break; + topDict.hasFontMatrix = true; break; case 0x000d: topDict.uniqueID = (int)ops[0].num; break; case 0x0005: topDict.fontBBox[0] = ops[0].num; topDict.fontBBox[1] = ops[1].num; @@ -2186,9 +2186,9 @@ void FoFiType1C::readTopDict() { void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) { int pSize, pOffset; double fontMatrix[6] = {0}; - GBool hasFontMatrix; + bool hasFontMatrix; - hasFontMatrix = gFalse; + hasFontMatrix = false; fontMatrix[0] = fontMatrix[1] = fontMatrix[2] = 0; // make gcc happy fontMatrix[3] = fontMatrix[4] = fontMatrix[5] = 0; pSize = pOffset = 0; @@ -2201,14 +2201,14 @@ void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) { int pos = offset; nOps = 0; while (pos < posEnd) { - pos = getOp(pos, gFalse, &parsedOk); + pos = getOp(pos, false, &parsedOk); if (!parsedOk) { return; } if (!ops[nOps - 1].isNum) { if (ops[nOps - 1].op == 0x0012) { if (nOps < 3) { - parsedOk = gFalse; + parsedOk = false; return; } pSize = (int)ops[0].num; @@ -2221,7 +2221,7 @@ void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) { fontMatrix[3] = ops[3].num; fontMatrix[4] = ops[4].num; fontMatrix[5] = ops[5].num; - hasFontMatrix = gTrue; + hasFontMatrix = true; } nOps = 0; } @@ -2234,13 +2234,13 @@ void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) { pDict->fontMatrix[3] = fontMatrix[3]; pDict->fontMatrix[4] = fontMatrix[4]; pDict->fontMatrix[5] = fontMatrix[5]; - pDict->hasFontMatrix = gTrue; + pDict->hasFontMatrix = true; } } void FoFiType1C::readPrivateDict(int offset, int length, Type1CPrivateDict *pDict) { - pDict->hasFontMatrix = gFalse; + pDict->hasFontMatrix = false; pDict->nBlueValues = 0; pDict->nOtherBlues = 0; pDict->nFamilyBlues = 0; @@ -2248,20 +2248,20 @@ void FoFiType1C::readPrivateDict(int offset, int length, pDict->blueScale = 0.039625; pDict->blueShift = 7; pDict->blueFuzz = 1; - pDict->hasStdHW = gFalse; - pDict->hasStdVW = gFalse; + pDict->hasStdHW = false; + pDict->hasStdVW = false; pDict->nStemSnapH = 0; pDict->nStemSnapV = 0; - pDict->hasForceBold = gFalse; + pDict->hasForceBold = false; pDict->forceBoldThreshold = 0; pDict->languageGroup = 0; pDict->expansionFactor = 0.06; pDict->initialRandomSeed = 0; pDict->subrsOffset = 0; pDict->defaultWidthX = 0; - pDict->defaultWidthXFP = gFalse; + pDict->defaultWidthXFP = false; pDict->nominalWidthX = 0; - pDict->nominalWidthXFP = gFalse; + pDict->nominalWidthXFP = false; // no dictionary if (offset == 0 || length == 0) { @@ -2276,7 +2276,7 @@ void FoFiType1C::readPrivateDict(int offset, int length, int pos = offset; nOps = 0; while (pos < posEnd) { - pos = getOp(pos, gFalse, &parsedOk); + pos = getOp(pos, false, &parsedOk); if (!parsedOk) { break; } @@ -2310,11 +2310,11 @@ void FoFiType1C::readPrivateDict(int offset, int length, break; case 0x000a: pDict->stdHW = ops[0].num; - pDict->hasStdHW = gTrue; + pDict->hasStdHW = true; break; case 0x000b: pDict->stdVW = ops[0].num; - pDict->hasStdVW = gTrue; + pDict->hasStdVW = true; break; case 0x0c0c: pDict->nStemSnapH = getDeltaFPArray(pDict->stemSnapH, @@ -2326,7 +2326,7 @@ void FoFiType1C::readPrivateDict(int offset, int length, break; case 0x0c0e: pDict->forceBold = ops[0].num != 0; - pDict->hasForceBold = gTrue; + pDict->hasForceBold = true; break; case 0x0c0f: pDict->forceBoldThreshold = ops[0].num; @@ -2373,7 +2373,7 @@ void FoFiType1C::readFDSelect() { } if (fdSelectFmt == 0) { if (!checkRegion(pos, nGlyphs)) { - parsedOk = gFalse; + parsedOk = false; return; } memcpy(fdSelect, file + pos, nGlyphs); @@ -2391,7 +2391,7 @@ void FoFiType1C::readFDSelect() { pos += 2; if (gid0 > gid1 || gid1 > nGlyphs) { //~ error(-1, "Bad FDSelect table in CID font"); - parsedOk = gFalse; + parsedOk = false; return; } for (j = gid0; j < gid1; ++j) { @@ -2496,7 +2496,7 @@ void FoFiType1C::buildEncoding() { } } -GBool FoFiType1C::readCharset() { +bool FoFiType1C::readCharset() { int charsetFormat, c, pos; int nLeft, i, j; @@ -2557,13 +2557,13 @@ GBool FoFiType1C::readCharset() { gfree(charset); charset = nullptr; charsetLength = 0; - return gFalse; + return false; } } - return gTrue; + return true; } -int FoFiType1C::getOp(int pos, GBool charstring, GBool *ok) { +int FoFiType1C::getOp(int pos, bool charstring, bool *ok) { static char nybChars[16] = "0123456789.ee -"; Type1COp op; char buf[65]; @@ -2621,7 +2621,7 @@ int FoFiType1C::getOp(int pos, GBool charstring, GBool *ok) { } while (i < 64); buf[i] = '\0'; op.num = gatof(buf); - op.isFP = gTrue; + op.isFP = true; } else if (b0 >= 32 && b0 <= 246) { op.num = b0 - 139; @@ -2641,14 +2641,14 @@ int FoFiType1C::getOp(int pos, GBool charstring, GBool *ok) { x |= ~0xffffffff; } op.num = (double)x / 65536.0; - op.isFP = gTrue; + op.isFP = true; } else if (b0 == 12) { - op.isNum = gFalse; + op.isNum = false; op.op = 0x0c00 + getU8(pos++, ok); } else { - op.isNum = gFalse; + op.isNum = false; op.op = b0; } @@ -2698,7 +2698,7 @@ int FoFiType1C::getDeltaFPArray(double *arr, int maxLen) const { return n; } -void FoFiType1C::getIndex(int pos, Type1CIndex *idx, GBool *ok) const { +void FoFiType1C::getIndex(int pos, Type1CIndex *idx, bool *ok) const { idx->pos = pos; idx->len = getU16BE(pos, ok); if (idx->len == 0) { @@ -2708,26 +2708,26 @@ void FoFiType1C::getIndex(int pos, Type1CIndex *idx, GBool *ok) const { } else { idx->offSize = getU8(pos + 2, ok); if (idx->offSize < 1 || idx->offSize > 4) { - *ok = gFalse; + *ok = false; } idx->startPos = pos + 3 + (idx->len + 1) * idx->offSize - 1; if (idx->startPos < 0 || idx->startPos >= len) { - *ok = gFalse; + *ok = false; } idx->endPos = idx->startPos + getUVarBE(pos + 3 + idx->len * idx->offSize, idx->offSize, ok); if (idx->endPos < idx->startPos || idx->endPos > len) { - *ok = gFalse; + *ok = false; } } } void FoFiType1C::getIndexVal(const Type1CIndex *idx, int i, - Type1CIndexVal *val, GBool *ok) const { + Type1CIndexVal *val, bool *ok) const { int pos0, pos1; if (i < 0 || i >= idx->len) { - *ok = gFalse; + *ok = false; return; } pos0 = idx->startPos + getUVarBE(idx->pos + 3 + i * idx->offSize, @@ -2737,14 +2737,14 @@ void FoFiType1C::getIndexVal(const Type1CIndex *idx, int i, if (pos0 < idx->startPos || pos0 > idx->endPos || pos1 <= idx->startPos || pos1 > idx->endPos || pos1 < pos0) { - *ok = gFalse; + *ok = false; return; } val->pos = pos0; val->len = pos1 - pos0; } -char *FoFiType1C::getString(int sid, char *buf, GBool *ok) const { +char *FoFiType1C::getString(int sid, char *buf, bool *ok) const { Type1CIndexVal val; int n; diff --git a/fofi/FoFiType1C.h b/fofi/FoFiType1C.h index 131fa311..0c7884fe 100644 --- a/fofi/FoFiType1C.h +++ b/fofi/FoFiType1C.h @@ -61,7 +61,7 @@ struct Type1CTopDict { int paintType; int charstringType; double fontMatrix[6]; - GBool hasFontMatrix; // CID fonts are allowed to put their + bool hasFontMatrix; // CID fonts are allowed to put their // FontMatrix in the FD instead of the // top dict int uniqueID; @@ -87,7 +87,7 @@ struct Type1CTopDict { struct Type1CPrivateDict { double fontMatrix[6]; - GBool hasFontMatrix; + bool hasFontMatrix; int blueValues[type1CMaxBlueValues]; int nBlueValues; int otherBlues[type1CMaxOtherBlues]; @@ -100,29 +100,29 @@ struct Type1CPrivateDict { int blueShift; int blueFuzz; double stdHW; - GBool hasStdHW; + bool hasStdHW; double stdVW; - GBool hasStdVW; + bool hasStdVW; double stemSnapH[type1CMaxStemSnap]; int nStemSnapH; double stemSnapV[type1CMaxStemSnap]; int nStemSnapV; - GBool forceBold; - GBool hasForceBold; + bool forceBold; + bool hasForceBold; double forceBoldThreshold; int languageGroup; double expansionFactor; int initialRandomSeed; int subrsOffset; double defaultWidthX; - GBool defaultWidthXFP; + bool defaultWidthXFP; double nominalWidthX; - GBool nominalWidthXFP; + bool nominalWidthXFP; }; struct Type1COp { - GBool isNum = gTrue; // true -> number, false -> operator - GBool isFP = gFalse; // true -> floating point number, false -> int + bool isNum = true; // true -> number, false -> operator + bool isFP = false; // true -> floating point number, false -> int union { double num = 0; // if num is true int op; // if num is false @@ -132,7 +132,7 @@ struct Type1COp { struct Type1CEexecBuf { FoFiOutputFunc outputFunc; void *outputStream; - GBool ascii; // ASCII encoding? + bool ascii; // ASCII encoding? Gushort r1; // eexec encryption key int line; // number of eexec chars left on current line }; @@ -176,7 +176,7 @@ public: // font. If <ascii> is true the eexec section will be hex-encoded, // otherwise it will be left as binary data. If <psName> is non-NULL, // it will be used as the PostScript font name. - void convertToType1(const char *psName, const char **newEncoding, GBool ascii, + void convertToType1(const char *psName, const char **newEncoding, bool ascii, FoFiOutputFunc outputFunc, void *outputStream); // Convert to a Type 0 CIDFont, suitable for embedding in a @@ -204,33 +204,33 @@ public: private: - FoFiType1C(const char *fileA, int lenA, GBool freeFileDataA); + FoFiType1C(const char *fileA, int lenA, bool freeFileDataA); void eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName, int offset, int nBytes, Type1CIndex *subrIdx, Type1CPrivateDict *pDict); void cvtGlyph(int offset, int nBytes, GooString *charBuf, Type1CIndex *subrIdx, Type1CPrivateDict *pDict, - GBool top); - void cvtGlyphWidth(GBool useOp, GooString *charBuf, + bool top); + void cvtGlyphWidth(bool useOp, GooString *charBuf, Type1CPrivateDict *pDict); - void cvtNum(double x, GBool isFP, GooString *charBuf) const; + void cvtNum(double x, bool isFP, GooString *charBuf) const; void eexecWrite(Type1CEexecBuf *eb, const char *s) const; void eexecWriteCharstring(Type1CEexecBuf *eb, const Guchar *s, int n) const; void writePSString(const char *s, FoFiOutputFunc outputFunc, void *outputStream) const; - GBool parse(); + bool parse(); void readTopDict(); void readFD(int offset, int length, Type1CPrivateDict *pDict); void readPrivateDict(int offset, int length, Type1CPrivateDict *pDict); void readFDSelect(); void buildEncoding(); - GBool readCharset(); - int getOp(int pos, GBool charstring, GBool *ok); + bool readCharset(); + int getOp(int pos, bool charstring, bool *ok); int getDeltaIntArray(int *arr, int maxLen) const; int getDeltaFPArray(double *arr, int maxLen) const; - void getIndex(int pos, Type1CIndex *idx, GBool *ok) const; - void getIndexVal(const Type1CIndex *idx, int i, Type1CIndexVal *val, GBool *ok) const; - char *getString(int sid, char *buf, GBool *ok) const; + void getIndex(int pos, Type1CIndex *idx, bool *ok) const; + void getIndexVal(const Type1CIndex *idx, int i, Type1CIndexVal *val, bool *ok) const; + char *getString(int sid, char *buf, bool *ok) const; GooString *name; char **encoding; @@ -251,13 +251,13 @@ private: Gushort charsetLength; int gsubrBias; - GBool parsedOk; + bool parsedOk; Type1COp ops[49]; // operands and operator int nOps; // number of operands int nHints; // number of hints for the current glyph - GBool firstOp; // true if we haven't hit the first op yet - GBool openPath; // true if there is an unclosed path + bool firstOp; // true if we haven't hit the first op yet + bool openPath; // true if there is an unclosed path }; #endif |