My editor uses Uniscribe to display the text and I now have a request to set the Underline colour to be different from the normal foreground and background colours.
Is this possible or is the only way to actually draw the underline yourself as a separate task?
Any help much appreciated.
Graham,
Thanks for the link, it isn't one I'd looked at yet. From what I've seen
so far Uniscribe isn't going to be simple but considering how much work
my homegrown text placement and sizing code required (and that's not
implementing Unicode) Uniscribe should be an improvement. My last stab
at Uniscribe gave me Incorrect Parameter returns without indicating
which parameters were wrong. Back to the salt mines.
Mitch Wolberg,
RockWare, Inc.
On 12/9/2014 9:37 AM, Graham Powell wrote:
>> {quote:title=Mitch Wolberg wrote:}{quote}
>> Graham,
>>
>> Not the best solution but if you plot the text with underline first in
>> the underline color, set the background transparency to TRANSPARENT and
>> then plot the text without the underline in the text color you'll get
>> what you want.
>>
>> bmp.Canvas.Font.Style := [fsUnderline] ;
>> bmp.Canvas.Font.Color := clred ;
>> bmp.Canvas.TextOut(5 , 100 , 'Hello' ) ;
>> SetBKMode ( bmp.Canvas.Handle , TRANSPARENT ) ;
>> bmp.Canvas.Font.Style := [] ;
>> bmp.Canvas.Font.Color := clBlue ;
>> bmp.Canvas.TextOut(5 , 100 , 'Hello' ) ;
>>
>> Dumb but it works. Speaking of dumb I've spent the last day trying to
>> figure out how to use Uniscribe for wrapping text with mixed styles and
>> sizes and don't seem to be getting it. If you've got a (relatively)
>> simple example of how to do this I'd love to see it.
>>
>> Mitch Wolberg,
>> RockWare, Inc.
>>
>
> I see the principle of what you are saying. Of course you won't be using Canvas.TextOut anymore. With your method you will double the draw time and end up with the underline underneath any character tails which may look odd.
>
> Unfortunatlely the concept of "Uniscribe" and "simple" don't co-exist very well. If you haven't already found "Catch22", I would study this tutorial very thoroughly. Just type "Catch22 Uniscribe" into Google.
>
> One of the Uniscribe data structures does return an array of points about each character. Can you break at this point, can you place the carat at this point etc.
>
> I started to upgrade my editor to Uniscribe several years ago and I still find the odd strange effect. (Usually with a mixture of English and Arabic). Even Microsoft Word is not perfect in how it treats the Arabic English mixture.
>
> {quote:title=Mitch Wolberg wrote:}{quote}
> Graham,
>
> Not the best solution but if you plot the text with underline first in
> the underline color, set the background transparency to TRANSPARENT and
> then plot the text without the underline in the text color you'll get
> what you want.
>
> bmp.Canvas.Font.Style := [fsUnderline] ;
> bmp.Canvas.Font.Color := clred ;
> bmp.Canvas.TextOut(5 , 100 , 'Hello' ) ;
> SetBKMode ( bmp.Canvas.Handle , TRANSPARENT ) ;
> bmp.Canvas.Font.Style := [] ;
> bmp.Canvas.Font.Color := clBlue ;
> bmp.Canvas.TextOut(5 , 100 , 'Hello' ) ;
>
> Dumb but it works. Speaking of dumb I've spent the last day trying to
> figure out how to use Uniscribe for wrapping text with mixed styles and
> sizes and don't seem to be getting it. If you've got a (relatively)
> simple example of how to do this I'd love to see it.
>
> Mitch Wolberg,
> RockWare, Inc.
>
I see the principle of what you are saying. Of course you won't be using Canvas.TextOut anymore. With your method you will double the draw time and end up with the underline underneath any character tails which may look odd.
Unfortunatlely the concept of "Uniscribe" and "simple" don't co-exist very well. If you haven't already found "Catch22", I would study this tutorial very thoroughly. Just type "Catch22 Uniscribe" into Google.
One of the Uniscribe data structures does return an array of points about each character. Can you break at this point, can you place the carat at this point etc.
I started to upgrade my editor to Uniscribe several years ago and I still find the odd strange effect. (Usually with a mixture of English and Arabic). Even Microsoft Word is not perfect in how it treats the Arabic English mixture.
Graham,
Not the best solution but if you plot the text with underline first in
the underline color, set the background transparency to TRANSPARENT and
then plot the text without the underline in the text color you'll get
what you want.
bmp.Canvas.Font.Style := [fsUnderline] ;
bmp.Canvas.Font.Color := clred ;
bmp.Canvas.TextOut(5 , 100 , 'Hello' ) ;
SetBKMode ( bmp.Canvas.Handle , TRANSPARENT ) ;
bmp.Canvas.Font.Style := [] ;
bmp.Canvas.Font.Color := clBlue ;
bmp.Canvas.TextOut(5 , 100 , 'Hello' ) ;
Dumb but it works. Speaking of dumb I've spent the last day trying to
figure out how to use Uniscribe for wrapping text with mixed styles and
sizes and don't seem to be getting it. If you've got a (relatively)
simple example of how to do this I'd love to see it.
Mitch Wolberg,
RockWare, Inc.
On 12/4/2014 4:40 AM, Graham Powell wrote:
> My editor uses Uniscribe to display the text and I now have a request to set the Underline colour to be different from the normal foreground and background colours.
>
> Is this possible or is the only way to actually draw the underline yourself as a separate task?
>
> Any help much appreciated.
>
Graham wrote:
> My editor uses Uniscribe to display the text and I now have a request
> to set the Underline colour to be different from the normal foreground
> and background colours.
>
> Is this possible
Not that I am aware of. The underline is drawn as part of the glyph that
is rendered above the underline. You don't have control over them separately
if you use the standard underline font style when drawing text.
> is the only way to actually draw the underline yourself as a separate task?
Yes.
--
Remy Lebeau (TeamB)