XFA - Don't move glyphes in private area with non-truetype fonts
- it has been done in PR #13146 but only for truetype fonts.
This commit is contained in:
parent
2fc9f39436
commit
a74d19262a
@ -2667,12 +2667,20 @@ class Font {
|
|||||||
glyphZeroId = font.numGlyphs - 1;
|
glyphZeroId = font.numGlyphs - 1;
|
||||||
}
|
}
|
||||||
const mapping = font.getGlyphMapping(properties);
|
const mapping = font.getGlyphMapping(properties);
|
||||||
const newMapping = adjustMapping(
|
let newMapping = null;
|
||||||
mapping,
|
let newCharCodeToGlyphId = mapping;
|
||||||
font.hasGlyphId.bind(font),
|
|
||||||
glyphZeroId
|
// When `cssFontInfo` is set, the font is used to render text in the HTML
|
||||||
);
|
// view (e.g. with Xfa) so nothing must be moved in the private use area.
|
||||||
this.toFontChar = newMapping.toFontChar;
|
if (!properties.cssFontInfo) {
|
||||||
|
newMapping = adjustMapping(
|
||||||
|
mapping,
|
||||||
|
font.hasGlyphId.bind(font),
|
||||||
|
glyphZeroId
|
||||||
|
);
|
||||||
|
this.toFontChar = newMapping.toFontChar;
|
||||||
|
newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
|
||||||
|
}
|
||||||
const numGlyphs = font.numGlyphs;
|
const numGlyphs = font.numGlyphs;
|
||||||
|
|
||||||
function getCharCodes(charCodeToGlyphId, glyphId) {
|
function getCharCodes(charCodeToGlyphId, glyphId) {
|
||||||
@ -2700,7 +2708,7 @@ class Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const seacs = font.seacs;
|
const seacs = font.seacs;
|
||||||
if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
|
if (newMapping && SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
|
||||||
const matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
|
const matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
|
||||||
const charset = font.getCharset();
|
const charset = font.getCharset();
|
||||||
const seacMap = Object.create(null);
|
const seacMap = Object.create(null);
|
||||||
@ -2754,15 +2762,9 @@ class Font {
|
|||||||
// PostScript Font Program
|
// PostScript Font Program
|
||||||
builder.addTable("CFF ", font.data);
|
builder.addTable("CFF ", font.data);
|
||||||
// OS/2 and Windows Specific metrics
|
// OS/2 and Windows Specific metrics
|
||||||
builder.addTable(
|
builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
|
||||||
"OS/2",
|
|
||||||
createOS2Table(properties, newMapping.charCodeToGlyphId)
|
|
||||||
);
|
|
||||||
// Character to glyphs mapping
|
// Character to glyphs mapping
|
||||||
builder.addTable(
|
builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs));
|
||||||
"cmap",
|
|
||||||
createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
|
|
||||||
);
|
|
||||||
// Font header
|
// Font header
|
||||||
builder.addTable(
|
builder.addTable(
|
||||||
"head",
|
"head",
|
||||||
|
Loading…
Reference in New Issue
Block a user