|
|
commit d13f9e736c70225a1103e2b59adc975c9bdad73e
Author: Matthias Melcher <github@matthiasm.com>
AuthorDate: Fri Dec 17 20:28:47 2021 +0100
Commit: GitHub <noreply@github.com>
CommitDate: Fri Dec 17 20:28:47 2021 +0100
GitHub #233, documenting style buffers and utf8.
src/Fl_Text_Display.cxx | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git src/Fl_Text_Display.cxx src/Fl_Text_Display.cxx
index ac8a291..7cf1e6e 100644
--- src/Fl_Text_Display.cxx
+++ src/Fl_Text_Display.cxx
@@ -1,5 +1,5 @@
//
-// Copyright 2001-2020 by Bill Spitzak and others.
+// Copyright 2001-2021 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -393,7 +393,18 @@ void Fl_Text_Display::buffer( Fl_Text_Buffer *buf ) {
Style buffers, tables and their associated memory are managed by the caller.
Styles are ranged from 65 ('A') to 126.
-
+
+ \note Style information in the style buffer must have the same byte offset as
+ the corresponding character in the text buffer. UTF-8 characters can have a
+ length of four, in some cases even six bytes. Style information must take
+ this into account and fill the unused bytes with 0. See `fl_utf8len()`.
+
+ Text: "*g* r ü *n*" , where normal style is 'A', and bold is 'B'
+ \code
+ Text Buffer(hex): 67 72 c3 bc 6e : gr..n
+ Style Buffer(hex): 42 41 41 00 42 : BAA.B
+ \endcode
+
\param styleBuffer this buffer works in parallel to the text buffer. For every
character in the text buffer, the style buffer has a byte at the same offset
that contains an index into an array of possible styles.
[ Direct Link to Message ] | |
|
| |