In particular, I have added a new function to src/fl_utf.c called fl_ucs_to_Utf16() which
converts a single 32-bit Unicode value into one (or more) UTF16 cells.
This is needed in the win32 char-by-char text width() logic, and I suspect may also be useful in the OSX code in some places.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8585 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The problem seems to be in GetGlyphIndicesW() which is returning invalid indices for the surrogate pairs.
This causes subsequent measurements of the glyphs to fail, of course.
This patch does not fix the problem, it only makes sure it fails cleanly, causing a fallback to the default fl_measure like behaviour.
This is not nice, nor what I want, but at least it is consistent for now...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8582 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
made consistent with other platforms, that is, the 4th byte of each pixel is ignored
instead of treated as transparency data.
In the future, the fl_draw_image() signature may be extended with another argument
that would describe if and how transparency information is available.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8581 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This now correctly measures glyphs whose codepoint requires a surrogate pair to represent it in UTF16.
NOTE 1: This code makes any UCS point > 0xFFFF a "special case" and measures it explicitly, rather than using the lookup table. This "explicit measure" may be slow, but actually seems OK in my tests, so far.
The lookup table still covers the basic multilingual plane and is used for any glyph <= 0xFFFF as before, so the behaviour for most existing bodies of text is unchanged.
This code also retains the historical behaviour under Win32 whereby strings are measured char-by-char rather than as a whole string - again this is intended to retain compatability with existing implementations.
It is proposed that we should move towards measuring entire strings in the future as this is conceivably more efficient and certainly more consistent - rendering is now largely done "string as a whole" so we ought to measure in that way too; though to date the differences seem tiny, as evdienced by the text rendering page of the unittest example.
NOTE 2: This does not fix the *rendering* of surrogate pairs under XP, which still seems to be broken. I suspect that TextOutW() may genuinely broken under XP, as it works fine on Vista, and it is not just my code that seems broken, other non-fltk programs exhibit the same aberrant behaviour. Measuring of surrogate pairs appears to work correctly though...
Maybe we are using TextOutW() wrongly?
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8580 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This seems to be good so far, though does not resolve the XP surrogate pairs issues.
If this fix is bad, we need to revert to r8577, which is good...
And I still haven't fixed the handling of width in win32 code, so it is still inconsistent with draw for high Ubicode points.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8579 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This makes string handling much more consistent across variants.
Doh!. I am such an idiot...
NOTE: This still does not fix aberrant handling of surrogate pairs under WinXP, and I still haven't resolved the issues with the win32 ::width() functions not handling surrogate pairs at all...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8575 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
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
Fixes to the various ::width() methods for win32 and OSX still TBD.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8568 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This change works, but is incomplete, other sections of the win32 code (and possibly OSX code) are making the same invalid assumptions about UTF16 chars.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8567 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Also, don't rebuild the application menu if one is already there.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8549 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This created conflict with other libraries that do the same. This STR reports that Tcl/Tk is one
such library. The fix removes any NSApplication subclass usage in FLTK, and requires
to initialize the NSApplication-subclassing library before calling fl_open_display(). In this
condition an FLTK application can also use an NSApplication-subclassing library such as Tk.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8546 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
use the FLTextView subclass of NSTextView only for Mac OS < 10.5 because it's not
necessary for Mac OS >= 10.5
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8542 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Useful when deleting a window because subwindows share their xid with their parent
window (unlike under MSWIn or Xlib), so subwindows should not delete their xid.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8540 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
WRT subwindows and when using the window itself as the widget argument.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8538 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The fix invalidates the pile of string textures after each Fl_Gl_Window deletion.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8536 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
(xid) attached to it because it is in fact the Cocoa window of its parent window.
I check that by making sure that none of the windows in the window list uses
this Cocoa window. Is there a better algorithm ?
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8534 ea41ed52-d2ee-0310-a9c1-e6b18d33e121