Move symbolic font glyphs to private use area if they don't have unicode mappings.

This commit is contained in:
Brendan Dahl 2016-07-12 14:27:45 -07:00 committed by Jonas Jenwald
parent 47a1c7797e
commit 8d036faf40

View File

@ -922,7 +922,9 @@ var Font = (function FontClosure() {
var fontCharCode = originalCharCode; var fontCharCode = originalCharCode;
// First try to map the value to a unicode position if a non identity map // First try to map the value to a unicode position if a non identity map
// was created. // was created.
var hasUnicodeValue = false;
if (!isIdentityUnicode && toUnicode.has(originalCharCode)) { if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
hasUnicodeValue = true;
var unicode = toUnicode.get(fontCharCode); var unicode = toUnicode.get(fontCharCode);
// TODO: Try to map ligatures to the correct spot. // TODO: Try to map ligatures to the correct spot.
if (unicode.length === 1) { if (unicode.length === 1) {
@ -937,7 +939,7 @@ var Font = (function FontClosure() {
// with firefox and thuluthfont). // with firefox and thuluthfont).
if ((usedFontCharCodes[fontCharCode] !== undefined || if ((usedFontCharCodes[fontCharCode] !== undefined ||
isProblematicUnicodeLocation(fontCharCode) || isProblematicUnicodeLocation(fontCharCode) ||
(isSymbolic && isIdentityUnicode)) && (isSymbolic && (isIdentityUnicode || !hasUnicodeValue))) &&
nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) { // Room left. nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) { // Room left.
// Loop to try and find a free spot in the private use area. // Loop to try and find a free spot in the private use area.
do { do {