[fxruby-users] FXDCWindow::drawText encoding
info at sten-net.de
Wed Mar 23 10:43:22 EST 2005
Jeroen van der Zijp schrieb:
>On Wednesday 23 March 2005 09:20 am, Jannis Pohlmann wrote:
>>I just started experimenting with the FOX drawing functions. After
>>having a little problem with
>>text positioning, I know stumbled into an encoding problem (at least, I
>>Whenever I want to draw something like "foo\nbar" or "foo\r\nbar" I get
>>those ugly squares (which
>>likely symbolize a char the font (?) is not able to display).
>>Screenshot is attached. My system's encoding is UTF-8, by the way.
>Please note that dc.drawText() does not do any formatting, it just draws
>the visible characters and draws "replacement" characters for the formatting
>characters like \n and \t.
>If you want interpretation of the formatting, just place a text widget and
>it will do a lot of formatting for you; alternatively you can write a loop;
>here is what FXLabel uses:
> while(end<text.length() && text[end]!='\n') end++;
>I know you're working in Ruby, and this is C++. But I hope you get the
>idea:- hunt for the \n, then draw up to that, move to the next line and
>hunt for the next \n. Repeat until the whole string is done....
Thanks very much, Jeroen. Wrapping this into correct Ruby code won't be
much of a problem.
>P.S. As for utf-8, this capability will be in FOX in the 1.6 version;
>the plan is to have unicode drawing support for all widgets, and have
>some stuff in place for localization.
Yeah, I'm really looking forward to it.
More information about the fxruby-users