rangeset_set_style?

Bert Wesarg wesarg at informatik.uni-halle.de
Tue Aug 7 17:19:13 CEST 2007



Tony Balinski wrote:
> Quoting Bert Wesarg <wesarg at informatik.uni-halle.de>:
> 
>> Hello all,
>>
>> I may have the need to set not only the color for a rangeset but the
>> font style too. So I thought about a new function that can set a spec.
>> style to a rangeset. Has somebody thought about this too? Is it possible?
> 
> It's bound to be possible, but you may have to do some heavy lifting. A
> quick look shows that the only font stored in the widget is the plain one.
> Style records provide the bold and/or italic fonts directly as the fonts to
> use, so there is no simple table of fonts, accessible to the text widget,
> telling you which is which.
> 
> I would recommend adding these as resources to the widget.
> 
> As for the actual style settings, you essentially have three states for
> each of bold and italic: "on", "off" or "default" (leave what syntax
> highlighting would do, if active, or leave plain), eg
>     rangeset_set_bold("on"|"off"|"default")
>     rangeset_set_italic("on"|"off"|"default")
Nice, that would better harmonize with the rangeset_set_color() macro.
But as you note, may be to much work.

My first idea was to overwrite the style bitmap with the style index
from the rangeset, prior to the evaluation of this in function
textDisp.c:drawString(). The problem was, that only styles are loaded
that are needed by the syntax HL.

My second idea, is to add a styleTable to the RangesetTable, and fill
this dynamically with styles requested by calls to rangeset_set_style().

> 
> I sometimes think it might be good to be able to set a rangeset's
> foreground color too, or even allow underlining (both in highlight
> styles and rangesets), but that might take things too far!
Yeah, I see this too with the underline style, strange, that this
doesn't find its way to the syntax hightlightning. The only thing to
change is to extend the style resource format and the style edit dialog, or?

Bert

> 
> Tony


More information about the Discuss mailing list