Skip to content

Commit 96e7f63

Browse files
author
FAL
committed
change the options argument of embedTTFFont() to required
1 parent 97b14f4 commit 96e7f63

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/api/PDFDocument.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -959,14 +959,11 @@ export class PDFDocument {
959959
* the raw font bytes which are not available from a `TTFFont` instance.
960960
*
961961
* @param font The `TTFFont` to subset and embed.
962-
* @param options Additional embedding options (the `subset` option must be `true` or omitted).
962+
* @param options Additional embedding options (the `subset` option must be `true`).
963963
* @returns The embedded font represented as `PDFFont`.
964964
* @throws If `options.subset` is not `true`.
965965
*/
966-
embedTTFFont(
967-
font: TTFFont,
968-
options: EmbedFontOptions = emptyObject,
969-
): PDFFont {
966+
embedTTFFont(font: TTFFont, options: EmbedFontOptions): PDFFont {
970967
const { subset, customName, vertical, advanced } = options;
971968
if (subset !== true) {
972969
throw new TypeError(

tests/api/PDFDocument.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ describe(`PDFDocument`, () => {
179179
const pdfDoc = await PDFDocument.create({ updateMetadata: false });
180180
const ttFont = createFont(new Uint8Array(ubuntuFontBytes)) as TTFFont;
181181

182-
expect(() => pdfDoc.embedTTFFont(ttFont)).toThrow(TypeError);
182+
expect(() => pdfDoc.embedTTFFont(ttFont, {})).toThrow(TypeError);
183183
});
184184

185185
it(`rejects TTFFont instances when subset is false`, async () => {

0 commit comments

Comments
 (0)