DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2622
Version: 1.3-current


Ooh, your MinGW/w32api version is really, really old!

On my new Cygwin installation with the same cross compiler tools for MinGW
(i.e. for "native" Windows applications, the former -mno-cygwin option), I
found the same results as Some868one (LPSTR lpClass;), although the w32api
version claims to be 3.17 as well. 

<wild guess>
I *believe* that the new Cygwin "cross compiler" toolchain is provided by
the mingw64 team - both for 32-bit and 64-bit mode - and *they* seem to
have it right. Sigh.
</wild guess>

If this is true, then we can't distinguish the compilers or build
environments at all (except that we know that it is the mingw64 version,
if _WIN64 is defined). The only clean solution would probably be a feature
test and a macro definition, something like that used in the attached patch
(fl_font_win32.diff). This is only a preliminary version, but I could
compile all my Windows test versions (MinGW, Cygwin/X11 (--enable-cygwin),
Cygwin cross -> native Windows 32-bit, and Cygwin cross -> native Windows
64-bit, MS VS 2008, MS VS 2010).

Something like the attached patch file could be used to solve STR #2623.
Then we must only take care that we don't break it again with the fix that
we will find here. Note that I compiled with WS2008/2010 successfully with
this patch in place.

Okay, so far, going to post the bug in mingw.user now...


Link: http://www.fltk.org/str.php?L2622
Version: 1.3-current
Index: src/fl_font_win32.cxx
===================================================================
--- src/fl_font_win32.cxx       (revision 8642)
+++ src/fl_font_win32.cxx       (working copy)
@@ -282,7 +282,7 @@
   }
 
   static unsigned short *ext_buff = NULL; // UTF-16 converted version of input 
UTF-8 string
-  static WCHAR *c_buff = NULL; // glyph class array (if needed)
+  static CHAR *c_buff = NULL; // glyph class array (if needed)
   static WORD  *w_buff = NULL; // glyph indices array
   static unsigned wc_len = 0;  // current string buffer dimensions
   static const MAT2 matrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } }; // 
identity mat for GetGlyphOutlineW
@@ -319,7 +319,7 @@
     wc_len = len + 64;
     ext_buff = new unsigned short[wc_len];
     w_buff = new WORD[wc_len];
-    c_buff = new WCHAR[wc_len];
+    c_buff = new CHAR[wc_len];
     len = fl_utf8toUtf16(c, n, ext_buff, wc_len);
   }
   SelectObject(gc, fl_fontsize->fid);
@@ -339,10 +339,14 @@
   if (has_surrogates) {
     // GetGlyphIndices will not work - use GetCharacterPlacementW() instead
     GCP_RESULTSW gcp_res;
-    memset(c_buff, 0, (sizeof(WCHAR) * wc_len));
+    memset(c_buff, 0, (sizeof(CHAR) * wc_len));
     memset(w_buff, 0, (sizeof(WORD) * wc_len));
     memset(&gcp_res, 0, sizeof(GCP_RESULTSW));
+#if defined(_MSC_VER) | defined(_WIN64) | defined(MINGW_WINGDI_FIXED)
     gcp_res.lpClass = c_buff;
+#else
+    gcp_res.lpClass = (WCHAR *)c_buff; // FIXME: wrong declaration in MinGW's 
wingdi.h
+#endif
     gcp_res.lpGlyphs = (LPWSTR)w_buff;
     gcp_res.nGlyphs = wc_len;
     gcp_res.lStructSize = sizeof(gcp_res);
_______________________________________________
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to