mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
If a range of glyphs have no color attribute, use [NSColor textColor] instead of assuming black.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18021 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
205c9bd67f
commit
fed935717b
2 changed files with 20 additions and 14 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-11-01 18:19 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSLayoutManager.m (-drawGlyphsForGlyphRange:atPoint:):
|
||||
If a range of glyphs has no color set, use the default text color
|
||||
(as returned by [NSColor textColor]) instead of assuming black.
|
||||
|
||||
2003-10-30 00:38 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSImage.m (iterate_reps_for_types, repd_for_rep): Make
|
||||
|
|
|
@ -1292,6 +1292,14 @@ container
|
|||
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
|
||||
/*
|
||||
For performance, it might (if benchmarks or profiling backs it up) be
|
||||
worthwhile to cache this across calls to this method. However, this
|
||||
color can change at runtime, so care would have to be taken to keep the
|
||||
cache in sync with the actual color.
|
||||
*/
|
||||
NSColor *defaultTextColor = [NSColor textColor];
|
||||
|
||||
#define GBUF_SIZE 16 /* TODO: tweak */
|
||||
NSGlyph gbuf[GBUF_SIZE];
|
||||
int gbuf_len;
|
||||
|
@ -1330,13 +1338,9 @@ container
|
|||
attributes = [_textStorage attributesAtIndex: char_pos
|
||||
effectiveRange: NULL];
|
||||
color = [attributes valueForKey: NSForegroundColorAttributeName];
|
||||
if (color)
|
||||
[color set];
|
||||
else
|
||||
{
|
||||
DPSsetgray(ctxt, 0.0);
|
||||
DPSsetalpha(ctxt, 1.0);
|
||||
}
|
||||
if (!color)
|
||||
color = defaultTextColor;
|
||||
[color set];
|
||||
f = glyph_run->font;
|
||||
[f set];
|
||||
|
||||
|
@ -1378,6 +1382,8 @@ container
|
|||
attributes = [_textStorage attributesAtIndex: char_pos
|
||||
effectiveRange: NULL];
|
||||
new_color = [attributes valueForKey: NSForegroundColorAttributeName];
|
||||
if (!new_color)
|
||||
new_color = defaultTextColor;
|
||||
glyph = glyph_run->glyphs;
|
||||
if (glyph_run->font != f || new_color != color)
|
||||
{
|
||||
|
@ -1391,13 +1397,7 @@ container
|
|||
if (color != new_color)
|
||||
{
|
||||
color = new_color;
|
||||
if (color)
|
||||
[color set];
|
||||
else
|
||||
{
|
||||
DPSsetgray(ctxt, 0.0);
|
||||
DPSsetalpha(ctxt, 1.0);
|
||||
}
|
||||
[color set];
|
||||
}
|
||||
if (f != glyph_run->font)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue