diff options
| author | Ian MacArthur <imacarthur@gmail.com> | 2011-04-13 15:43:22 +0000 |
|---|---|---|
| committer | Ian MacArthur <imacarthur@gmail.com> | 2011-04-13 15:43:22 +0000 |
| commit | be6df55717c0c08aa333cc7b92f0e35380c32317 (patch) | |
| tree | 258013e24482a8ee6bef33e87723bcf35dbceeb7 /FL/fl_utf8.h | |
| parent | 639ee4fbabfdca75cc62fd943cda56ffd6f22fdb (diff) | |
More attempts to clean up WIN32 handling of UTF16 surrogate pairs.
In particular, I have added a new function to src/fl_utf.c called fl_ucs_to_Utf16() which
converts a single 32-bit Unicode value into one (or more) UTF16 cells.
This is needed in the win32 char-by-char text width() logic, and I suspect may also be useful in the OSX code in some places.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8585 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/fl_utf8.h')
| -rw-r--r-- | FL/fl_utf8.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/FL/fl_utf8.h b/FL/fl_utf8.h index 22f8ade0b..7258c921e 100644 --- a/FL/fl_utf8.h +++ b/FL/fl_utf8.h @@ -28,8 +28,6 @@ * with the functions provided in OksiD's fltk-1.1.6-utf8 port */ -/*** NOTE : all functions are LIMITED to 24 bits Unicode values !!! ***/ - /** \file fl_utf8.h \brief header for Unicode and UTF8 chracter handling @@ -99,16 +97,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); @@ -118,6 +116,9 @@ FL_EXPORT const char* fl_utf8fwd(const char* p, const char* start, const char* e /* F2: Move backward to the previous valid UTF8 sequence start */ FL_EXPORT const char* fl_utf8back(const char* p, const char* start, const char* end); +/* XX: Convert a single 32-bit Unicode value into UTF16 */ +FL_EXPORT unsigned fl_ucs_to_Utf16(const unsigned ucs, unsigned short *dst, const unsigned dstlen); + /* F2: Convert a UTF8 string into UTF16 */ FL_EXPORT unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short* dst, unsigned dstlen); |
