From d65e8021be3c4d5af9bbe72d47313c3cc7b229e2 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Tue, 14 Jan 2025 15:55:57 +0100 Subject: [PATCH] add a user-friendly assert that catches the NaNs ...before they cause a really weird error elsewhere. --- src/primitives/envelopes.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/primitives/envelopes.jl b/src/primitives/envelopes.jl index 4460a21..43f4cb0 100644 --- a/src/primitives/envelopes.jl +++ b/src/primitives/envelopes.jl @@ -98,6 +98,7 @@ function stringinkbox(face::FTFont, str::String) ymin = mapreduce(x -> x[1][2], min, v) ymax = mapreduce(x -> x[2][2], max, v) + @assert !isnan(xmin) && !isnan(ymin) && !isnan(xmax) && !isnan(ymax) "inkbox computation resulted in NaNs (the font may be broken)" return [xmin, ymin], [xmax, ymax] end