From 94c1ab99fb4fa5617b29890c23e68f4e8043dcf8 Mon Sep 17 00:00:00 2001 From: Jeroen Vervaeke Date: Thu, 8 Aug 2019 18:07:21 +0200 Subject: [PATCH] Added missing baseline property to TextOptions (#37458) --- types/pdfkit/index.d.ts | 3 +++ types/pdfkit/pdfkit-tests.ts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/pdfkit/index.d.ts b/types/pdfkit/index.d.ts index 30301ae532..d244a4484e 100644 --- a/types/pdfkit/index.d.ts +++ b/types/pdfkit/index.d.ts @@ -2,6 +2,7 @@ // Project: http://pdfkit.org // Definitions by: Eric Hillah // Erik Berreßem +// Jeroen Vervaeke // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -146,6 +147,8 @@ declare namespace PDFKit.Mixins { /** the alignment of the text (center, justify, left, right) */ //TODO check this align?: 'center' | 'justify' | 'left' | 'right' | string; + /** the vertical alignment of the text with respect to its insertion point */ + baseline?: number | "svg-middle" | "middle" | "svg-central" | "bottom" | "ideographic" | "alphabetic" | "mathematical" | "hanging" | "top" } interface PDFText { diff --git a/types/pdfkit/pdfkit-tests.ts b/types/pdfkit/pdfkit-tests.ts index baa27517e7..df18544490 100644 --- a/types/pdfkit/pdfkit-tests.ts +++ b/types/pdfkit/pdfkit-tests.ts @@ -162,11 +162,15 @@ doc.image( }, { scale: 0.25, - } + }, ).text('Scale', 320, 265); doc.text('Scale', { align: 'justify' }); +doc.text('Baseline - string literal', { baseline: 'alphabetic' }); + +doc.text('Baseline - numeric', { baseline: 10 }); + doc.goTo(0, 0, 0, 0, 'lorem'); doc.image('path/to/image.png', {