changeset 1968:868e39741d26

Only check glyphs that will be saved.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 30 Jun 2018 06:31:57 +0300
parents 8a98d1517460
children 7a4a7c2619ee
files tools/fontconv.c
diffstat 1 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/tools/fontconv.c	Sat Jun 30 06:26:51 2018 +0300
+++ b/tools/fontconv.c	Sat Jun 30 06:31:57 2018 +0300
@@ -401,22 +401,23 @@
     {
         DMBitmapGlyph *glyph = &font->glyphMap[n];
 
-        if (glyph->width < DMFONT_MIN_WIDTH ||
-            glyph->height < DMFONT_MIN_HEIGHT ||
-            glyph->width > DMFONT_MAX_WIDTH ||
-            glyph->height > DMFONT_MAX_HEIGHT ||
-            glyph->width > font->width ||
-            glyph->height > font->height)
+        if (glyph->index >= 0)
         {
-            dmErrorMsg("Invalid glyph #%d: %d x %d (font %d x %d)\n",
-                n,
-                glyph->width, glyph->height,
-                font->width, font->height);
-            goto out;
+            font->nglyphs++;
+            if (glyph->width < DMFONT_MIN_WIDTH ||
+                glyph->height < DMFONT_MIN_HEIGHT ||
+                glyph->width > DMFONT_MAX_WIDTH ||
+                glyph->height > DMFONT_MAX_HEIGHT ||
+                glyph->width > font->width ||
+                glyph->height > font->height)
+            {
+                dmErrorMsg("Invalid glyph #%d: %d x %d (font %d x %d)\n",
+                    n,
+                    glyph->width, glyph->height,
+                    font->width, font->height);
+                goto out;
+            }
         }
-
-        if (glyph->index >= 0)
-            font->nglyphs++;
     }
 
     dmMsg(1, "Outputting a DMFONT format bitmap font, %d x %d with %d glyphs (%d max), %d bpp.\n",