FLTK logo

Re: [fltk/fltk] In Fl_Text_Display style should apply to UTF-8 characters. (#233)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] In Fl_Text_Display style should apply to UTF-8 characters. (#233) Albrecht Schlosser May 20, 2021  
 

FTR: to see that the style handling works in action, please load text with UTF-8 (i.e. non-ASCII) characters in the test/editor example program, for instance this pseudo C++ code:

#include <FL/Fl_Text_Display.H>
int main() {
  // Style table
  Fl_Text_Display::Style_Table_Entry stable[] = {
  // ...
  if (b€c and €) { // text with '€' note: 'and' in code should be highlighted
    printf("This string with € and Umlauts %s is fine\n", "äöüßÄÖÜ");
  } else { // another (incorrect) French comment: déjà vû §
    printf("Incorrect French with German Umlauts %s. Déjà vû \n", "äöüß");
  }
  // Style for text with 
  sbuff->text("AAAAAAAAAA\n ¢ £ ¤ ¥ \nCCCCCCCC\nDDDDDDDDDD\n");
  // still parses "return" fine:
  return(Fl::run());
}

You can add and remove text with or without non-ASCII characters and the style update works (except for some special cases that are different, i.e. non-UTF-8 issues). A better working (although harder to use) example would be to load such text into fluid in FLTK 1.4.x (git) which does the style parsing somewhat better.

Screenshot attached:

image


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.