Browse Source

Fix regression mapping from gid to glyph from the last commit

Vivien Nicolas 14 years ago
parent
commit
f6e14010f1
  1. 16
      fonts.js

16
fonts.js

@ -423,6 +423,7 @@ var Font = (function Font() {
// Wrap the CFF data inside an OTF font file // Wrap the CFF data inside an OTF font file
data = this.convert(name, cff, properties); data = this.convert(name, cff, properties);
writeToFile(data, "/tmp/" + name + ".otf");
break; break;
case 'TrueType': case 'TrueType':
@ -2198,10 +2199,16 @@ var Type2CFF = (function() {
var nominalWidth = privDict['nominalWidthX']; var nominalWidth = privDict['nominalWidthX'];
var charstrings = []; var charstrings = [];
for (var code in encoding) { var differences = properties.differences;
var gid = encoding[code]; for (var i = 1; i < charsets.length; i++) {
var width = widths[code] || defaultWidth; var glyph = charsets[i];
charstrings.push({unicode: code, width: width, gid: gid}); var charCode = properties.glyphs[glyph];
if (charCode) {
var width = widths[charCode] || defaultWidth;
charstrings.push({unicode: charCode, width: width, gid: i});
} else if (glyph !== '.notdef') {
warn('Cannot find unicode for glyph ' + charName);
}
} }
// sort the array by the unicode value // sort the array by the unicode value
@ -2246,7 +2253,6 @@ var Type2CFF = (function() {
case 1: case 1:
var rangesCount = bytes[pos++]; var rangesCount = bytes[pos++];
log(rangesCount);
var gid = 1; var gid = 1;
for (var i = 0; i < rangesCount; i++) { for (var i = 0; i < rangesCount; i++) {
var start = bytes[pos++]; var start = bytes[pos++];

Loading…
Cancel
Save