From 3f98f881568784448dc392780ee9be2ce94cfb50 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 3 Sep 2014 10:07:33 +0000 Subject: Remove unused code and trailing white space. The unused function was commented out about 6 months ago, see svn r 10123. No changes other than comments and white space. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10265 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_draw.cxx | 93 +++++++++++++-------------------------------------------- 1 file changed, 20 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index e3eeac43f..5cc41d78c 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -37,63 +37,10 @@ char fl_draw_shortcut; // set by fl_labeltypes.cxx static char* underline_at; -/* This function is no longer called - 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 d 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) - return false; // not adressed in this function - else if ( C_IN(p[0], 0xc2, 0xdf) && C_UTF8(p[1]) ) { - d[0]=s[0]; d[1]=s[1]; - d+=2; s++; - // non-overlong 2-byte - } - else if ( p[0]==0xe0 && C_IN(p[1], 0xa0, 0xbf) && C_UTF8(p[2]) ) { - d[0]=s[0]; d[1]=s[1];d[2]=s[2]; - d+=3; s+=2; - // excluding overlongs - } - else if (p[0]==0xed && C_IN(p[1], 0x80, 0x9f) && C_UTF8(p[2]) ) { - d[0]=s[0]; d[1]=s[1];d[2]=s[2]; - d+=3; s+=2; - // excluding surrogates - } - else if (p[0]!=0xed && C_IN(p[0], 0xe1, 0xef) && C_UTF8(p[1]) && C_UTF8(p[2]) ) { - d[0]=s[0]; d[1]=s[1];d[2]=s[2]; - d+=3; s+=2; - // straight 3-byte - } - else if (p[0]==0xf0 && C_IN(p[1], 0x90, 0xbf) && C_UTF8(p[2]) && C_UTF8(p[3]) ) { - d[0]=s[0]; d[1]=s[1]; d[2]=s[2]; d[3]=s[3]; - d+=4; s+=3; - // planes 1-3 - } - else if (C_IN(p[0], 0xf1, 0xf3) && C_UTF8(p[1]) && C_UTF8(p[2]) && C_UTF8(p[3]) ) { - d[0]=s[0]; d[1]=s[1]; d[2]=s[2]; d[3]=s[3]; - d+=4; s+=3; - // planes 4-15 - } - else if (p[0]==0xf4 && C_IN(p[1], 0x80, 0x8f) && C_UTF8(p[2]) && C_UTF8(p[3]) ) { - d[0]=s[0]; d[1]=s[1]; d[2]=s[2]; d[3]=s[3]; - d+=4; s+=3; - // planes 16 - } else { // non utf8 compliant, maybe CP125x or broken utf8 string - // fprintf(stderr, "Not UTF8 char \n"); - return false; - } - return true; // we handled and copied the utf8 multibyte char seq. -}*/ - /* If called with maxbuf==0, use an internally allocated buffer and enlarge it as needed. Otherwise, use buf as buffer but don't go beyond its length of maxbuf. */ -static const char* expand_text_(const char* from, char*& buf, int maxbuf, double maxw, int& n, +static const char* expand_text_(const char* from, char*& buf, int maxbuf, double maxw, int& n, double &width, int wrap, int draw_symbols) { char* e = buf+(maxbuf-4); underline_at = 0; @@ -141,7 +88,7 @@ static const char* expand_text_(const char* from, char*& buf, int maxbuf, double } if (c == '\t') { - for (c = fl_utf_nb_char((uchar*)buf, (int) (o-buf) )%8; c<8 && ow() : 0; - + int strw = 0; int strh; if (str) { for (p = str, lines=0; p;) { - e = expand_text_(p, linebuf, 0, w - symtotal - imgtotal, buflen, width, + e = expand_text_(p, linebuf, 0, w - symtotal - imgtotal, buflen, width, align&FL_ALIGN_WRAP, draw_symbols); if (strwh() - 1) / 2; img->draw(xpos, yimg); } - + // now draw all the lines: if (str) { int desc = fl_descent(); for (p=str; ; ypos += height) { - if (lines>1) e = expand_text_(p, linebuf, 0, w - symtotal - imgtotal, buflen, + if (lines>1) e = expand_text_(p, linebuf, 0, w - symtotal - imgtotal, buflen, width, align&FL_ALIGN_WRAP, draw_symbols); else e = ""; @@ -395,10 +342,10 @@ void fl_draw( { if ((!str || !*str) && !img) return; if (w && h && !fl_not_clipped(x, y, w, h) && (align & FL_ALIGN_INSIDE)) return; - if (align & FL_ALIGN_CLIP) + if (align & FL_ALIGN_CLIP) fl_push_clip(x, y, w, h); fl_draw(str, x, y, w, h, align, fl_draw, img, draw_symbols); - if (align & FL_ALIGN_CLIP) + if (align & FL_ALIGN_CLIP) fl_pop_clip(); } @@ -406,7 +353,7 @@ void fl_draw( Measure how wide and tall the string will be when printed by the fl_draw() function with \p align parameter. If the incoming \p w is non-zero it will wrap to that width. - + The 'current font' is used to do the width/height calculations, so unless its value is known at the time fl_measure() is called, it is advised to first set the current font with fl_font(). @@ -457,10 +404,10 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) { } symtotal = symwidth[0] + symwidth[1]; - + for (p = str, lines=0; p;) { // e = expand(p, linebuf, w - symtotal, buflen, width, w != 0, draw_symbols); - e = expand_text_(p, linebuf, 0, w - symtotal, buflen, width, + e = expand_text_(p, linebuf, 0, w - symtotal, buflen, width, w != 0, draw_symbols); if ((int)ceil(width) > W) W = (int)ceil(width); lines++; @@ -485,13 +432,13 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) { but with the advent of XFT, there are (currently) complexities that seem to only be solved by asking the font what its actual font height is. (See STR#2115) - + This function was originally undocumented in 1.1.x, and was used only by Fl_Text_Display. We're now documenting it in 1.3.x so that apps that need precise height info can get it with this function. \returns the height of the font in pixels. - + \todo In the future, when the XFT issues are resolved, this function should simply return the 'size' value. */ -- cgit v1.2.3