/[hegemonie]/hegemonie/Interface/UiText.m
ViewVC logotype

Diff of /hegemonie/Interface/UiText.m

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

revision 1.8 by dam, Tue Jul 29 12:54:49 2003 UTC revision 1.9 by zaral, Tue Aug 5 12:07:02 2003 UTC
# Line 152  static FT_Face _face; Line 152  static FT_Face _face;
152          {          {
153            FT_Vector delta;            FT_Vector delta;
154                        
155            FT_Get_Kerning (_face, previous, glyph_index,            FT_Get_Kerning (_face, previous, glyph_index,
156                            ft_kerning_default, &delta);                             ft_kerning_default, &delta);
157                        
158            pen.x += delta.x;            pen.x += delta.x;
159          }          }
# Line 324  _draw_bitmap (const FT_Bitmap *bitmap, f Line 324  _draw_bitmap (const FT_Bitmap *bitmap, f
324   */   */
325  - (NSSize) size  - (NSSize) size
326  {  {
327      return [self sizeAtIndex: [_glyphes count]];
328    }
329    
330    /**
331     * Returns the size of bounding box at a position of the text.
332     */
333    - (NSSize) sizeAtIndex: (unsigned)index
334    {
335      NSParameterAssert (index <= [_glyphes count]);
336    
337      unsigned position = 1;
338    FT_BBox bbox = {0, 0, 0, 0};    FT_BBox bbox = {0, 0, 0, 0};
339        
340    NSEnumerator *enumerator = [_glyphes objectEnumerator];    NSEnumerator *enumerator = [_glyphes objectEnumerator];
341    UiGlyph *glyph;    UiGlyph *glyph;
342    while ((glyph = [enumerator nextObject]))    while ( (glyph = [enumerator nextObject])
343              && (position <= index) )
344      {      {
345        FT_BBox glyph_bbox;        FT_BBox glyph_bbox;
346                
# Line 343  _draw_bitmap (const FT_Bitmap *bitmap, f Line 355  _draw_bitmap (const FT_Bitmap *bitmap, f
355        bbox.yMin = MIN(bbox.yMin, glyph_bbox.yMin);        bbox.yMin = MIN(bbox.yMin, glyph_bbox.yMin);
356        bbox.xMax = MAX(bbox.xMax, glyph_bbox.xMax);        bbox.xMax = MAX(bbox.xMax, glyph_bbox.xMax);
357        bbox.yMax = MAX(bbox.yMax, glyph_bbox.yMax);        bbox.yMax = MAX(bbox.yMax, glyph_bbox.yMax);
358    
359          position++;
360      }      }
     
   // NSParameterAssert (bbox.xMin == 0);  
   // NSParameterAssert (bbox.yMin == 0);  
361    
362    return NSMakeSize ((bbox.xMax - bbox.xMin) / 64.0f,      return NSMakeSize ((bbox.xMax - bbox.xMin) / 64.0f,
363                       (bbox.yMax - bbox.yMin) / 64.0f);                         (bbox.yMax - bbox.yMin) / 64.0f);
364  }  }
365    
366  @end  @end

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

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