summaryrefslogtreecommitdiff
path: root/src/Fl_compose.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2008-09-10 23:56:49 +0000
committerMatthias Melcher <fltk@matthiasm.com>2008-09-10 23:56:49 +0000
commitb6bde2e4569aa617c8a6af64947c688c624ed7f8 (patch)
tree010d15843eb7d4faf7cd1b0cd44d5b9c00462a83 /src/Fl_compose.cxx
parentdfb50e85292687561927610e689eb5ab30d0ba26 (diff)
Merging the UTF8 patch, consisting of O'ksi'd s original 1.1.6 patch and additions by Ian. PLEASE BE AWARE that the patch in its current incarnation is a regression in many aspects and further work is required before we can announce Unicode support.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6212 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_compose.cxx')
-rw-r--r--src/Fl_compose.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/Fl_compose.cxx b/src/Fl_compose.cxx
index 684f2fd9b..10cdb0602 100644
--- a/src/Fl_compose.cxx
+++ b/src/Fl_compose.cxx
@@ -119,9 +119,13 @@ int Fl::compose(int& del) {
if (ascii == ' ') { // space turns into nbsp
#ifdef __APPLE__
- e_text[0] = char(0xCA);
-#else
- e_text[0] = char(0xA0);
+ int len = fl_utf8encode(0xCA, e_text);
+ e_text[len] = '\0';
+ e_length = len;
+ #else
+ int len = fl_utf8encode(0xA0, e_text);
+ e_text[len] = '\0';
+ e_length = len;
#endif
compose_state = 0;
return 1;
@@ -131,9 +135,14 @@ int Fl::compose(int& del) {
}
// see if it is either character of any pair:
- for (const char *p = compose_pairs; *p; p += 2)
+ for (const char *p = compose_pairs; *p; p += 2)
if (p[0] == ascii || p[1] == ascii) {
- if (p[1] == ' ') e_text[0] = (p-compose_pairs)/2+0x80;
+ if (p[1] == ' ') {
+ int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text);
+ e_text[len] = '\0';
+ e_length = len;
+ }
+
compose_state = ascii;
return 1;
}
@@ -162,7 +171,9 @@ int Fl::compose(int& del) {
// now search for the pair in either order:
for (const char *p = compose_pairs; *p; p += 2) {
if (p[0] == ascii && p[1] == c1 || p[1] == ascii && p[0] == c1) {
- e_text[0] = (p-compose_pairs)/2+0x80;
+ int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text);
+ e_text[len] = '\0';
+ e_length = len;
del = 1; // delete the old character and insert new one
compose_state = 0;
return 1;
@@ -203,7 +214,7 @@ int Fl::compose(int& del) {
ascii = e_text[0];
for (const char *p = compose_pairs; *p; p += 2)
if (p[0] == ascii ||
- (p[1] == ' ' && (p - compose_pairs) / 2 + 0x80 == ascii)) {
+ (p[1] == ' ' && (p - compose_pairs) / 2 + 0xA0 == ascii)) {
compose_state = p[0];
return 1;
}