Merge pull request #14428 from calixteman/typo
Use the correct dimension to know if we have to add an EOL in vertical mode
This commit is contained in:
commit
da953f4b64
@ -2175,7 +2175,6 @@ class PartialEvaluator {
|
|||||||
stateManager = stateManager || new StateManager(new TextState());
|
stateManager = stateManager || new StateManager(new TextState());
|
||||||
|
|
||||||
const WhitespaceRegexp = /\s/g;
|
const WhitespaceRegexp = /\s/g;
|
||||||
const DiacriticRegExp = new RegExp("^\\p{Mn}$", "u");
|
|
||||||
const NormalizedUnicodes = getNormalizedUnicodes();
|
const NormalizedUnicodes = getNormalizedUnicodes();
|
||||||
|
|
||||||
const textContent = {
|
const textContent = {
|
||||||
@ -2480,7 +2479,7 @@ class PartialEvaluator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.abs(advanceX) > textContentItem.height) {
|
if (Math.abs(advanceX) > textContentItem.width) {
|
||||||
appendEOL();
|
appendEOL();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2576,6 +2575,7 @@ class PartialEvaluator {
|
|||||||
|
|
||||||
const glyphs = font.charsToGlyphs(chars);
|
const glyphs = font.charsToGlyphs(chars);
|
||||||
const scale = textState.fontMatrix[0] * textState.fontSize;
|
const scale = textState.fontMatrix[0] * textState.fontSize;
|
||||||
|
|
||||||
for (let i = 0, ii = glyphs.length; i < ii; i++) {
|
for (let i = 0, ii = glyphs.length; i < ii; i++) {
|
||||||
const glyph = glyphs[i];
|
const glyph = glyphs[i];
|
||||||
let charSpacing =
|
let charSpacing =
|
||||||
@ -2587,13 +2587,12 @@ class PartialEvaluator {
|
|||||||
}
|
}
|
||||||
let scaledDim = glyphWidth * scale;
|
let scaledDim = glyphWidth * scale;
|
||||||
|
|
||||||
let glyphUnicode = glyph.unicode;
|
|
||||||
if (
|
if (
|
||||||
glyphUnicode === " " &&
|
glyph.isWhitespace &&
|
||||||
(i === 0 ||
|
(i === 0 ||
|
||||||
i + 1 === ii ||
|
i + 1 === ii ||
|
||||||
glyphs[i - 1].unicode === " " ||
|
glyphs[i - 1].isWhitespace ||
|
||||||
glyphs[i + 1].unicode === " " ||
|
glyphs[i + 1].isWhitespace ||
|
||||||
extraSpacing)
|
extraSpacing)
|
||||||
) {
|
) {
|
||||||
// Don't push a " " in the textContentItem
|
// Don't push a " " in the textContentItem
|
||||||
@ -2616,10 +2615,12 @@ class PartialEvaluator {
|
|||||||
|
|
||||||
compareWithLastPosition();
|
compareWithLastPosition();
|
||||||
|
|
||||||
|
let glyphUnicode = glyph.unicode;
|
||||||
|
|
||||||
// Must be called after compareWithLastPosition because
|
// Must be called after compareWithLastPosition because
|
||||||
// the textContentItem could have been flushed.
|
// the textContentItem could have been flushed.
|
||||||
const textChunk = ensureTextContentItem();
|
const textChunk = ensureTextContentItem();
|
||||||
if (DiacriticRegExp.test(glyph.unicode)) {
|
if (glyph.isDiacritic) {
|
||||||
scaledDim = 0;
|
scaledDim = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,12 @@ import {
|
|||||||
recoverGlyphName,
|
recoverGlyphName,
|
||||||
SEAC_ANALYSIS_ENABLED,
|
SEAC_ANALYSIS_ENABLED,
|
||||||
} from "./fonts_utils.js";
|
} from "./fonts_utils.js";
|
||||||
|
import {
|
||||||
|
getCharUnicodeCategory,
|
||||||
|
getUnicodeForGlyph,
|
||||||
|
getUnicodeRangeFor,
|
||||||
|
mapSpecialUnicodeValues,
|
||||||
|
} from "./unicode.js";
|
||||||
import { getDingbatsGlyphsUnicode, getGlyphsUnicode } from "./glyphlist.js";
|
import { getDingbatsGlyphsUnicode, getGlyphsUnicode } from "./glyphlist.js";
|
||||||
import {
|
import {
|
||||||
getEncoding,
|
getEncoding,
|
||||||
@ -50,11 +56,6 @@ import {
|
|||||||
getSupplementalGlyphMapForArialBlack,
|
getSupplementalGlyphMapForArialBlack,
|
||||||
getSupplementalGlyphMapForCalibri,
|
getSupplementalGlyphMapForCalibri,
|
||||||
} from "./standard_fonts.js";
|
} from "./standard_fonts.js";
|
||||||
import {
|
|
||||||
getUnicodeForGlyph,
|
|
||||||
getUnicodeRangeFor,
|
|
||||||
mapSpecialUnicodeValues,
|
|
||||||
} from "./unicode.js";
|
|
||||||
import { IdentityToUnicodeMap, ToUnicodeMap } from "./to_unicode_map.js";
|
import { IdentityToUnicodeMap, ToUnicodeMap } from "./to_unicode_map.js";
|
||||||
import { CFFFont } from "./cff_font.js";
|
import { CFFFont } from "./cff_font.js";
|
||||||
import { FontRendererFactory } from "./font_renderer.js";
|
import { FontRendererFactory } from "./font_renderer.js";
|
||||||
@ -212,6 +213,10 @@ class Glyph {
|
|||||||
this.operatorListId = operatorListId;
|
this.operatorListId = operatorListId;
|
||||||
this.isSpace = isSpace;
|
this.isSpace = isSpace;
|
||||||
this.isInFont = isInFont;
|
this.isInFont = isInFont;
|
||||||
|
|
||||||
|
const category = getCharUnicodeCategory(unicode);
|
||||||
|
this.isWhitespace = category.isWhitespace;
|
||||||
|
this.isDiacritic = category.isDiacritic;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchesForCache(
|
matchesForCache(
|
||||||
|
@ -1640,7 +1640,17 @@ function reverseIfRtl(chars) {
|
|||||||
return buf.join("");
|
return buf.join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})$", "u");
|
||||||
|
function getCharUnicodeCategory(char) {
|
||||||
|
const groups = char.match(SpecialCharRegExp);
|
||||||
|
return {
|
||||||
|
isWhitespace: !!(groups && groups[1]),
|
||||||
|
isDiacritic: !!(groups && groups[2]),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
getCharUnicodeCategory,
|
||||||
getNormalizedUnicodes,
|
getNormalizedUnicodes,
|
||||||
getUnicodeForGlyph,
|
getUnicodeForGlyph,
|
||||||
getUnicodeRangeFor,
|
getUnicodeRangeFor,
|
||||||
|
Loading…
Reference in New Issue
Block a user