mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
* Headers/Additions/GNUstepGUI/GSHorizontalTypesetter.h: Add
comment to describe cache variables. * Source/GSHorizontalTypesetter.m: Restructure glyph attribute cache filling and make _addExtraLineFragment saver by providing a default for curParagraphStyle.
This commit is contained in:
parent
682aa3ccdc
commit
d9c033d464
3 changed files with 41 additions and 11 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,7 +1,17 @@
|
|||
2019-02-10 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSHorizontalTypesetter.h: Add
|
||||
comment to describe cache variables.
|
||||
* Source/GSHorizontalTypesetter.m: Restructure glyph attribute
|
||||
cache filling and make _addExtraLineFragment saver by providing a
|
||||
default for curParagraphStyle.
|
||||
|
||||
2019-01-21 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m
|
||||
Do guard includes for getmntinfo and mntent separately, should help building on Debian/kFreeBSD and fix 55526, but could need more work.
|
||||
Do guard includes for getmntinfo and mntent separately, should
|
||||
help building on Debian/kFreeBSD and fix 55526, but could need
|
||||
more work.
|
||||
|
||||
2019-01-06 Ivan Vucica <ivan@vucica.net>
|
||||
|
||||
|
|
|
@ -64,6 +64,11 @@
|
|||
NSRange fontRange; /* glyphs */
|
||||
|
||||
struct GSHorizontalTypesetter_glyph_cache_s *cache;
|
||||
/*
|
||||
cache_base: index of first glyph in cache within the text container
|
||||
cache_size: capacity of cache
|
||||
cache_length: how much of the cache is filled
|
||||
*/
|
||||
unsigned int cache_base, cache_size, cache_length;
|
||||
BOOL at_end;
|
||||
|
||||
|
|
|
@ -127,12 +127,27 @@ the last time or not, we wouldn't need to clear the cache every time */
|
|||
-(void) _cacheClear
|
||||
{
|
||||
cache_length = 0;
|
||||
|
||||
curParagraphStyle = nil;
|
||||
paragraphRange = NSMakeRange(0, 0);
|
||||
curAttributes = nil;
|
||||
attributeRange = NSMakeRange(0, 0);
|
||||
curFont = nil;
|
||||
fontRange = NSMakeRange(0, 0);
|
||||
}
|
||||
|
||||
-(void) _cacheAttributes
|
||||
-(void) _cacheAttributes: (unsigned int)char_index
|
||||
{
|
||||
NSNumber *n;
|
||||
|
||||
if (NSLocationInRange(char_index, attributeRange))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
curAttributes = [curTextStorage attributesAtIndex: char_index
|
||||
effectiveRange: &attributeRange];
|
||||
|
||||
n = [curAttributes objectForKey: NSKernAttributeName];
|
||||
if (!n)
|
||||
attributes.explicit_kern = NO;
|
||||
|
@ -180,9 +195,7 @@ the last time or not, we wouldn't need to clear the cache every time */
|
|||
|
||||
at_end = NO;
|
||||
i = [curLayoutManager characterIndexForGlyphAtIndex: glyph];
|
||||
curAttributes = [curTextStorage attributesAtIndex: i
|
||||
effectiveRange: &attributeRange];
|
||||
[self _cacheAttributes];
|
||||
[self _cacheAttributes: i];
|
||||
|
||||
paragraphRange = NSMakeRange(i, [curTextStorage length] - i);
|
||||
curParagraphStyle = [curTextStorage attribute: NSParagraphStyleAttributeName
|
||||
|
@ -198,7 +211,9 @@ the last time or not, we wouldn't need to clear the cache every time */
|
|||
range: &fontRange];
|
||||
}
|
||||
else
|
||||
at_end = YES;
|
||||
{
|
||||
at_end = YES;
|
||||
}
|
||||
}
|
||||
|
||||
-(void) _cacheGlyphs: (unsigned int)new_length
|
||||
|
@ -231,9 +246,7 @@ the last time or not, we wouldn't need to clear the cache every time */
|
|||
/* cache attributes */
|
||||
if (g->char_index >= attributeRange.location + attributeRange.length)
|
||||
{
|
||||
curAttributes = [curTextStorage attributesAtIndex: g->char_index
|
||||
effectiveRange: &attributeRange];
|
||||
[self _cacheAttributes];
|
||||
[self _cacheAttributes: g->char_index];
|
||||
}
|
||||
|
||||
g->attributes.explicit_kern = attributes.explicit_kern;
|
||||
|
@ -512,7 +525,8 @@ For bigger values the width gets ignored.
|
|||
/*
|
||||
We aren't actually interested in the glyph data, but we want the
|
||||
attributes for the final character so we can make the extra line
|
||||
frag rect match it. This call makes sure that curFont is set.
|
||||
frag rect match it. This call makes sure that curParagraphStyle
|
||||
and curFont are set.
|
||||
*/
|
||||
if (curGlyph)
|
||||
{
|
||||
|
@ -520,6 +534,8 @@ For bigger values the width gets ignored.
|
|||
}
|
||||
else
|
||||
{
|
||||
// FIXME These should come from the typing attributes
|
||||
curParagraphStyle = [NSParagraphStyle defaultParagraphStyle];
|
||||
curFont = [NSFont userFontOfSize: 0];
|
||||
}
|
||||
|
||||
|
@ -1251,7 +1267,6 @@ NS_DURING
|
|||
|
||||
[self _cacheClear];
|
||||
|
||||
|
||||
real_ret = 4;
|
||||
curPoint = NSMakePoint(0, NSMaxY(previousLineFragRect));
|
||||
while (1)
|
||||
|
|
Loading…
Reference in a new issue