Fixing symbols encoding

This commit is contained in:
notmasteryet 2012-01-27 18:53:05 -06:00
parent dd066f8369
commit 10a0a60f8e
2 changed files with 20 additions and 5 deletions

View File

@ -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,

View File

@ -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', ['', '', '', '', '', '', '', '', '',
@ -762,8 +774,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;