summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Costantini <fabien@onepost.net>2008-11-06 22:36:01 +0000
committerFabien Costantini <fabien@onepost.net>2008-11-06 22:36:01 +0000
commit8878c68256cdb7bf899aefaf0ef3f8057005f298 (patch)
tree4322cd71f1e681f226bcf9f5d03fda93fa62bab6
parenta6def7d9de2366fca40848a4065e403711a00616 (diff)
Doxygenized fl_expand_text() comment, more minor code comment and debug printf cleanup.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6501 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/fl_draw.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx
index cf4c37761..2737e42eb 100644
--- a/src/fl_draw.cxx
+++ b/src/fl_draw.cxx
@@ -48,21 +48,14 @@ char fl_draw_shortcut; // set by fl_labeltypes.cxx
static char* underline_at;
-// Copy p to buf, replacing unprintable characters with ^X and \nnn
-// Stop at a newline or if MAXBUF characters written to buffer.
-// Also word-wrap if width exceeds maxw.
-// Returns a pointer to the start of the next line of caharcters.
-// Sets n to the number of characters put into the buffer.
-// Sets width to the width of the string in the current font.
-
-#define C_IN(c,a,b) ((c)>=(a) && (c)<=(b))
-#define C_UTF8(c) C_IN(c,0x80,0xBF)
-
/**
utf8 multibyte char seq. detection an pass-thru routine.
\retval false if no utf8 seq detected, no change made. true if utf8 and d copied with s seq.
note that for n bytes copied dest incremented of n, but s of n-1 for compatible loop use see below.
*/
+#define C_IN(c,a,b) ((c)>=(a) && (c)<=(b))
+#define C_UTF8(c) C_IN(c,0x80,0xBF)
+
static bool handle_utf8_seq(const char * &s,char * &d) {
register const unsigned char* p=(const unsigned char*)s;
if (p[0] < 0xc2 || p[0] > 0xf4)
@@ -102,12 +95,20 @@ static bool handle_utf8_seq(const char * &s,char * &d) {
d+=4; s+=3;
// planes 16
} else { // non utf8 compliant, maybe CP125x or broken utf8 string
- fprintf(stderr, "Not UTF8 char \n");
+ // fprintf(stderr, "Not UTF8 char \n");
return false;
}
return true; // we did handled and copied the utf8 multibyte char seq.
}
+/**
+ Copy \a from to \a buf, replacing unprintable characters with ^X and \nnn
+ Stop at a newline or if MAXBUF characters written to buffer.
+ Also word-wrap if width exceeds maxw.
+ Returns a pointer to the start of the next line of caharcters.
+ Sets n to the number of characters put into the buffer.
+ Sets width to the width of the string in the current font.
+*/
const char*
fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n,
double &width, int wrap, int draw_symbols) {