From f2db93ff3ee9ca508721b54dd704f80d8c1644ed Mon Sep 17 00:00:00 2001 From: Bj Tecu Date: Sun, 6 Dec 2020 14:26:34 -0500 Subject: [PATCH] Handle negative bounds (#687) --- src/api/text/layout.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/text/layout.ts b/src/api/text/layout.ts index 09327e71c..48a427cdd 100644 --- a/src/api/text/layout.ts +++ b/src/api/text/layout.ts @@ -47,7 +47,7 @@ const computeFontSize = ( const height = font.heightAtSize(fontSize); const lineHeight = height + height * 0.2; const totalHeight = lines.length * lineHeight; - if (totalHeight > bounds.height) return fontSize - 1; + if (totalHeight > Math.abs(bounds.height)) return fontSize - 1; fontSize += 1; }