mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 10:40:37 +00:00
* Source/GSLayoutManager.m (-advancementForGlyphAtIndex:):
Simplify this method and move it in the file. * Source/NSLayoutManager.m: Use the pre-computed advancement instead of calculating it every time. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@40167 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d0d119d365
commit
2572daeff4
3 changed files with 28 additions and 60 deletions
|
@ -986,43 +986,6 @@ Fills in all glyph holes up to last. only looking at levels below level
|
|||
return cpos + r->glyphs[glyphIndex - pos].char_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* GNUstep extension
|
||||
*/
|
||||
- (NSSize) advancementForGlyphAtIndex: (unsigned int)glyphIndex
|
||||
{
|
||||
glyph_run_t *r;
|
||||
unsigned int pos, cpos;
|
||||
|
||||
if (glyphs->glyph_length <= glyphIndex)
|
||||
{
|
||||
[self _generateGlyphsUpToGlyph: glyphIndex];
|
||||
if (glyphs->glyph_length <= glyphIndex)
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"%s glyph index out of range", __PRETTY_FUNCTION__];
|
||||
return NSMakeSize(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
r = run_for_glyph_index(glyphIndex, glyphs, &pos, &cpos);
|
||||
if (!r)
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"%s glyph index out of range", __PRETTY_FUNCTION__];
|
||||
return NSMakeSize(0,0);
|
||||
}
|
||||
|
||||
if (r->head.glyph_length <= glyphIndex - pos)
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"%s internal error!", __PRETTY_FUNCTION__];
|
||||
return NSMakeSize(0,0);
|
||||
}
|
||||
|
||||
return r->glyphs[glyphIndex - pos].advancement;
|
||||
}
|
||||
|
||||
- (NSRange) characterRangeForGlyphRange: (NSRange)glyphRange
|
||||
actualGlyphRange: (NSRange *)actualGlyphRange
|
||||
{
|
||||
|
@ -1679,6 +1642,15 @@ places where we switch.
|
|||
return r->font;
|
||||
}
|
||||
|
||||
/**
|
||||
* GNUstep extension
|
||||
*/
|
||||
- (NSSize) advancementForGlyphAtIndex: (unsigned int)idx
|
||||
{
|
||||
GET_GLYPH
|
||||
return r->glyphs[idx].advancement;
|
||||
}
|
||||
|
||||
- (void) insertGlyph: (NSGlyph)aGlyph
|
||||
atGlyphIndex: (unsigned int)glyphIndex
|
||||
characterIndex: (unsigned int)charIndex
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue