summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Text_Buffer.H21
-rw-r--r--FL/fl_utf8.h7
2 files changed, 10 insertions, 18 deletions
diff --git a/FL/Fl_Text_Buffer.H b/FL/Fl_Text_Buffer.H
index 29ca2cd9d..3cc65da8d 100644
--- a/FL/Fl_Text_Buffer.H
+++ b/FL/Fl_Text_Buffer.H
@@ -34,7 +34,7 @@
#define FL_TEXT_BUFFER_H
-#define ASSERT_UTF8
+#undef ASSERT_UTF8
#ifdef ASSERT_UTF8
# include <assert.h>
@@ -47,22 +47,11 @@
/*
- Suggested UTF-8 terminology for this file:
-
- ?? "length" is the number of characters in a string
- ?? "size" is the number of bytes
- ?? "index" is the position in a string in number of characters
- ?? "offset" is the position in a string in bytes (and must be kept on a charater boundary)
- (there seems to be no standard in Uncode documents, howevere "length" is commonly
- referencing the number of bytes. Maybe "bytes" and "glyphs" would be the most
- obvious way to describe sizes?)
-
"character size" is the size of a UTF-8 character in bytes
- "character width" is the width of a Unicode character in pixels
-
- "column" was orginally defined as a character offset from the left margin. It was
- identical to the byte offset. In UTF-8, we have neither a byte offset nor
- truly fixed width fonts (*). Column could be a pixel value multiplied with
+ "character width" is the width of a Unicode character in pixels
+ "column" was orginally defined as a character offset from the left margin.
+ It was identical to the byte offset. In UTF-8, we have neither a byte offset
+ nor truly fixed width fonts (*). Column could be a pixel value multiplied with
an average character width (which is a bearable approximation).
* in Unicode, there are no fixed width fonts! Even if the ASCII characters may
diff --git a/FL/fl_utf8.h b/FL/fl_utf8.h
index fd54b3350..22f8ade0b 100644
--- a/FL/fl_utf8.h
+++ b/FL/fl_utf8.h
@@ -99,13 +99,16 @@ FL_EXPORT int fl_utf8bytes(unsigned ucs);
/* OD: returns the byte length of the first UTF-8 char sequence (returns -1 if not valid) */
FL_EXPORT int fl_utf8len(char c);
-
+
+/* OD: returns the byte length of the first UTF-8 char sequence (returns +1 if not valid) */
+FL_EXPORT int fl_utf8len1(char c);
+
/* OD: returns the number of Unicode chars in the UTF-8 string */
FL_EXPORT int fl_utf_nb_char(const unsigned char *buf, int len);
/* F2: Convert the next UTF8 char-sequence into a Unicode value (and say how many bytes were used) */
FL_EXPORT unsigned fl_utf8decode(const char* p, const char* end, int* len);
-
+
/* F2: Encode a Unicode value into a UTF8 sequence, return the number of bytes used */
FL_EXPORT int fl_utf8encode(unsigned ucs, char* buf);