mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-05 22:55:49 +02:00
parent
484518614d
commit
2e3d79e616
@ -2962,8 +2962,10 @@ class PartialEvaluator {
|
|||||||
function buildTextContentItem({ chars, extraSpacing }) {
|
function buildTextContentItem({ chars, extraSpacing }) {
|
||||||
if (
|
if (
|
||||||
currentTextState !== textState &&
|
currentTextState !== textState &&
|
||||||
(currentTextState.fontName !== textState.fontName ||
|
(currentTextState.fontSize !== textState.fontSize ||
|
||||||
currentTextState.fontSize !== textState.fontSize)
|
(currentTextState.fontName !== textState.fontName &&
|
||||||
|
(currentTextState.font.name !== textState.font.name ||
|
||||||
|
currentTextState.font.vertical !== textState.font.vertical)))
|
||||||
) {
|
) {
|
||||||
flushTextContentItem();
|
flushTextContentItem();
|
||||||
currentTextState = textState.clone();
|
currentTextState = textState.clone();
|
||||||
|
|||||||
@ -4027,34 +4027,19 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||||||
const { items } = await pdfPage.getTextContent({
|
const { items } = await pdfPage.getTextContent({
|
||||||
disableNormalization: true,
|
disableNormalization: true,
|
||||||
});
|
});
|
||||||
|
// The pdf has 3 different fonts but with the same underlying font data
|
||||||
|
// so we have finally one chunk.
|
||||||
expect(items).toEqual([
|
expect(items).toEqual([
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
str: "ABC",
|
str: "ABCDEFGHI",
|
||||||
dir: "ltr",
|
dir: "ltr",
|
||||||
width: 20.56,
|
width: 57.779999999999994,
|
||||||
height: 10,
|
height: 10,
|
||||||
transform: [10, 0, 0, 10, 100, 100],
|
transform: [10, 0, 0, 10, 100, 100],
|
||||||
hasEOL: false,
|
hasEOL: false,
|
||||||
}),
|
}),
|
||||||
jasmine.objectContaining({
|
|
||||||
str: "DEF",
|
|
||||||
dir: "ltr",
|
|
||||||
width: 20,
|
|
||||||
height: 10,
|
|
||||||
transform: [10, 0, 0, 10, 120, 100],
|
|
||||||
hasEOL: false,
|
|
||||||
}),
|
|
||||||
jasmine.objectContaining({
|
|
||||||
str: "GHI",
|
|
||||||
dir: "ltr",
|
|
||||||
width: 17.78,
|
|
||||||
height: 10,
|
|
||||||
transform: [10, 0, 0, 10, 140, 100],
|
|
||||||
hasEOL: false,
|
|
||||||
}),
|
|
||||||
]);
|
]);
|
||||||
expect(items[0].fontName).toEqual(items[2].fontName);
|
await loadingTask.destroy();
|
||||||
expect(items[1].fontName).not.toEqual(items[0].fontName);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("gets text content with word spacing (issue 20319)", async function () {
|
it("gets text content with word spacing (issue 20319)", async function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user