mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +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
0759f5093f
commit
b4bf73b178
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>
|
2003-10-30 00:38 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/NSImage.m (iterate_reps_for_types, repd_for_rep): Make
|
* Source/NSImage.m (iterate_reps_for_types, repd_for_rep): Make
|
||||||
|
|
|
@ -1292,6 +1292,14 @@ container
|
||||||
|
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
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 */
|
#define GBUF_SIZE 16 /* TODO: tweak */
|
||||||
NSGlyph gbuf[GBUF_SIZE];
|
NSGlyph gbuf[GBUF_SIZE];
|
||||||
int gbuf_len;
|
int gbuf_len;
|
||||||
|
@ -1330,13 +1338,9 @@ container
|
||||||
attributes = [_textStorage attributesAtIndex: char_pos
|
attributes = [_textStorage attributesAtIndex: char_pos
|
||||||
effectiveRange: NULL];
|
effectiveRange: NULL];
|
||||||
color = [attributes valueForKey: NSForegroundColorAttributeName];
|
color = [attributes valueForKey: NSForegroundColorAttributeName];
|
||||||
if (color)
|
if (!color)
|
||||||
[color set];
|
color = defaultTextColor;
|
||||||
else
|
[color set];
|
||||||
{
|
|
||||||
DPSsetgray(ctxt, 0.0);
|
|
||||||
DPSsetalpha(ctxt, 1.0);
|
|
||||||
}
|
|
||||||
f = glyph_run->font;
|
f = glyph_run->font;
|
||||||
[f set];
|
[f set];
|
||||||
|
|
||||||
|
@ -1378,6 +1382,8 @@ container
|
||||||
attributes = [_textStorage attributesAtIndex: char_pos
|
attributes = [_textStorage attributesAtIndex: char_pos
|
||||||
effectiveRange: NULL];
|
effectiveRange: NULL];
|
||||||
new_color = [attributes valueForKey: NSForegroundColorAttributeName];
|
new_color = [attributes valueForKey: NSForegroundColorAttributeName];
|
||||||
|
if (!new_color)
|
||||||
|
new_color = defaultTextColor;
|
||||||
glyph = glyph_run->glyphs;
|
glyph = glyph_run->glyphs;
|
||||||
if (glyph_run->font != f || new_color != color)
|
if (glyph_run->font != f || new_color != color)
|
||||||
{
|
{
|
||||||
|
@ -1391,13 +1397,7 @@ container
|
||||||
if (color != new_color)
|
if (color != new_color)
|
||||||
{
|
{
|
||||||
color = new_color;
|
color = new_color;
|
||||||
if (color)
|
[color set];
|
||||||
[color set];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DPSsetgray(ctxt, 0.0);
|
|
||||||
DPSsetalpha(ctxt, 1.0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (f != glyph_run->font)
|
if (f != glyph_run->font)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue