diff options
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/fofi')
12 files changed, 111 insertions, 161 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiBase.cc b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiBase.cc index 73cf2f59c15..e1951b08b9f 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiBase.cc +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiBase.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <limits.h> #include "gmem.h" diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiBase.h b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiBase.h index ffa14cfeb6d..c9f93ebacda 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiBase.h +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiBase.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" //------------------------------------------------------------------------ diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiEncodings.cc b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiEncodings.cc index 01ae5acdcc1..6b3debb9dab 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiEncodings.cc +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiEncodings.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include "gmempp.h" #include "FoFiEncodings.h" diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiEncodings.h b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiEncodings.h index 6094387d62d..dd85458c070 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiEncodings.h +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiEncodings.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" //------------------------------------------------------------------------ diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiIdentifier.cc b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiIdentifier.cc index fff1e26b346..4c6797ba9d6 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiIdentifier.cc +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiIdentifier.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <string.h> #include <limits.h> @@ -839,8 +843,6 @@ static GList *getDfontFontList(FILE *f) { resNameListOffset >= resMapLength) { goto err2; } - nFonts = 0; - refListOffset = 0; for (i = 0; i < nTypes; ++i) { offset = resTypeListOffset + 2 + 8 * i; if (resMap[offset] == 0x73 && // 'sfnt' diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiIdentifier.h b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiIdentifier.h index 497be445d6d..b0307a0b8d2 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiIdentifier.h +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiIdentifier.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + class GList; //------------------------------------------------------------------------ diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.cc b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.cc index a77b401cf55..57b12b14996 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.cc +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <string.h> #if HAVE_STD_SORT @@ -401,7 +405,7 @@ int FoFiTrueType::mapCodeToGID(int i, int c) { // to be 0xffff return 0; } - // invariant: seg[a].end < c <= seg[b].end + // invariant: seg[a].end < code <= seg[b].end while (b - a > 1 && ok) { m = (a + b) / 2; segEnd = getU16BE(pos + 14 + 2*m, &ok); @@ -435,31 +439,6 @@ int FoFiTrueType::mapCodeToGID(int i, int c) { } gid = getU16BE(pos + 10 + 2 * (c - cmapFirst), &ok); break; - case 12: - segCnt = getU32BE(pos + 12, &ok); - a = -1; - b = segCnt - 1; - segEnd = getU32BE(pos + 16 + 12*b + 4, &ok); - if (c > segEnd) { - return 0; - } - // invariant: seg[a].end < c <= seg[b].end - while (b - a > 1 && ok) { - m = (a + b) / 2; - segEnd = getU32BE(pos + 16 + 12*m + 4, &ok); - if (segEnd < c) { - a = m; - } else { - b = m; - } - } - segStart = getU32BE(pos + 16 + 12*b, &ok); - if (c < segStart) { - return 0; - } - segOffset = getU32BE(pos + 16 + 12*b + 8, &ok); - gid = segOffset + (c - segStart); - break; default: return 0; } diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.h b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.h index 568ee845ff4..619e1bd6676 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.h +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "FoFiBase.h" diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.cc b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.cc index 87278e755a5..83ec53ef5e8 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.cc +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <string.h> #include "gmem.h" diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.h b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.h index 3576391f09e..4a64f246dcb 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.h +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "FoFiBase.h" diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc index 64d676b195f..b6a13390b40 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <string.h> #include <math.h> @@ -177,16 +181,16 @@ GString *FoFiType1C::getGlyphName(int gid) { GHash *FoFiType1C::getNameToGIDMap() { GHash *map; - char glyphName[256]; + char name[256]; GBool ok; int gid; map = new GHash(gTrue); for (gid = 0; gid < nGlyphs; ++gid) { ok = gTrue; - getString(charset[gid], glyphName, &ok); + getString(charset[gid], name, &ok); if (ok) { - map->add(new GString(glyphName), gid); + map->add(new GString(name), gid); } } return map; @@ -1523,7 +1527,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GString *charBuf, if (nOps < 6 || nOps % 6 != 0) { //~ error(-1, "Wrong number of args (%d) to Type 2 rrcurveto", nOps); } - for (k = 0; k+5 < nOps; k += 6) { + for (k = 0; k < nOps; k += 6) { cvtNum(ops[k], charBuf); cvtNum(ops[k+1], charBuf); cvtNum(ops[k+2], charBuf); @@ -1692,11 +1696,9 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GString *charBuf, cvtNum(ops[k+5], charBuf); charBuf->append((char)8); } - if (k+1 < nOps) { - cvtNum(ops[k], charBuf); - cvtNum(ops[k+1], charBuf); - charBuf->append((char)5); - } + cvtNum(ops[k], charBuf); + cvtNum(ops[k+1], charBuf); + charBuf->append((char)5); nOps = 0; openPath = gTrue; break; @@ -1709,15 +1711,13 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GString *charBuf, cvtNum(ops[k+1], charBuf); charBuf->append((char)5); } - if (k+5 < nOps) { - cvtNum(ops[k], charBuf); - cvtNum(ops[k+1], charBuf); - cvtNum(ops[k+2], charBuf); - cvtNum(ops[k+3], charBuf); - cvtNum(ops[k+4], charBuf); - cvtNum(ops[k+5], charBuf); - charBuf->append((char)8); - } + cvtNum(ops[k], charBuf); + cvtNum(ops[k+1], charBuf); + cvtNum(ops[k+2], charBuf); + cvtNum(ops[k+3], charBuf); + cvtNum(ops[k+4], charBuf); + cvtNum(ops[k+5], charBuf); + charBuf->append((char)8); nOps = 0; openPath = gTrue; break; @@ -2251,7 +2251,43 @@ void FoFiType1C::convertToOpenType(FoFiOutputFunc outputFunc, void *outputStream, int nWidths, Gushort *widths, Guchar *cmapTable, int cmapTableLen) { - Guchar os2Table[96], headTable[54], hheaTable[36], maxpTable[6]; + // dummy OS/2 table (taken from FoFiTrueType::writeTTF) + static Guchar os2Tab[86] = { + 0, 1, // version + 0, 1, // xAvgCharWidth + 0x01, 0x90, // usWeightClass + 0, 5, // usWidthClass + 0, 0, // fsType + 0, 0, // ySubscriptXSize + 0, 0, // ySubscriptYSize + 0, 0, // ySubscriptXOffset + 0, 0, // ySubscriptYOffset + 0, 0, // ySuperscriptXSize + 0, 0, // ySuperscriptYSize + 0, 0, // ySuperscriptXOffset + 0, 0, // ySuperscriptYOffset + 0, 0, // yStrikeoutSize + 0, 0, // yStrikeoutPosition + 0, 0, // sFamilyClass + 0, 0, 0, 0, 0, // panose + 0, 0, 0, 0, 0, + 0, 0, 0, 0, // ulUnicodeRange1 + 0, 0, 0, 0, // ulUnicodeRange2 + 0, 0, 0, 0, // ulUnicodeRange3 + 0, 0, 0, 0, // ulUnicodeRange4 + 0, 0, 0, 0, // achVendID + 0, 0, // fsSelection + 0, 0, // usFirstCharIndex + 0, 0, // usLastCharIndex + 0, 0, // sTypoAscender + 0, 0, // sTypoDescender + 0, 0, // sTypoLineGap + 0x20, 0x00, // usWinAscent + 0x20, 0x00, // usWinDescent + 0, 0, 0, 1, // ulCodePageRange1 + 0, 0, 0, 0 // ulCodePageRange2 + }; + Guchar headTable[54], hheaTable[36], maxpTable[6]; Guchar nameTable[26], postTable[32]; Guchar *hmtxTable; static const char *tableTag[9] = { @@ -2271,118 +2307,15 @@ void FoFiType1C::convertToOpenType(FoFiOutputFunc outputFunc, double mat[6]; Gushort maxWidth; Guint checksum, fileChecksum; - int unitsPerEm, xMin, yMin, xMax, yMax, ascent, descent, offset, i; - - xMin = (int)(topDict.fontBBox[0] + 0.5); - yMin = (int)(topDict.fontBBox[1] + 0.5); - xMax = (int)(topDict.fontBBox[2] + 0.5); - yMax = (int)(topDict.fontBBox[3] + 0.5); - ascent = yMax; - descent = -yMin; + int unitsPerEm, xMin, yMin, xMax, yMax, offset, i; //--- CFF_ table tableData[0] = file; tableLength[0] = len; //--- OS/2 table - os2Table[ 0] = 0; // version - os2Table[ 1] = 4; - os2Table[ 2] = 0; // xAvgCharWidth - os2Table[ 3] = 1; - os2Table[ 4] = 0x01; // usWeightClass - os2Table[ 5] = 0x90; - os2Table[ 6] = 0; // usWidthClass - os2Table[ 7] = 5; - os2Table[ 8] = 0; // fsType - os2Table[ 9] = 0; - os2Table[10] = 0; // ySubscriptXSize - os2Table[11] = 0; - os2Table[12] = 0; // ySubscriptYSize - os2Table[13] = 0; - os2Table[14] = 0; // ySubscriptXOffset - os2Table[15] = 0; - os2Table[16] = 0; // ySubscriptYOffset - os2Table[17] = 0; - os2Table[18] = 0; // ySuperscriptXSize - os2Table[19] = 0; - os2Table[20] = 0; // ySuperscriptYSize - os2Table[21] = 0; - os2Table[22] = 0; // ySuperscriptXOffset - os2Table[23] = 0; - os2Table[24] = 0; // ySuperscriptYOffset - os2Table[25] = 0; - os2Table[26] = 0; // yStrikeoutSize - os2Table[27] = 0; - os2Table[28] = 0; // yStrikeoutPosition - os2Table[29] = 0; - os2Table[30] = 0; // sFamilyClass - os2Table[31] = 0; - os2Table[32] = 0; // panose - os2Table[33] = 0; - os2Table[34] = 0; - os2Table[35] = 0; - os2Table[36] = 0; - os2Table[37] = 0; - os2Table[38] = 0; - os2Table[39] = 0; - os2Table[40] = 0; - os2Table[41] = 0; - os2Table[42] = 0; // ulUnicodeRange1 - os2Table[43] = 0; - os2Table[44] = 0; - os2Table[45] = 0; - os2Table[46] = 0; // ulUnicodeRange2 - os2Table[47] = 0; - os2Table[48] = 0; - os2Table[49] = 0; - os2Table[50] = 0; // ulUnicodeRange3 - os2Table[51] = 0; - os2Table[52] = 0; - os2Table[53] = 0; - os2Table[54] = 0; // ulUnicodeRange4 - os2Table[55] = 0; - os2Table[56] = 0; - os2Table[57] = 0; - os2Table[58] = 0; // achVendID - os2Table[59] = 0; - os2Table[60] = 0; - os2Table[61] = 0; - os2Table[62] = 0; // fsSelection - os2Table[63] = 0; - os2Table[64] = 0; // usFirstCharIndex - os2Table[65] = 0; - os2Table[66] = 0; // usLastCharIndex - os2Table[67] = 0; - os2Table[68] = 0; // sTypoAscender - os2Table[69] = 0; - os2Table[70] = 0; // sTypoDescender - os2Table[71] = 0; - os2Table[72] = 0; // sTypoLineGap - os2Table[73] = 0; - os2Table[74] = (Guchar)(ascent >> 8); // usWinAscent - os2Table[75] = (Guchar)ascent; - os2Table[76] = (Guchar)(descent >> 8); // usWinDescent - os2Table[77] = (Guchar)descent; - os2Table[78] = 0; // ulCodePageRange1 - os2Table[79] = 0; - os2Table[80] = 0; - os2Table[81] = 1; - os2Table[82] = 0; // ulCodePageRange2 - os2Table[83] = 0; - os2Table[84] = 0; - os2Table[85] = 0; - os2Table[86] = 0; // sxHeight - os2Table[87] = 0; - os2Table[88] = 0; // sCapHeight - os2Table[89] = 0; - os2Table[90] = 0; // usDefaultChar - os2Table[91] = 0; - os2Table[92] = 0; // usBreakChar - os2Table[93] = 0; - os2Table[94] = 0; // usMaxContext - os2Table[95] = 0; - tableData[1] = os2Table; - tableLength[1] = 96; + tableData[1] = os2Tab; + tableLength[1] = 86; //--- cmap table tableData[2] = cmapTable; @@ -2395,14 +2328,18 @@ void FoFiType1C::convertToOpenType(FoFiOutputFunc outputFunc, } else { unitsPerEm = (int)(1 / mat[0] + 0.5); } + xMin = (int)(topDict.fontBBox[0] + 0.5); + yMin = (int)(topDict.fontBBox[1] + 0.5); + xMax = (int)(topDict.fontBBox[2] + 0.5); + yMax = (int)(topDict.fontBBox[3] + 0.5); headTable[ 0] = 0x00; // version headTable[ 1] = 0x01; headTable[ 2] = 0x00; headTable[ 3] = 0x00; headTable[ 4] = 0x00; // revision - headTable[ 5] = 0x01; // (needs to be non-zero) + headTable[ 5] = 0x00; headTable[ 6] = 0x00; - headTable[ 7] = 0x01; + headTable[ 7] = 0x00; headTable[ 8] = 0x00; // checksumAdjustment headTable[ 9] = 0x00; // (set later) headTable[10] = 0x00; @@ -2453,8 +2390,8 @@ void FoFiType1C::convertToOpenType(FoFiOutputFunc outputFunc, tableLength[3] = 54; //--- hhea table - maxWidth = 0; - for (i = 0; i < nWidths; ++i) { + maxWidth = widths[0]; + for (i = 1; i < nWidths; ++i) { if (widths[i] > maxWidth) { maxWidth = widths[i]; } @@ -2722,10 +2659,6 @@ GBool FoFiType1C::parse() { return gFalse; } nFDs = fdIdx.len; - if (nFDs < 1) { - parsedOk = gFalse; - return gFalse; - } privateDicts = (Type1CPrivateDict *) gmallocn(nFDs, sizeof(Type1CPrivateDict)); for (i = 0; i < nFDs; ++i) { diff --git a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.h b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.h index 301f42d85e8..15a823cffe6 100644 --- a/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.h +++ b/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "FoFiBase.h" |