/[gzz]/gzz/gfx/libtext/Text.cxx
ViewVC logotype

Diff of /gzz/gfx/libtext/Text.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by tjl, Mon Oct 7 17:47:55 2002 UTC revision 1.7 by tjl, Tue Oct 8 07:30:12 2002 UTC
# Line 32  namespace Text { Line 32  namespace Text {
32                  gotError(error);                  gotError(error);
33    
34          if((error = FT_Set_Pixel_Sizes(face, 0, pixsize))) gotError(error);          if((error = FT_Set_Pixel_Sizes(face, 0, pixsize))) gotError(error);
35    
36            // scale line height to unity
37            this->scale = 1.0 / (face->size->metrics.height >> 6);
38      }      }
39    
40      FTFont::~FTFont() {      FTFont::~FTFont() {
# Line 46  namespace Text { Line 49  namespace Text {
49          FT_GlyphSlot slot = face->glyph;          FT_GlyphSlot slot = face->glyph;
50          FT_Bitmap *bitmap = &(slot->bitmap);          FT_Bitmap *bitmap = &(slot->bitmap);
51    
52          float ps = this->pixsize;          float ps = this->scale;
53    
54          return Glyph(GlyphInfo(          return Glyph(GlyphInfo(
55                      -slot->bitmap_top / ps, slot->bitmap_left / ps,                      -slot->bitmap_top * ps, slot->bitmap_left * ps,
56                              bitmap->width / ps, bitmap->rows / ps,                              bitmap->width * ps, bitmap->rows * ps,
57                              (slot->advance.x >> 6) / ps,                              (slot->advance.x >> 6) * ps,
58                              1/ps,                              scale,
59                              bitmap->width, bitmap->rows                              bitmap->width, bitmap->rows
60                              ),                              ),
61                  Raster<Mosaic::Format::Alpha>(bitmap->width, bitmap->rows,                  Raster<Mosaic::Format::Alpha>(bitmap->width, bitmap->rows,
# Line 62  namespace Text { Line 65  namespace Text {
65                    
66      }      }
67    
68      int FTFont::getLineHeight() {      float FTFont::getLineHeight() {
69          return (face->size->metrics.height >> 6) / (float)pixsize;          return (face->size->metrics.height >> 6) * scale;
70      }      }
71      int FTFont::getLineOffset() {      float FTFont::getLineOffset() {
72          return (face->size->metrics.ascender >> 6) / (float)pixsize;          return (face->size->metrics.ascender >> 6) * scale;
73      }      }
74    
75    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26