Index: ../tools/convttf.c
===================================================================
--- ../tools/convttf.c	(revision 29533)
+++ ../tools/convttf.c	(working copy)
@@ -24,6 +24,7 @@
 
 #include <stdbool.h>
 #include <stdio.h>
+#include <ctype.h>
 #ifdef WIN32
 #include <windows.h>
 #else
@@ -514,12 +515,35 @@
 
     if(pitch == 0)    pitch = h_adv;
     if(width < pitch) width = pitch;
-    if(width == 0)    return 0;
 
     return width;
 }
 
+FT_Long check_digit_width( FT_Face face )
+{
+    FT_Long code;
+    FT_Long last_advance = -1;
 
+    for(code='0'; code <= '9'; ++code)
+    {
+        FT_Glyph_Metrics* metrics;
+
+        FT_Load_Char(face, code, FT_LOAD_RENDER | FT_LOAD_NO_BITMAP);
+        metrics = &face->glyph->metrics;
+
+        if ((last_advance != -1 && last_advance != metrics->horiAdvance) ||
+            metrics->horiBearingX < 0)
+        {
+            last_advance = 0;
+            break;
+        }
+
+        last_advance = metrics->horiAdvance;
+    }
+
+    return last_advance >> 6;
+}
+
 void trim_glyph( FT_GlyphSlot glyph, int *empty_first_col, 
                 int *empty_last_col, int *width )
 {
@@ -574,6 +598,7 @@
     FT_Long     charindex;
     FT_Long     index = 0;
     FT_Long     code;
+    FT_Long     digit_width;
 
     int depth = 2;
     unsigned char bit_shift = 1 << depth;
@@ -625,6 +650,7 @@
     export_font.header.depth = 1;
     firstchar = limit_char;
     lastchar  = start_char;
+    digit_width = check_digit_width(face);
 
     /* calculate memory usage */
     for(code = start_char; code <= limit_char ; code++ )
@@ -634,8 +660,16 @@
         error = FT_Load_Glyph( face, charindex, 
                                (FT_LOAD_RENDER | FT_LOAD_NO_BITMAP) );
         if ( error ) continue;
-        
-        w = glyph_width( face );
+
+        if ( digit_width && code >= '0' && code <= '9' )
+        {
+            w = digit_width;
+        }
+        else
+        {
+            w = glyph_width( face );
+        }
+
         if (w == 0) continue;
         empty_first_col = empty_last_col = 0;
         if(trimming)
@@ -715,8 +749,25 @@
         FT_GlyphSlot slot = face->glyph;
         FT_Bitmap* source = &slot->bitmap;
         //print_raw_glyph( face );
-        w = glyph_width( face );
+        if (digit_width && code >= '0' && code <= '9' )
+        {
+            w = digit_width;
+        }
+        else
+        {
+            w = glyph_width( face );
+        }
+
         if (w == 0) continue;
+        /* if ((code >= '0' && code <= '9') || (code >= 'a' && code <= 'z') ||
+            (code >= 'A' && code <= 'Z') || code == 'å' || code == 'Å' ||
+            code == 'ä' || code == 'Ä' || code == 'ö' || code == 'Ö')
+            printf("Digit %lc: w = %ld, width = %ld, bearing = %ld, "
+                "advance = %ld, linearAdvance = %ld, pitch = %d, %ld-%ld, "
+                "digit_width = %ld\n",
+                code, w, slot->metrics.width, slot->metrics.horiBearingX,
+                slot->metrics.horiAdvance, slot->linearHoriAdvance, slot->bitmap.pitch,
+                face->bbox.xMin, face->bbox.xMax, digit_width); */
         empty_first_col = empty_last_col = 0;
 
         if(trimming)
