summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-01-24 21:58:44 +0000
committerManolo Gouy <Manolo>2011-01-24 21:58:44 +0000
commitece27e347c12b05feb8aa74ea809120b6f2f2519 (patch)
tree36a58faf35c258b07d4398f9bbf7d5b30ab57c1c /src
parent37180e08b3c748961509aab13b5f37f023d92175 (diff)
Fix STR #2530 (Mac OS only)-continued. Change to allow display of the surrogate zone of UniChar.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8311 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/fl_font_mac.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index 9a7f086b6..222cc6a98 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -474,9 +474,11 @@ static CGColorRef flcolortocgcolor(Fl_Color i)
void fl_draw(const char *str, int n, float x, float y) {
// avoid a crash if no font has been selected by user yet !
check_default_font();
+ // convert to UTF-16 first
+ UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (fl_mac_os_version >= 0x1050) {
- CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)str, n, kCFStringEncodingUTF8, false);
+ CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)uniStr, n * sizeof(UniChar), kCFStringEncodingUTF16, false);
CGColorRef color = flcolortocgcolor(fl_color());
CFDictionarySetValue (attributes, kCTFontAttributeName, fl_fontsize->fontref);
CFDictionarySetValue (attributes, kCTForegroundColorAttributeName, color);
@@ -503,8 +505,6 @@ void fl_draw(const char *str, int n, float x, float y) {
ATSUAttributeValuePtr iValuePtr=&fl_gc;
ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
- // convert to UTF-16 first
- UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
err = ATSUSetTextPointerLocation(layout, uniStr, kATSUFromTextBeginning, n, n);
CGContextSetShouldAntialias(fl_gc, true);
err = ATSUDrawText(layout, kATSUFromTextBeginning, n, FloatToFixed(x), FloatToFixed(y));