diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-11-03 22:01:43 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-11-03 22:01:43 +0000 |
| commit | cac40a9b024185cfa5f10d5e7845582ab30a5dd1 (patch) | |
| tree | 186b289e6429408c98c7a6b27e4eacd7a06d69b5 /test | |
| parent | ddd4bbff1b07daf5510b1c9aa233876cae332264 (diff) | |
STR 2158: partially solved. This commit is huge, I admit. I recoded most of Fl_Text_Buffer and large chunks of Fl_Text_Display to make it UTF-8 safe. Rendering of all left-to-right scripts works well on OS X for all tested fonts. International input works AFAIK. Copy and paste of UTF-8 data works. ----> what's not working yet though is line wrapping. Also, text search for internationsl characters is not working yet.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7792 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
| -rw-r--r-- | test/editor.cxx | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/test/editor.cxx b/test/editor.cxx index beef18be2..f9eafa9d7 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -66,12 +66,13 @@ Fl_Text_Buffer *stylebuf = 0; Fl_Text_Display::Style_Table_Entry styletable[] = { // Style table { FL_BLACK, FL_COURIER, TS }, // A - Plain - { FL_DARK_GREEN, FL_COURIER_ITALIC, TS }, // B - Line comments - { FL_DARK_GREEN, FL_COURIER_ITALIC, TS }, // C - Block comments + { FL_DARK_GREEN, FL_HELVETICA_ITALIC, TS }, // B - Line comments + { FL_DARK_GREEN, FL_HELVETICA_ITALIC, TS }, // C - Block comments { FL_BLUE, FL_COURIER, TS }, // D - Strings { FL_DARK_RED, FL_COURIER, TS }, // E - Directives { FL_DARK_RED, FL_COURIER_BOLD, TS }, // F - Types - { FL_BLUE, FL_COURIER_BOLD, TS } // G - Keywords + { FL_BLUE, FL_COURIER_BOLD, TS }, // G - Keywords + { FL_MAGENTA, FL_HELVETICA, TS-2 } // H - Font height test }; const char *code_keywords[] = { // List of known C/C++ keywords... "and", @@ -200,6 +201,8 @@ style_parse(const char *text, if (length == 0) break; } else if (strncmp(text, "/*", 2) == 0) { current = 'C'; + } else if (strncmp(text, "[", 1) == 0) { + current = 'H'; } else if (strncmp(text, "\\\"", 2) == 0) { // Quoted quote... *style++ = current; @@ -261,6 +264,14 @@ style_parse(const char *text, current = 'A'; col += 2; continue; + } else if (current == 'H' && strncmp(text, "]", 1) == 0) { + // Close a font test style + *style++ = current; + text ++; + length --; + current = 'A'; + col += 1; + continue; } else if (current == 'D') { // Continuing in string... if (strncmp(text, "\\\"", 2) == 0) { @@ -793,7 +804,48 @@ Fl_Window* new_view() { int main(int argc, char **argv) { textbuf = new Fl_Text_Buffer; - textbuf->text("Rügenwälder Ruß."); + textbuf->text( + "void saveas_cb() {\n" + " Fl_Native_File_Chooser fnfc;\n" + " fnfc.title(\"Save File As?\");\n" + " fnfc.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE);\n" + " if ( fnfc.show() ) return;\n" + " save_file(fnfc.filename());\n" + "}\n\n" + "// Falsches Üben von Xylophonmusik quält jeden größeren Zwerg\n" + "// (= Wrongful practicing of xylophone music tortures every larger dwarf)\n" + "\n" + "// Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich\n" + "// (= Twelve boxing fighters hunted Eva across the dike of Sylt)\n" + "\n" + "Heizöl/*rückstoß*/abdämpfung\n" + "(= fuel oil recoil absorber)\n" + "\n" + "Hiragana: //(Iroha)\n" + "\n" + "いろはにほへとちりぬるを\n" + "わかよたれそつねならむ\n" + "うゐのおくやまけふこえて\n" + "あさきゆめみしゑひもせす\n" + "\n" + "Katakana:\n" + "\n" + "イロハニホヘト チ/*リヌルヲ ワカヨタ*/レソ ツネナラム\n" + "ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン\n" + "\n" + "Right-to-left script does not work yet:\n" + "? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה\n" + "\n" + "// いろはにほへと ちりぬるを わかよ\n" + "/* たれそ つねならむ うゐのおくやま */\n" + "けふこえて あさきゆめみし ゑひも\n" + "せす\n\n" + "Even colours and [sweet perfume] / Will eventually fade /\n" + "Even our world / Is not eternal /\n" + "The deep mountains of vanity / Cross them today /\n" + "And superficial dreams / Shall no longer delude you.\n" + "(from Iroha-uta)" + ); style_init(); Fl_Window* window = new_view(); |
