According to the FLTK 1.3.2 documentation:
Unicode support was only recently added to FLTK and is still incomplete.
However, the following are supposedly implemented:
It is important to note that the initial implementation of Unicode and UTF-8 in FLTK involves three important areas:
- provision of Unicode character tables and some simple related functions
- conversion of char* variables and function parameters from single byte per character representation to UTF-8 variable length
sequences- modifications to the display font interface to accept general Unicode character or UCS code numbers instead of just ASCII or Latin1 characters.
My question is, how do I actually display Unicode on my FLTK controls? I can't find any widget functions which accept Unicode. For example, this is the signature for the label
function:
void Fl_Widget::label ( const char * text )
From the link you posted:
FLTK will be entirely converted to Unicode using UTF-8 encoding. If a different encoding is required by the underlying operating system, FLTK will convert the string as needed.
The three bullet points you list are the areas that make up their implementation of Unicode support; That is, these are things they are doing or are planning to do.
My question is, how do I actually display Unicode on my FLTK controls? I can't find any widget functions which accept Unicode. For example, this is the signature for the label function:
void Fl_Widget::label ( const char * text )
There are many people that incorrectly use 'Unicode' to mean an encoding that uses 2-byte characters. The FLTK documentation you link to does not make this mistake. Understanding this, the documentation says quite clearly how you use Unicode with the above signature: You pass the Unicode data as a char* string using the UTF-8 encoding. For example if you're using a compiler that uses UTF-8 as the execution encoding:
widget.label("кошка 日本国");
Or if you have a C++11 compiler:
widget.label( u8"кошка 日本国");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With