removed superfluous memset.
[swftools.git] / lib / modules / swffont.c
index 9a572e1..233b190 100644 (file)
@@ -123,16 +123,15 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename)
     font->glyph2ascii = malloc(face->num_glyphs*sizeof(U16));
     memset(font->glyph2ascii, 0, face->num_glyphs*sizeof(U16));
     font->maxascii = 0;
-    memset(font->ascii2glyph, -1, font->maxascii*sizeof(int));
     font->glyph = malloc(face->num_glyphs*sizeof(SWFGLYPH));
     memset(font->glyph, 0, face->num_glyphs*sizeof(U16));
     if(FT_HAS_GLYPH_NAMES(face)) {
        font->glyphnames = malloc(face->num_glyphs*sizeof(char*));
     }
 
-    font->layout->ascent = face->ascender; //face->bbox.xMin;
-    font->layout->descent = face->descender; //face->bbox.xMax;
-    font->layout->leading = -face->bbox.xMin;
+    font->layout->ascent = face->ascender*20/FT_SUBPIXELS; //face->bbox.xMin;
+    font->layout->descent = abs(face->descender)*20/FT_SUBPIXELS; //face->bbox.xMax;
+    font->layout->leading = -face->bbox.xMin*20/FT_SUBPIXELS;
     font->layout->kerningcount = 0;
     
     name = FT_Get_Postscript_Name(face);
@@ -224,7 +223,7 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename)
            font->glyph[t].advance = ((bbox.xMax - bbox.xMin)*FT_SCALE)/FT_SUBPIXELS;
        }
 #else
-       font->glyph[t].advance = glyph->advance.x/65536;
+       font->glyph[t].advance = glyph->advance.x*20/65536;
 #endif
        
        font->glyph[t].shape = swf_ShapeDrawerToShape(&draw);
@@ -392,7 +391,7 @@ SWFFONT* swf_LoadT1Font(char*filename)
        draw.dealloc(&draw);
            
        font->layout->bounds[c] = bbox;
-       font->glyph[c].advance = bbox.xmax/20;
+       font->glyph[c].advance = bbox.xmax;
        if(!font->glyph[c].advance) {
            font->glyph[c].advance = firstx;
        }