You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

729 lines
18KB

  1. //
  2. // "$Id: utf8.cxx 8629 2011-05-01 12:24:22Z ianmacarthur $"
  3. //
  4. // UTF-8 test program for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 by Bill Spitzak and others.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems on the following page:
  24. //
  25. // http://www.fltk.org/str.php
  26. //
  27. #include <FL/Fl.H>
  28. #include <FL/Fl_Double_Window.H>
  29. #include <FL/Fl_Scroll.H>
  30. #include <FL/Fl_Choice.H>
  31. #include <FL/Fl_Input.H>
  32. #include <FL/Fl_Box.H>
  33. #include <FL/Fl_Tile.H>
  34. #include <FL/Fl_Hold_Browser.H>
  35. #include <FL/Fl_Value_Output.H>
  36. #include <FL/Fl_Button.H>
  37. #include <FL/Fl_Check_Button.H>
  38. #include <FL/Fl_Output.H>
  39. #include <FL/fl_draw.H>
  40. #include <FL/fl_utf8.h>
  41. #include <stdio.h>
  42. #include <stdlib.h>
  43. #include <string.h>
  44. #include <math.h>
  45. //
  46. // Font chooser widget for the Fast Light Tool Kit(FLTK).
  47. //
  48. #define DEF_SIZE 16 // default value for the font size picker
  49. static Fl_Double_Window *fnt_chooser_win;
  50. static Fl_Hold_Browser *fontobj;
  51. static Fl_Hold_Browser *sizeobj;
  52. static Fl_Value_Output *fnt_cnt;
  53. static Fl_Button *refresh_btn;
  54. static Fl_Button *choose_btn;
  55. static Fl_Output *fix_prop;
  56. static Fl_Check_Button *own_face;
  57. static int **sizes = NULL;
  58. static int *numsizes = NULL;
  59. static int pickedsize = DEF_SIZE;
  60. static char label[1000];
  61. static Fl_Double_Window *main_win;
  62. static Fl_Scroll *thescroll;
  63. static Fl_Font extra_font;
  64. static int font_count = 0;
  65. static int first_free = 0;
  66. static void cb_exit(Fl_Button*, void*) {
  67. if(fnt_chooser_win) fnt_chooser_win->hide();
  68. if(main_win) main_win->hide();
  69. } /* cb_exit */
  70. /*
  71. Class for displaying sample fonts.
  72. */
  73. class FontDisplay : public Fl_Widget
  74. {
  75. void draw(void);
  76. public:
  77. int font, size;
  78. int test_fixed_pitch(void);
  79. FontDisplay(Fl_Boxtype B, int X, int Y, int W, int H, const char *L = 0)
  80. : Fl_Widget(X, Y, W, H, L)
  81. {
  82. box(B);
  83. font = 0;
  84. size = DEF_SIZE;
  85. }
  86. };
  87. /*
  88. Draw the sample text.
  89. */
  90. void FontDisplay::draw(void)
  91. {
  92. draw_box();
  93. fl_font((Fl_Font)font, size);
  94. fl_color(FL_BLACK);
  95. fl_draw(label(), x() + 3, y() + 3, w() - 6, h() - 6, align());
  96. }
  97. int FontDisplay::test_fixed_pitch(void)
  98. {
  99. int w1, w2;
  100. int h1, h2;
  101. w1 = w2 = 0;
  102. h1 = h2 = 0;
  103. fl_font((Fl_Font)font, size);
  104. fl_measure("MHMHWWMHMHMHM###WWX__--HUW", w1, h1, 0);
  105. fl_measure("iiiiiiiiiiiiiiiiiiiiiiiiii", w2, h2, 0);
  106. if (w1 == w2) return 1; // exact match - fixed pitch
  107. // Is the font "nearly" fixed pitch? If it is within 5%, say it is...
  108. double f1 = (double)w1;
  109. double f2 = (double)w2;
  110. double delta = fabs(f1 - f2) * 5.0;
  111. if (delta <= f1) return 2; // nearly fixed pitch...
  112. return 0; // NOT fixed pitch
  113. }
  114. static FontDisplay *textobj;
  115. static void size_cb(Fl_Widget *, long)
  116. {
  117. int size_idx = sizeobj->value();
  118. if (!size_idx) return;
  119. const char *c = sizeobj->text(size_idx);
  120. while (*c < '0' || *c > '9') c++; // find the first numeric char
  121. pickedsize = atoi(c); // convert the number string to a value
  122. // Now set the font view to the selected size and redraw it.
  123. textobj->size = pickedsize;
  124. textobj->redraw();
  125. }
  126. static void font_cb(Fl_Widget *, long)
  127. {
  128. int font_idx = fontobj->value() + first_free;
  129. if (!font_idx) return;
  130. font_idx--;
  131. textobj->font = font_idx;
  132. sizeobj->clear();
  133. int size_count = numsizes[font_idx-first_free];
  134. int *size_array = sizes[font_idx-first_free];
  135. if (!size_count)
  136. {
  137. // no preferred sizes - probably TT fonts etc...
  138. }
  139. else if (size_array[0] == 0)
  140. {
  141. // many sizes, probably a scaleable font with preferred sizes
  142. int j = 1;
  143. for (int i = 1; i <= 64 || i < size_array[size_count - 1]; i++)
  144. {
  145. char buf[16];
  146. if (j < size_count && i == size_array[j])
  147. {
  148. sprintf(buf, "@b%d", i);
  149. j++;
  150. }
  151. else
  152. sprintf(buf, "%d", i);
  153. sizeobj->add(buf);
  154. }
  155. sizeobj->value(pickedsize);
  156. }
  157. else
  158. {
  159. // some sizes, probably a font with a few fixed sizes available
  160. int w = 0;
  161. for (int i = 0; i < size_count; i++)
  162. {
  163. // find the nearest available size to the current picked size
  164. if (size_array[i] <= pickedsize) w = i;
  165. char buf[16];
  166. sprintf(buf, "@b%d", size_array[i]);
  167. sizeobj->add(buf);
  168. }
  169. sizeobj->value(w + 1);
  170. }
  171. size_cb(sizeobj, 0); // force selection of nearest valid size, then redraw
  172. // Now check to see if the font looks like a fixed pitch font or not...
  173. int looks_fixed = textobj->test_fixed_pitch();
  174. if(looks_fixed)
  175. {
  176. if (looks_fixed > 1)
  177. fix_prop->value("near");
  178. else
  179. fix_prop->value("fixed");
  180. }
  181. else
  182. {
  183. fix_prop->value("prop");
  184. }
  185. }
  186. static void choose_cb(Fl_Widget *, long)
  187. {
  188. int font_idx = fontobj->value() + first_free;
  189. if (!font_idx)
  190. {
  191. puts("No font chosen");
  192. }
  193. else
  194. {
  195. int font_type;
  196. font_idx -= 1;
  197. const char *name = Fl::get_font_name((Fl_Font)font_idx, &font_type);
  198. printf("idx %d\nUser name :%s:\n", font_idx, name);
  199. printf("FLTK name :%s:\n", Fl::get_font((Fl_Font)font_idx));
  200. Fl::set_font(extra_font, (Fl_Font)font_idx);
  201. // Fl::set_font(extra_font, Fl::get_font((Fl_Font)font_idx));
  202. }
  203. int size_idx = sizeobj->value();
  204. if (!size_idx)
  205. {
  206. puts("No size selected");
  207. }
  208. else
  209. {
  210. const char *c = sizeobj->text(size_idx);
  211. while (*c < '0' || *c > '9') c++; // find the first numeric char
  212. int pickedsize = atoi(c); // convert the number string to a value
  213. printf("size %d\n\n", pickedsize);
  214. }
  215. fflush(stdout);
  216. main_win->redraw();
  217. }
  218. static void refresh_cb(Fl_Widget *, long)
  219. {
  220. main_win->redraw();
  221. }
  222. static void own_face_cb(Fl_Widget *, void *)
  223. {
  224. int font_idx;
  225. int cursor_restore = 0;
  226. static int i_was = -1; // used to keep track of where we were in the list...
  227. if (i_was < 0) { // not been here before
  228. i_was = 1;
  229. } else {
  230. i_was = fontobj->topline(); // record which was the topmost visible line
  231. fontobj->clear();
  232. // Populating the font widget can be slower than an old dog with three legs
  233. // on a bad day, show a wait cursor
  234. fnt_chooser_win->cursor(FL_CURSOR_WAIT);
  235. cursor_restore = 1;
  236. }
  237. // Populate the font list with the names of the fonts found
  238. for (font_idx = first_free; font_idx < font_count; font_idx++)
  239. {
  240. int font_type;
  241. const char *name = Fl::get_font_name((Fl_Font)font_idx, &font_type);
  242. char buffer[128];
  243. if(own_face->value() == 0) {
  244. char *p = buffer;
  245. // if the font is BOLD, set the bold attribute in the list
  246. if (font_type & FL_BOLD) {
  247. *p++ = '@';
  248. *p++ = 'b';
  249. }
  250. if (font_type & FL_ITALIC) { // ditto for italic fonts
  251. *p++ = '@';
  252. *p++ = 'i';
  253. }
  254. // Suppress subsequent formatting - some MS fonts have '@' in their name
  255. *p++ = '@';
  256. *p++ = '.';
  257. strcpy(p, name);
  258. } else {
  259. // Show font in its own face
  260. // this is neat, but really slow on some systems:
  261. // uses each font to display its own name
  262. sprintf (buffer, "@F%d@.%s", font_idx, name);
  263. }
  264. fontobj->add(buffer);
  265. }
  266. // now put the browser position back the way it was... more or less
  267. fontobj->topline(i_was);
  268. // restore the cursor
  269. if(cursor_restore) fnt_chooser_win->cursor(FL_CURSOR_DEFAULT);
  270. }
  271. static void create_font_widget()
  272. {
  273. // Create the font sample label
  274. strcpy(label, "Font Sample\n");
  275. int i = 12; // strlen(label);
  276. int n = 0;
  277. ulong c;
  278. for (c = ' '+1; c < 127; c++) {
  279. if (!(c&0x1f)) label[i++]='\n';
  280. if (c=='@') label[i++]=c;
  281. label[i++]=c;
  282. }
  283. label[i++] = '\n';
  284. for (c = 0xA1; c < 0x600; c += 9) {
  285. if (!(++n&(0x1f))) label[i++]='\n';
  286. i += fl_utf8encode((unsigned int)c, label + i);
  287. }
  288. label[i] = 0;
  289. // Create the window layout
  290. fnt_chooser_win = new Fl_Double_Window(380, 420, "Font Selector");
  291. {
  292. Fl_Tile *tile = new Fl_Tile(0, 0, 380, 420);
  293. {
  294. Fl_Group *textgroup = new Fl_Group(0, 0, 380, 105);
  295. {
  296. textobj = new FontDisplay(FL_FRAME_BOX, 10, 10, 360, 90, label);
  297. textobj->align(FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
  298. textobj->color(53, 3);
  299. textgroup->box(FL_FLAT_BOX);
  300. textgroup->resizable(textobj);
  301. textgroup->end();
  302. }
  303. Fl_Group *fontgroup = new Fl_Group(0, 105, 380, 315);
  304. {
  305. fontobj = new Fl_Hold_Browser(10, 110, 290, 270);
  306. fontobj->box(FL_FRAME_BOX);
  307. fontobj->color(53, 3);
  308. fontobj->callback(font_cb);
  309. fnt_chooser_win->resizable(fontobj);
  310. sizeobj = new Fl_Hold_Browser(310, 110, 60, 270);
  311. sizeobj->box(FL_FRAME_BOX);
  312. sizeobj->color(53, 3);
  313. sizeobj->callback(size_cb);
  314. // Create the status bar
  315. Fl_Group *stat_bar = new Fl_Group (10, 385, 380, 30);
  316. {
  317. fnt_cnt = new Fl_Value_Output(10, 390, 40, 20);
  318. fnt_cnt->label("fonts");
  319. fnt_cnt->align(FL_ALIGN_RIGHT);
  320. fix_prop = new Fl_Output(100, 390, 40, 20);
  321. fix_prop->color(FL_BACKGROUND_COLOR);
  322. fix_prop->value("prop");
  323. fix_prop->clear_visible_focus();
  324. own_face = new Fl_Check_Button(150, 390, 40, 20, "Self");
  325. own_face->value(0);
  326. own_face->type(FL_TOGGLE_BUTTON);
  327. own_face->clear_visible_focus();
  328. own_face->callback(own_face_cb);
  329. own_face->tooltip("Display font names in their own face");
  330. Fl_Box * dummy = new Fl_Box(220, 390, 1, 1);
  331. choose_btn = new Fl_Button(240, 385, 60, 30);
  332. choose_btn->label("Select");
  333. choose_btn->callback(choose_cb);
  334. refresh_btn = new Fl_Button(310, 385, 60, 30);
  335. refresh_btn->label("Refresh");
  336. refresh_btn->callback(refresh_cb);
  337. stat_bar->resizable (dummy);
  338. stat_bar->end();
  339. }
  340. fontgroup->box(FL_FLAT_BOX);
  341. fontgroup->resizable(fontobj);
  342. fontgroup->end();
  343. }
  344. tile->end();
  345. }
  346. fnt_chooser_win->resizable(tile);
  347. fnt_chooser_win->end();
  348. fnt_chooser_win->callback((Fl_Callback*)cb_exit);
  349. }
  350. }
  351. int make_font_chooser(void)
  352. {
  353. int font_idx;
  354. // create the widget frame
  355. create_font_widget();
  356. // Load the systems available fonts - ask for everything
  357. // font_count = Fl::set_fonts("*");
  358. #ifdef WIN32
  359. font_count = Fl::set_fonts("*");
  360. #elif __APPLE__
  361. font_count = Fl::set_fonts("*");
  362. #else
  363. // Load the systems available fonts - ask for everything that claims to be
  364. // iso10646 compatible
  365. font_count = Fl::set_fonts("-*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1");
  366. #endif
  367. // allocate space for the sizes and numsizes array, now we know how many
  368. // entries it needs
  369. sizes = new int*[font_count];
  370. numsizes = new int[font_count];
  371. // Populate the font list with the names of the fonts found
  372. first_free = FL_FREE_FONT;
  373. for (font_idx = first_free; font_idx < font_count; font_idx++)
  374. {
  375. // Find out how many sizes are supported for each font face
  376. int *size_array;
  377. int size_count = Fl::get_font_sizes((Fl_Font)font_idx, size_array);
  378. numsizes[font_idx-first_free] = size_count;
  379. // if the font has multiple sizes, populate the 2-D sizes array
  380. if (size_count)
  381. {
  382. sizes[font_idx-first_free] = new int[size_count];
  383. for (int j = 0; j < size_count; j++)
  384. sizes[font_idx-first_free][j] = size_array[j];
  385. }
  386. } // end of font list filling loop
  387. // Call this once to get the font browser loaded up
  388. own_face_cb(NULL, 0);
  389. fontobj->value(1);
  390. // optional hard-coded font for testing - do not use!
  391. // fontobj->textfont(261);
  392. font_cb(fontobj, 0);
  393. fnt_cnt->value(font_count);
  394. return font_count;
  395. } // make_font_chooser
  396. /* End of Font Chooser Widget code */
  397. /* Unicode Font display widget */
  398. void box_cb(Fl_Widget* o, void*) {
  399. thescroll->box(((Fl_Button*)o)->value() ? FL_DOWN_FRAME : FL_NO_BOX);
  400. thescroll->redraw();
  401. }
  402. class right_left_input : public Fl_Input
  403. {
  404. public:
  405. right_left_input (int x, int y, int w, int h) : Fl_Input(x, y, w, h) {};
  406. void draw() {
  407. if (type() == FL_HIDDEN_INPUT) return;
  408. Fl_Boxtype b = box();
  409. if (damage() & FL_DAMAGE_ALL) draw_box(b, color());
  410. drawtext(x()+Fl::box_dx(b)+3, y()+Fl::box_dy(b),
  411. w()-Fl::box_dw(b)-6, h()-Fl::box_dh(b));
  412. }
  413. void drawtext(int X, int Y, int W, int H) {
  414. fl_color(textcolor());
  415. fl_font(textfont(), textsize());
  416. fl_rtl_draw(value(), strlen(value()),
  417. X + W, Y + fl_height() -fl_descent());
  418. }
  419. };
  420. void i7_cb(Fl_Widget *w, void *d)
  421. {
  422. int i = 0;
  423. char nb[] = "01234567";
  424. Fl_Input *i7 = (Fl_Input*)w;
  425. Fl_Input *i8 = (Fl_Input*)d;
  426. static char buf[1024];
  427. const char *ptr = i7->value();
  428. while (ptr && *ptr) {
  429. if (*ptr < ' ' || *ptr > 126) {
  430. buf[i++] = '\\';
  431. buf[i++] = nb[((*ptr >> 6) & 0x3)];
  432. buf[i++] = nb[((*ptr >> 3) & 0x7)];
  433. buf[i++] = nb[(*ptr & 0x7)];
  434. } else {
  435. if (*ptr == '\\') buf[i++] = '\\';
  436. buf[i++] = *ptr;
  437. }
  438. ptr++;
  439. }
  440. buf[i] = 0;
  441. i8->value(buf);
  442. }
  443. class UCharDropBox : public Fl_Output {
  444. public:
  445. UCharDropBox(int x, int y, int w, int h, const char *label=0) :
  446. Fl_Output(x, y, w, h, label) { }
  447. int handle(int event) {
  448. switch (event) {
  449. case FL_DND_ENTER: return 1;
  450. case FL_DND_DRAG: return 1;
  451. case FL_DND_RELEASE: return 1;
  452. case FL_PASTE:
  453. {
  454. static const char lut[] = "0123456789abcdef";
  455. const char *t = Fl::event_text();
  456. int i, n;
  457. unsigned int ucode = fl_utf8decode(t, t+Fl::event_length(), &n);
  458. if (n==0) {
  459. value("");
  460. return 1;
  461. }
  462. char buffer[200], *d = buffer;
  463. for (i=0; i<n; i++) *d++ = t[i];
  464. *d++ = ' ';
  465. for (i=0; i<n; i++) {
  466. *d++ = '\\'; *d++ = 'x';
  467. *d++ = lut[(t[i]>>4)&0x0f]; *d++ = lut[t[i]&0x0f];
  468. }
  469. *d++ = ' ';
  470. *d++ = '0';
  471. *d++ = 'x';
  472. *d++ = lut[(ucode>>20)&0x0f]; *d++ = lut[(ucode>>16)&0x0f];
  473. *d++ = lut[(ucode>>12)&0x0f]; *d++ = lut[(ucode>>8)&0x0f];
  474. *d++ = lut[(ucode>>4)&0x0f]; *d++ = lut[ucode&0x0f];
  475. *d++ = 0;
  476. value(buffer);
  477. }
  478. return 1;
  479. }
  480. return Fl_Output::handle(event);
  481. }
  482. };
  483. int main(int argc, char** argv)
  484. {
  485. int l;
  486. const char *latin1 =
  487. "\x41\x42\x43\x61\x62\x63\xe0\xe8\xe9\xef\xe2\xee\xf6\xfc\xe3\x31\x32\x33";
  488. char *utf8 = (char*) malloc(strlen(latin1) * 5 + 1);
  489. l = 0;
  490. // l = fl_latin12utf((const unsigned char*)latin1, strlen(latin1), utf8);
  491. l = fl_utf8froma(utf8, (strlen(latin1) * 5 + 1), latin1, strlen(latin1));
  492. make_font_chooser();
  493. extra_font = FL_TIMES_BOLD_ITALIC;
  494. /* setup the extra font */
  495. Fl::set_font(extra_font,
  496. #ifdef WIN32
  497. " Arial Unicode MS"
  498. #elif __APPLE__
  499. "Monaco"
  500. #else
  501. "-*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1"
  502. #endif
  503. );
  504. main_win = new Fl_Double_Window (200 + 5*75, 400, "Unicode Display Test");
  505. main_win->begin();
  506. Fl_Input i1(5, 5, 190, 25);
  507. utf8[l] = '\0';
  508. i1.value(utf8);
  509. Fl_Scroll scroll(200,0,5 * 75,400);
  510. int off = 2;
  511. int end_list = 0x10000 / 16;
  512. if (argc > 1) {
  513. off = (int)strtoul(argv[1], NULL, 0);
  514. end_list = off + 0x10000;
  515. off /= 16;
  516. end_list /= 16;
  517. }
  518. argc = 1;
  519. for (long y = off; y < end_list; y++) {
  520. int o = 0;
  521. char bu[25]; // index label
  522. char buf[16 * 6]; // utf8 text
  523. int i = 16 * y;
  524. for (int x = 0; x < 16; x++) {
  525. int l;
  526. l = fl_utf8encode(i, buf + o);
  527. if (l < 1) l = 1;
  528. o += l;
  529. i++;
  530. }
  531. buf[o] = '\0';
  532. sprintf(bu, "0x%06lX", y * 16);
  533. Fl_Input *b = new Fl_Input(200,(y-off)*25,80,25);
  534. b->textfont(FL_COURIER);
  535. b->value(strdup(bu));
  536. b = new Fl_Input(280,(y-off)*25,380,25);
  537. b->textfont(extra_font);
  538. b->value(strdup(buf));
  539. }
  540. scroll.end();
  541. main_win->resizable(scroll);
  542. thescroll = &scroll;
  543. char *utf8l = (char*) malloc(strlen(utf8) * 3 + 1);
  544. Fl_Input i2(5, 35, 190, 25);
  545. l = fl_utf_tolower((const unsigned char*)utf8, l, utf8l);
  546. utf8l[l] = '\0';
  547. i2.value(utf8l);
  548. char *utf8u = (char*) malloc(strlen(utf8l) * 3 + 1);
  549. Fl_Input i3(5, 65, 190, 25);
  550. l = fl_utf_toupper((const unsigned char*)utf8l, l, utf8u);
  551. utf8u[l] = '\0';
  552. i3.value(utf8u);
  553. const char *ltr_txt = "\\->e\xCC\x82=\xC3\xAA";
  554. Fl_Input i4(5, 90, 190, 25);
  555. i4.value(ltr_txt);
  556. i4.textfont(extra_font);
  557. wchar_t r_to_l_txt[] = {/*8238,*/
  558. 1610, 1608, 1606, 1604, 1603, 1608, 1583, 0};
  559. char abuf[40];
  560. // l = fl_unicode2utf(r_to_l_txt, 8, abuf);
  561. l = fl_utf8fromwc(abuf, 40, r_to_l_txt, 8);
  562. abuf[l] = 0;
  563. right_left_input i5(5, 115, 190, 50);
  564. i5.textfont(extra_font);
  565. i5.textsize(30);
  566. i5.value(abuf);
  567. Fl_Input i7(5, 230, 190, 25);
  568. Fl_Input i8(5, 260, 190, 25);
  569. i7.callback(i7_cb, &i8);
  570. i7.textsize(20);
  571. i7.value(abuf);
  572. i7.when(FL_WHEN_CHANGED);
  573. wchar_t r_to_l_txt1[] = { /*8238,*/
  574. 1610, 0x20, 1608, 0x20, 1606, 0x20,
  575. 1604, 0x20, 1603, 0x20, 1608, 0x20, 1583, 0};
  576. // l = fl_unicode2utf(r_to_l_txt1, 14, abuf);
  577. l = fl_utf8fromwc(abuf, 40, r_to_l_txt1, 14);
  578. abuf[l] = 0;
  579. right_left_input i6(5, 175, 190, 50);
  580. i6.textfont(extra_font);
  581. i6.textsize(30);
  582. i6.value(abuf);
  583. // Now try Greg Ercolano's Japanese test sequence
  584. // SOME JAPANESE UTF-8 TEXT
  585. const char *utfstr =
  586. "\xe4\xbd\x95\xe3\x82\x82\xe8\xa1"
  587. "\x8c\xe3\x82\x8b\xe3\x80\x82";
  588. UCharDropBox db(5, 300, 190, 30);
  589. db.textsize(16);
  590. db.value("unichar drop box");
  591. Fl_Output o9(5, 330, 190, 45);
  592. o9.textfont(extra_font);
  593. o9.textsize(30);
  594. o9.value(utfstr);
  595. main_win->end();
  596. main_win->callback((Fl_Callback*)cb_exit);
  597. fl_set_status(0, 370, 100, 30);
  598. main_win->show(argc,argv);
  599. fnt_chooser_win->show();
  600. int ret = Fl::run();
  601. // Free up the sizes arrays we allocated
  602. if(numsizes) {delete [] numsizes;}
  603. if(sizes) {delete [] sizes;}
  604. return ret;
  605. }
  606. //
  607. // End of "$Id: utf8.cxx 8629 2011-05-01 12:24:22Z ianmacarthur $".
  608. //