Hi everyone,
I was playing around with wxDC to make a simple view-only styled text control to be able to rapidly view huge texts. This works quite well, but a Problem arises, when I'm trying to use Unicode fonts:
I'm working with non-unicode-build and would like to draw single characters with wxDC::DrawText(...) using the numeric unicode adress of the selected glyph.
Any suggestions how this could work? I'm stuck with this Problem.
Question on using Unicode fonts
Hi!
Set the correct font for the dc and then use something like greekstring = wxT("\x3B1\x3B2\x3B3"); with the correct numeric values for the chars.
Set the correct font for the dc and then use something like greekstring = wxT("\x3B1\x3B2\x3B3"); with the correct numeric values for the chars.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Is it possible, that this only works in Unicode build? I thought in non-Unicode _T(...) doesn't do anything at all (?).
I am afraid, because with wxDC text can only be drawn via a wxString parameter and in non-Unicode build wxString characters internally are standard C chars, drawing chars with numeric values > 0xFF is simply not possible.
But anyway I'll try your code when I'm coming home from work today. Thanks.
I am afraid, because with wxDC text can only be drawn via a wxString parameter and in non-Unicode build wxString characters internally are standard C chars, drawing chars with numeric values > 0xFF is simply not possible.
But anyway I'll try your code when I'm coming home from work today. Thanks.
Me again.
upCASE, I couldn't get the code you proposed to work as it should. I tried
with Palatino Linotype set as Font, where 0x3AC, 0x3AD, and 0x3AE should be the greek letters alpha, epsilon and eta (each with an acute), but the characters shown were these of 0xAC, 0xAD and 0xAE.
I guess when not using unicode build all chars are cut to the last byte.
Or did I understand something wrong in your post?
upCASE, I couldn't get the code you proposed to work as it should. I tried
Code: Select all
wxString test = _T("\x3AC\x3AD\x3AE");
dc.DrawText(test, 100,100);
I guess when not using unicode build all chars are cut to the last byte.
Or did I understand something wrong in your post?
Last edited by JonnyL on Wed Apr 06, 2005 2:31 pm, edited 1 time in total.
in ANSI build this should be:JonnyL wrote:Code: Select all
wxString test = _T("\x3AC\x3AD\x3AE");
Code: Select all
wxString test = L"\x03AC\x03AD\x03AE";
Platform: MSW (Windows XP Pro)
Compiler: msvc 13.10.3077 (Free Toolkit)
wxWidgets: v2.6.0
Compiler: msvc 13.10.3077 (Free Toolkit)
wxWidgets: v2.6.0
Unfortunately, this won't work, too. In ANSI build if I use
nothing is drawn to the screen. Anyway thanks for your reply, krysa.
Code: Select all
wxString test = L"\x03AC\x03AD\x03AE";
dc.DrawText(test, 100,100);
Have you tryed using some conversions from unicode to ansi (like iconv or wx)?JonnyL wrote:Unfortunately, this won't work, too. In ANSI build if I use
nothing is drawn to the screen. Anyway thanks for your reply, krysa.Code: Select all
wxString test = L"\x03AC\x03AD\x03AE"; dc.DrawText(test, 100,100);
Platform: MSW (Windows XP Pro)
Compiler: msvc 13.10.3077 (Free Toolkit)
wxWidgets: v2.6.0
Compiler: msvc 13.10.3077 (Free Toolkit)
wxWidgets: v2.6.0