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

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

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

revision 1.9 by jvk, Wed Oct 2 12:23:48 2002 UTC revision 1.10 by tjl, Sun Oct 6 17:37:46 2002 UTC
# Line 28  namespace Text { Line 28  namespace Text {
28       */       */
29      class GlyphInfo {      class GlyphInfo {
30      public:      public:
31          GlyphInfo(int top, int left, int width, int height, int xadvance) :          GlyphInfo(float top, float left, float width, float height,
32                  top(top), left(left), width(width), height(height), xadvance(xadvance) { }                      float xadvance, float scaleFromPixels,
33                        short iwidth, short iheight) :
34                    top(top), left(left), width(width), height(height),
35                    xadvance(xadvance), scaleFromPixels(scaleFromPixels),
36                    iwidth(iwidth), iheight(iheight) { }
37          GlyphInfo() : top(0), left(0), width(0), height(0), xadvance(0) { }          GlyphInfo() : top(0), left(0), width(0), height(0), xadvance(0) { }
38          int top;          float top;
39          int left;          float left;
40          int width;          float width;
41          int height;          float height;
42          int xadvance;          float xadvance;
43            float scaleFromPixels;
44            short iwidth;
45            short iheight;
46          friend ostream& operator<<(ostream& o, const GlyphInfo &g) ;          friend ostream& operator<<(ostream& o, const GlyphInfo &g) ;
47      };      };
48    
# Line 65  namespace Text { Line 72  namespace Text {
72          Glyph withBorder(int texels) {          Glyph withBorder(int texels) {
73              // Empty glyphs remain empty.              // Empty glyphs remain empty.
74              if(extents.width == 0) return *this;              if(extents.width == 0) return *this;
75                float scale = extents.scaleFromPixels;
76                float st = scale * texels;
77              return Glyph(              return Glyph(
78              GlyphInfo(              GlyphInfo(
79                  extents.top - 1 * texels, extents.left - 1 * texels,                  extents.top - 1 * st, extents.left - 1 * st,
80                  extents.width + 2 * texels, extents.height + 2 * texels,                  extents.width + 2 * st, extents.height + 2 * st,
81                  extents.xadvance                  extents.xadvance,
82                    extents.scaleFromPixels,
83                    extents.iwidth + 2 * texels, extents.iheight + 2 * texels
84              ),              ),
85              raster.addBorder(texels, 0));              raster.addBorder(texels, 0));
86          }          }
# Line 196  namespace Text { Line 207  namespace Text {
207                      Glyph g = face->getRaster(i);                      Glyph g = face->getRaster(i);
208                      if(g.extents.width == 0 || g.extents.height == 0)                      if(g.extents.width == 0 || g.extents.height == 0)
209                          continue;                          continue;
210                      MosaicTile tile = mosaic.alloc(g.extents.width, g.extents.height);                      MosaicTile tile = mosaic.alloc(g.extents.iwidth, g.extents.iheight);
211                      DBG(dbg_glyphdetails) << "MTile: "<<tile<<"\n";                      DBG(dbg_glyphdetails) << "MTile: "<<tile<<"\n";
212                      tile.loadImage(g.raster);                      tile.loadImage(g.raster);
213                      glyphs[i] = QuadGlyph(g, tile.getRect());                      glyphs[i] = QuadGlyph(g, tile.getRect());
# Line 225  namespace Text { Line 236  namespace Text {
236          }          }
237          /** Get the width of a single glyph.          /** Get the width of a single glyph.
238           */           */
239          int getGlyphWidth(Char c) {          float getGlyphWidth(Char c) {
240              if((unsigned)c >= glyphs.size()) return 0;              if((unsigned)c >= glyphs.size()) return 0;
241              DBG(dbg_glyphdetails) << "Glyphwidth: "<<((int)c)<<" "<<glyphs[c].glyph.extents.xadvance<<" valid:"<<glyphs[c].valid()<< "\n";              DBG(dbg_glyphdetails) << "Glyphwidth: "<<((int)c)<<" "<<glyphs[c].glyph.extents.xadvance<<" valid:"<<glyphs[c].valid()<< "\n";
242              if(!glyphs[c].valid() && c != ' ') return 0;              if(!glyphs[c].valid() && c != ' ') return 0;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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