Skip to content

Commit

Permalink
Merge pull request #31 from shuaibird/gh-pages
Browse files Browse the repository at this point in the history
Fix: missing glyphs with multiple unicodes
  • Loading branch information
gero3 authored Jul 14, 2023
2 parents ce2f078 + b8d17f2 commit a2ad86e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions javascripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,23 @@ var convert = function(font){
}

font.glyphs.forEach(function(glyph){
const unicodes = [];
if (glyph.unicode !== undefined) {
var glyphCharacter = String.fromCharCode (glyph.unicode);
unicodes.push(glyph.unicode);
}
if (glyph.unicodes.length) {
glyph.unicodes.forEach(function(unicode){
if (unicodes.indexOf (unicode) == -1) {
unicodes.push(unicode);
}
})
}

unicodes.forEach(function(unicode){
var glyphCharacter = String.fromCharCode (unicode);
var needToExport = true;
if (restriction.range !== null) {
needToExport = (glyph.unicode >= restriction.range[0] && glyph.unicode <= restriction.range[1]);
needToExport = (unicode >= restriction.range[0] && unicode <= restriction.range[1]);
} else if (restriction.set !== null) {
needToExport = (restrictCharacterSetInput.value.indexOf (glyphCharacter) != -1);
}
Expand Down Expand Up @@ -113,9 +125,9 @@ var convert = function(font){
token.o += " "
}
});
result.glyphs[String.fromCharCode(glyph.unicode)] = token;
result.glyphs[String.fromCharCode(unicode)] = token;
}
};
});
});
result.familyName = font.familyName;
result.ascender = Math.round(font.ascender * scale);
Expand Down

0 comments on commit a2ad86e

Please sign in to comment.