Add the Marble and Highlighter templates, completing the 13 reference templates
Marble uses a flat-to-gradient band in place of the marble photo and bundles Lustria (OFL). Both logo slots are opt-in. Quirk 13 documents a fontkit glyph-cache issue that the tests work around with warm-up renders; the engine fix follows separately.
This commit is contained in:
@@ -21,6 +21,7 @@ import { renderCore } from "./render/core";
|
||||
import { loadCanvas, inkPixels } from "./testing/rasterize";
|
||||
import { byId, doc, FAMILY, find, frameFor, PAD, PAGE_W, rawLayout, txt } from "./testing/docs";
|
||||
import { FONTS_DIR, setupPdfTest } from "./testing/setup";
|
||||
import { stack } from "./fonts/register";
|
||||
|
||||
setupPdfTest();
|
||||
|
||||
@@ -301,4 +302,12 @@ describe("react-pdf 4.9.0 quirks the engine relies on", () => {
|
||||
r.layout.forEach((p) => expect(byId(p, "label")[0].lines).toHaveLength(0));
|
||||
});
|
||||
});
|
||||
it("13. fontkit caches glyph objects per font for the whole process, and pdfkit creates a composite's component glyphs at embed time with no code points: Poppins' colon makes the period glyph keep codePoints [] (so a later document's '.' is not extracted and textkit's glyph-to-string mapping slips)", async () => {
|
||||
// Must stay the first test that sets Poppins Regular in this file: any earlier '.' in that face would create the period glyph normally.
|
||||
const poppins = { fontFamily: stack("Poppins"), fontSize: 10, lineHeight: "12pt", fontWeight: 400 };
|
||||
await render(doc(h(Text, { style: poppins }, "Bank : State")));
|
||||
const data = (Font as unknown as { getFont: (d: object) => { data: { glyphForCodePoint: (cp: number) => { codePoints: number[] } } } }).getFont({ fontFamily: "Poppins", fontWeight: 400, fontStyle: "normal" }).data;
|
||||
expect(data.glyphForCodePoint(0x2e).codePoints).toEqual([]);
|
||||
// The Highlighter and Marble tests and the standalone sweep warm Poppins with a document that has amounts (period and comma) first, for this reason.
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user