summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan MacArthur <imacarthur@gmail.com>2011-04-07 09:28:45 +0000
committerIan MacArthur <imacarthur@gmail.com>2011-04-07 09:28:45 +0000
commit016219f4a2ac03033e8ae5d332aa5b915c01b524 (patch)
treea18d96102e574f1dfcc97ca36ed9c288d83a5988 /src
parentfc3ef2b0ea90e0977fda2a47d318cdaf8b90f90d (diff)
Replace a few instances of fl_utf8toUtf16() with the near-equivalent MS API call MultiByteToWideChar() as this seems to fix the regression I introduced in the rendering of rotated text on WinXP.
However... It does not cause the "high" Unicode code points to render correctly on XP, even though they do work on Vista (and I assume later variants like Win7...) So there's still something I am missing here. Maybe XP is just broken? That'll be a problem... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8570 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/fl_font_win32.cxx21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/fl_font_win32.cxx b/src/fl_font_win32.cxx
index 82e0075f2..5a7eef1d1 100644
--- a/src/fl_font_win32.cxx
+++ b/src/fl_font_win32.cxx
@@ -355,9 +355,9 @@ void Fl_GDI_Graphics_Driver::draw(const char* str, int n, int x, int y) {
}
// Do we need a surrogate pair for this UCS value?
if(u > 0xFFFF) {
- cc = fl_utf8toUtf16((str + i), l, ucs, 4);
-// This is the - essentially identical - MS API equivalent
-//cc = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, (str + i), l, (WCHAR*)ucs, 4);
+ //cc = fl_utf8toUtf16((str + i), l, ucs, 4);
+ // This is the MS API equivalent to fl_utf8toUtf16()
+ cc = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, (str + i), l, (WCHAR*)ucs, 4);
}
else { // not a surrogate pair, use a single value
ucs[0] = u;
@@ -377,12 +377,15 @@ void Fl_GDI_Graphics_Driver::draw(int angle, const char* str, int n, int x, int
COLORREF oldColor = SetTextColor(fl_gc, fl_RGB());
SelectObject(fl_gc, font_descriptor()->fid);
unsigned short* ucs = new unsigned short[n]; // alloc an array for the UTF16 string
- wc_count = fl_utf8toUtf16(str, n, ucs, n);
- if(wc_count > n) { // Array too small - this should never happen...
- delete[] ucs; // free up the initial allocation
- ucs = new unsigned short[wc_count + 4]; // make a "big enough" array
- wc_count = fl_utf8toUtf16(str, n, ucs, wc_count); // respin the translation
- }
+ //wc_count = fl_utf8toUtf16(str, n, ucs, n);
+ // This is the MS API equivalent to fl_utf8toUtf16()
+ wc_count = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, n, (WCHAR*)ucs, n);
+// if(wc_count > n) { // Array too small - this should never happen...
+// delete[] ucs; // free up the initial allocation
+// ucs = new unsigned short[wc_count + 4]; // make a "big enough" array
+// //wc_count = fl_utf8toUtf16(str, n, ucs, wc_count); // respin the translation
+// wc_count = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, n, (WCHAR*)ucs, wc_count);
+// }
TextOutW(fl_gc, x, y, (WCHAR*)ucs, wc_count);
delete[] ucs;
SetTextColor(fl_gc, oldColor);