Merge pull request #1135 from notmasteryet/tree-62
Fixing standard encoding mapping (bonus symbol encoding)
This commit is contained in:
		
						commit
						589410d528
					
				@ -481,8 +481,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
			
		||||
          properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var flags = properties.flags;
 | 
			
		||||
      var differences = [];
 | 
			
		||||
      var baseEncoding = Encodings.StandardEncoding;
 | 
			
		||||
      var baseEncoding = !!(flags & FontFlags.Symbolic) ?
 | 
			
		||||
                         Encodings.symbolsEncoding : Encodings.StandardEncoding;
 | 
			
		||||
      var hasEncoding = dict.has('Encoding');
 | 
			
		||||
      if (hasEncoding) {
 | 
			
		||||
        var encoding = xref.fetchIfRef(dict.get('Encoding'));
 | 
			
		||||
@ -761,8 +763,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
			
		||||
          // Simulating descriptor flags attribute
 | 
			
		||||
          var fontNameWoStyle = baseFontName.split('-')[0];
 | 
			
		||||
          var flags = (serifFonts[fontNameWoStyle] ||
 | 
			
		||||
            (fontNameWoStyle.search(/serif/gi) != -1) ? 2 : 0) |
 | 
			
		||||
            (symbolsFonts[fontNameWoStyle] ? 4 : 32);
 | 
			
		||||
            (fontNameWoStyle.search(/serif/gi) != -1) ? FontFlags.Serif : 0) |
 | 
			
		||||
            (symbolsFonts[fontNameWoStyle] ? FontFlags.Symbolic :
 | 
			
		||||
            FontFlags.Nonsymbolic);
 | 
			
		||||
 | 
			
		||||
          var properties = {
 | 
			
		||||
            type: type.name,
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										62
									
								
								src/fonts.js
									
									
									
									
									
								
							
							
						
						
									
										62
									
								
								src/fonts.js
									
									
									
									
									
								
							@ -19,6 +19,18 @@ var kPDFGlyphSpaceUnits = 1000;
 | 
			
		||||
// Until hinting is fully supported this constant can be used
 | 
			
		||||
var kHintingEnabled = false;
 | 
			
		||||
 | 
			
		||||
var FontFlags = {
 | 
			
		||||
  FixedPitch: 1,
 | 
			
		||||
  Serif: 2,
 | 
			
		||||
  Symbolic: 4,
 | 
			
		||||
  Script: 8,
 | 
			
		||||
  Nonsymbolic: 32,
 | 
			
		||||
  Italic: 64,
 | 
			
		||||
  AllCap: 65536,
 | 
			
		||||
  SmallCap: 131072,
 | 
			
		||||
  ForceBold: 262144
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var Encodings = {
 | 
			
		||||
  get ExpertEncoding() {
 | 
			
		||||
    return shadow(this, 'ExpertEncoding', ['', '', '', '', '', '', '', '', '',
 | 
			
		||||
@ -160,19 +172,20 @@ var Encodings = {
 | 
			
		||||
      'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore',
 | 
			
		||||
      'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
 | 
			
		||||
      'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
 | 
			
		||||
      'braceleft', 'bar', 'braceright', 'asciitilde', '', '', 'exclamdown',
 | 
			
		||||
      'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency',
 | 
			
		||||
      'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft',
 | 
			
		||||
      'guilsinglright', 'fi', 'fl', '', 'endash', 'dagger', 'daggerdbl',
 | 
			
		||||
      'periodcentered', '', 'paragraph', 'bullet', 'quotesinglbase',
 | 
			
		||||
      'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis',
 | 
			
		||||
      'perthousand', '', 'questiondown', '', 'grave', 'acute', 'circumflex',
 | 
			
		||||
      'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', '', 'ring',
 | 
			
		||||
      'cedilla', '', 'hungarumlaut', 'ogonek', 'caron', 'emdash', '', '', '',
 | 
			
		||||
      '', '', '', '', '', '', '', '', '', '', '', '', '', 'AE', '',
 | 
			
		||||
      'ordfeminine', '', '', '', '', 'Lslash', 'Oslash', 'OE', 'ordmasculine',
 | 
			
		||||
      '', '', '', '', '', 'ae', '', '', '', 'dotlessi', '', '', 'lslash',
 | 
			
		||||
      'oslash', 'oe', 'germandbls'
 | 
			
		||||
      'braceleft', 'bar', 'braceright', 'asciitilde', '', '', '', '', '', '',
 | 
			
		||||
      '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
 | 
			
		||||
      '', '', '', '', '', '', '', '', '', '', 'exclamdown', 'cent', 'sterling',
 | 
			
		||||
      'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle',
 | 
			
		||||
      'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi',
 | 
			
		||||
      'fl', '', 'endash', 'dagger', 'daggerdbl', 'periodcentered', '',
 | 
			
		||||
      'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright',
 | 
			
		||||
      'guillemotright', 'ellipsis', 'perthousand', '', 'questiondown', '',
 | 
			
		||||
      'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent',
 | 
			
		||||
      'dieresis', '', 'ring', 'cedilla', '', 'hungarumlaut', 'ogonek', 'caron',
 | 
			
		||||
      'emdash', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
 | 
			
		||||
      'AE', '', 'ordfeminine', '', '', '', '', 'Lslash', 'Oslash', 'OE',
 | 
			
		||||
      'ordmasculine', '', '', '', '', '', 'ae', '', '', '', 'dotlessi', '', '',
 | 
			
		||||
      'lslash', 'oslash', 'oe', 'germandbls'
 | 
			
		||||
    ]);
 | 
			
		||||
  },
 | 
			
		||||
  get WinAnsiEncoding() {
 | 
			
		||||
@ -405,6 +418,19 @@ var symbolsFonts = {
 | 
			
		||||
  'Dingbats': true, 'Symbol': true, 'ZapfDingbats': true
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Some characters, e.g. copyrightserif, mapped to the private use area and
 | 
			
		||||
// might not be displayed using standard fonts. Mapping/hacking well-known chars
 | 
			
		||||
// to the similar equivalents in the normal characters range.
 | 
			
		||||
function mapPrivateUseChars(code) {
 | 
			
		||||
  switch (code) {
 | 
			
		||||
    case 0xF8E9: // copyrightsans
 | 
			
		||||
    case 0xF6D9: // copyrightserif
 | 
			
		||||
      return 0x00A9; // copyright
 | 
			
		||||
    default:
 | 
			
		||||
      return code;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var FontLoader = {
 | 
			
		||||
  listeningForFontLoad: false,
 | 
			
		||||
 | 
			
		||||
@ -761,8 +787,8 @@ var Font = (function FontClosure() {
 | 
			
		||||
    var names = name.split('+');
 | 
			
		||||
    names = names.length > 1 ? names[1] : names[0];
 | 
			
		||||
    names = names.split(/[-,_]/g)[0];
 | 
			
		||||
    this.isSerifFont = !!(properties.flags & 2);
 | 
			
		||||
    this.isSymbolicFont = !!(properties.flags & 4);
 | 
			
		||||
    this.isSerifFont = !!(properties.flags & FontFlags.Serif);
 | 
			
		||||
    this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
 | 
			
		||||
 | 
			
		||||
    var type = properties.type;
 | 
			
		||||
    this.type = type;
 | 
			
		||||
@ -2186,7 +2212,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
        case 'CIDFontType0':
 | 
			
		||||
          if (this.noUnicodeAdaptation) {
 | 
			
		||||
            width = this.widths[this.unicodeToCID[charcode] || charcode];
 | 
			
		||||
            unicode = charcode;
 | 
			
		||||
            unicode = mapPrivateUseChars(charcode);
 | 
			
		||||
            break;
 | 
			
		||||
          }
 | 
			
		||||
          unicode = this.toUnicode[charcode] || charcode;
 | 
			
		||||
@ -2194,7 +2220,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
        case 'CIDFontType2':
 | 
			
		||||
          if (this.noUnicodeAdaptation) {
 | 
			
		||||
            width = this.widths[this.unicodeToCID[charcode] || charcode];
 | 
			
		||||
            unicode = charcode;
 | 
			
		||||
            unicode = mapPrivateUseChars(charcode);
 | 
			
		||||
            break;
 | 
			
		||||
          }
 | 
			
		||||
          unicode = this.toUnicode[charcode] || charcode;
 | 
			
		||||
@ -2204,7 +2230,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
          if (!isNum(width))
 | 
			
		||||
            width = this.widths[glyphName];
 | 
			
		||||
          if (this.noUnicodeAdaptation) {
 | 
			
		||||
            unicode = GlyphsUnicode[glyphName] || charcode;
 | 
			
		||||
            unicode = mapPrivateUseChars(GlyphsUnicode[glyphName] || charcode);
 | 
			
		||||
            break;
 | 
			
		||||
          }
 | 
			
		||||
          unicode = this.glyphNameMap[glyphName] ||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								test/pdfs/issue1127.pdf.link
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/issue1127.pdf.link
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
https://vmp.ethz.ch/pdfs/diplome/vordiplome/Block%201/Algorithmen_%26_Komplexitaet/AlgoKo_f08_Aufg.pdf
 | 
			
		||||
@ -410,6 +410,13 @@
 | 
			
		||||
      "link": true,
 | 
			
		||||
      "type": "eq"
 | 
			
		||||
    },
 | 
			
		||||
    {  "id": "issue1127",
 | 
			
		||||
      "file": "pdfs/issue1127.pdf",
 | 
			
		||||
      "md5": "4fb2be5ffefeafda4ba977de2a1bb4d8",
 | 
			
		||||
      "rounds": 1,
 | 
			
		||||
      "link": true,
 | 
			
		||||
      "type": "eq"
 | 
			
		||||
    },
 | 
			
		||||
    {  "id": "liveprogramming",
 | 
			
		||||
      "file": "pdfs/liveprogramming.pdf",
 | 
			
		||||
      "md5": "7bd4dad1188232ef597d36fd72c33e52",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user