Merge pull request #7705 from Snuffleupagus/issue-2594

Move symbolic font glyphs to private use area if they don't have unicode mappings (issue 2594, bug 789074, bug 865644)
This commit is contained in:
Tim van der Meij 2016-12-10 21:30:28 +01:00 committed by GitHub
commit 00a006e466
2 changed files with 123 additions and 2 deletions

View File

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

View File

@ -1480,6 +1480,7 @@ var getGlyphsUnicode = getLookupTableFactory(function (t) {
t['controlHT'] = 0x0009;
t['controlLF'] = 0x000A;
t['controlNAK'] = 0x0015;
t['controlNULL'] = 0x0000; // Glyph is missing from Adobe's original list.
t['controlRS'] = 0x001E;
t['controlSI'] = 0x000F;
t['controlSO'] = 0x000E;
@ -4231,6 +4232,124 @@ var getGlyphsUnicode = getLookupTableFactory(function (t) {
t['zuhiragana'] = 0x305A;
t['zukatakana'] = 0x30BA;
t['.notdef'] = 0x0000;
// TeX-specific glyph names.
t['angbracketleftbig'] = 0x2329;
t['angbracketleftBig'] = 0x2329;
t['angbracketleftbigg'] = 0x2329;
t['angbracketleftBigg'] = 0x2329;
t['angbracketrightBig'] = 0x232A;
t['angbracketrightbig'] = 0x232A;
t['angbracketrightBigg'] = 0x232A;
t['angbracketrightbigg'] = 0x232A;
t['arrowhookleft'] = 0x21AA;
t['arrowhookright'] = 0x21A9;
t['arrowlefttophalf'] = 0x21BC;
t['arrowleftbothalf'] = 0x21BD;
t['arrownortheast'] = 0x2197;
t['arrownorthwest'] = 0x2196;
t['arrowrighttophalf'] = 0x21C0;
t['arrowrightbothalf'] = 0x21C1;
t['arrowsoutheast'] = 0x2198;
t['arrowsouthwest'] = 0x2199;
t['backslashbig'] = 0x2216;
t['backslashBig'] = 0x2216;
t['backslashBigg'] = 0x2216;
t['backslashbigg'] = 0x2216;
t['bardbl'] = 0x2016;
t['bracehtipdownleft'] = 0xFE37;
t['bracehtipdownright'] = 0xFE37;
t['bracehtipupleft'] = 0xFE38;
t['bracehtipupright'] = 0xFE38;
t['braceleftBig'] = 0x007B;
t['braceleftbig'] = 0x007B;
t['braceleftbigg'] = 0x007B;
t['braceleftBigg'] = 0x007B;
t['bracerightBig'] = 0x007D;
t['bracerightbig'] = 0x007D;
t['bracerightbigg'] = 0x007D;
t['bracerightBigg'] = 0x007D;
t['bracketleftbig'] = 0x005B;
t['bracketleftBig'] = 0x005B;
t['bracketleftbigg'] = 0x005B;
t['bracketleftBigg'] = 0x005B;
t['bracketrightBig'] = 0x005D;
t['bracketrightbig'] = 0x005D;
t['bracketrightbigg'] = 0x005D;
t['bracketrightBigg'] = 0x005D;
t['ceilingleftbig'] = 0x2308;
t['ceilingleftBig'] = 0x2308;
t['ceilingleftBigg'] = 0x2308;
t['ceilingleftbigg'] = 0x2308;
t['ceilingrightbig'] = 0x2309;
t['ceilingrightBig'] = 0x2309;
t['ceilingrightbigg'] = 0x2309;
t['ceilingrightBigg'] = 0x2309;
t['circledotdisplay'] = 0x2299;
t['circledottext'] = 0x2299;
t['circlemultiplydisplay'] = 0x2297;
t['circlemultiplytext'] = 0x2297;
t['circleplusdisplay'] = 0x2295;
t['circleplustext'] = 0x2295;
t['contintegraldisplay'] = 0x222E;
t['contintegraltext'] = 0x222E;
t['coproductdisplay'] = 0x2210;
t['coproducttext'] = 0x2210;
t['floorleftBig'] = 0x230A;
t['floorleftbig'] = 0x230A;
t['floorleftbigg'] = 0x230A;
t['floorleftBigg'] = 0x230A;
t['floorrightbig'] = 0x230B;
t['floorrightBig'] = 0x230B;
t['floorrightBigg'] = 0x230B;
t['floorrightbigg'] = 0x230B;
t['hatwide'] = 0x0302;
t['hatwider'] = 0x0302;
t['hatwidest'] = 0x0302;
t['intercal'] = 0x1D40;
t['integraldisplay'] = 0x222B;
t['integraltext'] = 0x222B;
t['intersectiondisplay'] = 0x22C2;
t['intersectiontext'] = 0x22C2;
t['logicalanddisplay'] = 0x2227;
t['logicalandtext'] = 0x2227;
t['logicalordisplay'] = 0x2228;
t['logicalortext'] = 0x2228;
t['parenleftBig'] = 0x0028;
t['parenleftbig'] = 0x0028;
t['parenleftBigg'] = 0x0028;
t['parenleftbigg'] = 0x0028;
t['parenrightBig'] = 0x0029;
t['parenrightbig'] = 0x0029;
t['parenrightBigg'] = 0x0029;
t['parenrightbigg'] = 0x0029;
t['prime'] = 0x2032;
t['productdisplay'] = 0x220F;
t['producttext'] = 0x220F;
t['radicalbig'] = 0x221A;
t['radicalBig'] = 0x221A;
t['radicalBigg'] = 0x221A;
t['radicalbigg'] = 0x221A;
t['radicalbt'] = 0x221A;
t['radicaltp'] = 0x221A;
t['radicalvertex'] = 0x221A;
t['slashbig'] = 0x002F;
t['slashBig'] = 0x002F;
t['slashBigg'] = 0x002F;
t['slashbigg'] = 0x002F;
t['summationdisplay'] = 0x2211;
t['summationtext'] = 0x2211;
t['tildewide'] = 0x02DC;
t['tildewider'] = 0x02DC;
t['tildewidest'] = 0x02DC;
t['uniondisplay'] = 0x22C3;
t['unionmultidisplay'] = 0x228E;
t['unionmultitext'] = 0x228E;
t['unionsqdisplay'] = 0x2294;
t['unionsqtext'] = 0x2294;
t['uniontext'] = 0x22C3;
t['vextenddouble'] = 0x2225;
t['vextendsingle'] = 0x2223;
});
var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {