Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/xpdf/TTFont.cc
diff options
context:
space:
mode:
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>2004-05-16 22:45:42 (GMT)
committer Martin Kretzschmar <mkretzschmar@src.gnome.org>2004-05-16 22:45:42 (GMT)
commitad63666daeeda50acc7630132d61fe044634fddd (patch)
tree487b52b30f8a563cbb2e16c6fd2527a6eeb5990f /pdf/xpdf/TTFont.cc
parentd57c02ebc09bfd1a0cac44140ec7a80dbe43877e (diff)
Imported Xpdf 2.03 and fixed build.
* ANNOUNCE: * CHANGES: * README: * aconf2.h: * configure.in: * dj_make.bat: * doc/pdffonts.1: * doc/pdffonts.cat: * doc/pdffonts.hlp: * doc/pdfimages.1: * doc/pdfimages.cat: * doc/pdfimages.hlp: * doc/pdfinfo.1: * doc/pdfinfo.cat: * doc/pdfinfo.hlp: * doc/pdftopbm.1: * doc/pdftopbm.cat: * doc/pdftopbm.hlp: * doc/pdftops.1: * doc/pdftops.cat: * doc/pdftops.hlp: * doc/pdftotext.1: * doc/pdftotext.cat: * doc/pdftotext.hlp: * doc/xpdf.1: * doc/xpdf.cat: * doc/xpdf.hlp: * doc/xpdfrc.5: * doc/xpdfrc.cat: * doc/xpdfrc.hlp: * goo/gfile.cc: * ms_make.bat: * vms_make.com: * xpdf/Annot.cc: * xpdf/Array.cc: * xpdf/BuiltinFontTables.cc: * xpdf/CMap.cc: * xpdf/CMap.h: * xpdf/Catalog.cc: * xpdf/CharCodeToUnicode.cc: * xpdf/CharCodeToUnicode.h: * xpdf/Decrypt.cc: * xpdf/Dict.cc: * xpdf/ErrorCodes.h: * xpdf/FTFont.cc: * xpdf/FTFont.h: * xpdf/FontFile.cc: * xpdf/FontFile.h: * xpdf/Function.cc: * xpdf/Gfx.cc: * xpdf/Gfx.h: * xpdf/GfxFont.cc: * xpdf/GfxFont.h: * xpdf/GfxState.cc: * xpdf/GfxState.h: * xpdf/GlobalParams.cc: * xpdf/GlobalParams.h: * xpdf/JBIG2Stream.cc: * xpdf/Link.cc: * xpdf/Link.h: * xpdf/Makefile.am: * xpdf/OutputDev.h: * xpdf/PDFDoc.cc: * xpdf/PDFDoc.h: * xpdf/PSOutputDev.cc: * xpdf/PSOutputDev.h: * xpdf/Page.cc: * xpdf/Page.h: * xpdf/Parser.cc: * xpdf/Stream.cc: * xpdf/Stream.h: * xpdf/TTFont.cc: * xpdf/TTFont.h: * xpdf/TextOutputDev.cc: * xpdf/TextOutputDev.h: * xpdf/UnicodeMap.cc: * xpdf/UnicodeMap.h: * xpdf/UnicodeTypeTable.cc: * xpdf/UnicodeTypeTable.h: * xpdf/XOutputDev.cc: * xpdf/XOutputDev.h: * xpdf/XPDFApp.cc: * xpdf/XPDFCore.cc: * xpdf/XPDFCore.h: * xpdf/XPDFViewer.cc: * xpdf/XPDFViewer.h: * xpdf/XRef.cc: * xpdf/about-text.h: * xpdf/config.h: * xpdf/gpdf-control.cc: * xpdf/gpdf-link-canvas-item.cc: * xpdf/gpdf-links-canvas-layer.cc: * xpdf/pdffonts.cc: * xpdf/pdfimages.cc: * xpdf/pdfinfo.cc: * xpdf/pdftopbm.cc: * xpdf/pdftops.cc: * xpdf/pdftotext.cc: * xpdf/tests/test-links.cc: * xpdf/vms_make.com: * xpdf/xpdf.cc: Imported Xpdf 2.03 and fixed build.
Diffstat (limited to 'pdf/xpdf/TTFont.cc')
-rw-r--r--pdf/xpdf/TTFont.cc33
1 files changed, 19 insertions, 14 deletions
diff --git a/pdf/xpdf/TTFont.cc b/pdf/xpdf/TTFont.cc
index fc6d849..c499cf1 100644
--- a/pdf/xpdf/TTFont.cc
+++ b/pdf/xpdf/TTFont.cc
@@ -65,16 +65,25 @@ TTFontFile::TTFontFile(TTFontEngine *engineA, char *fontFileName,
// To match up with the Adobe-defined behaviour, we choose a cmap
// like this:
// 1. If the PDF font has an encoding:
- // 1a. If the TrueType font has a Microsoft Unicode cmap, use it,
- // and use the Unicode indexes, not the char codes.
- // 1b. If the TrueType font has a Macintosh Roman cmap, use it,
- // and reverse map the char names through MacRomanEncoding to
+ // 1a. If the PDF font specified MacRomanEncoding and the
+ // TrueType font has a Macintosh Roman cmap, use it, and
+ // reverse map the char names through MacRomanEncoding to
// get char codes.
+ // 1b. If the TrueType font has a Microsoft Unicode cmap or a
+ // non-Microsoft Unicode cmap, use it, and use the Unicode
+ // indexes, not the char codes.
+ // 1c. If the PDF font is symbolic and the TrueType font has a
+ // Microsoft Symbol cmap, use it, and use char codes
+ // directly (possibly with an offset of 0xf000).
+ // 1d. If the TrueType font has a Macintosh Roman cmap, use it,
+ // as in case 1a.
// 2. If the PDF font does not have an encoding:
// 2a. If the TrueType font has a Macintosh Roman cmap, use it,
- // and use char codes directly.
+ // and use char codes directly (possibly with an offset of
+ // 0xf000).
// 2b. If the TrueType font has a Microsoft Symbol cmap, use it,
- // and use (0xf000 + char code).
+ // and use char codes directly (possible with an offset of
+ // 0xf000).
// 3. If none of these rules apply, use the first cmap and hope for
// the best (this shouldn't happen).
unicodeCmap = macRomanCmap = msSymbolCmap = 0xffff;
@@ -91,7 +100,6 @@ TTFontFile::TTFontFile(TTFontEngine *engineA, char *fontFileName,
}
i = 0;
mode = ttFontModeCharCode;
- charMapOffset = 0;
if (pdfFontHasEncoding) {
if (unicodeCmap != 0xffff) {
i = unicodeCmap;
@@ -114,8 +122,7 @@ TTFontFile::TTFontFile(TTFontEngine *engineA, char *fontFileName,
mode = ttFontModeCharCode;
} else if (msSymbolCmap != 0xffff) {
i = msSymbolCmap;
- mode = ttFontModeCharCodeOffset;
- charMapOffset = 0xf000;
+ mode = ttFontModeCharCode;
}
}
TT_Get_CharMap(face, i, &charMap);
@@ -421,11 +428,9 @@ GBool TTFont::getGlyphPixmap(CharCode c, Unicode u) {
idx = TT_Char_Index(fontFile->charMap, (TT_UShort)u);
break;
case ttFontModeCharCode:
- idx = TT_Char_Index(fontFile->charMap, (TT_UShort)c);
- break;
- case ttFontModeCharCodeOffset:
- idx = TT_Char_Index(fontFile->charMap,
- (TT_UShort)(c + fontFile->charMapOffset));
+ if ((idx = TT_Char_Index(fontFile->charMap, (TT_UShort)c)) == 0) {
+ idx = TT_Char_Index(fontFile->charMap, (TT_UShort)(0xf000 + c));
+ }
break;
case ttFontModeCodeMap:
if (c <= 0xff) {