diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-04-05 12:45:03 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-04-05 12:45:03 +0000 |
| commit | f2fa59fd0f9119cc592c191431743d3291ee46f8 (patch) | |
| tree | d7a418afc91b2c03d57cc236f37e73fc3711a970 /src/Fl_Text_Display.cxx | |
| parent | dcdc4439cc1935c1c796da9007c9369f81b10206 (diff) | |
Starting to clean up and document Fl_Text_... to acheive UTF-8 support.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7428 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Text_Display.cxx')
| -rw-r--r-- | src/Fl_Text_Display.cxx | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 4a9817998..d5380c3c3 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -223,133 +223,9 @@ void Fl_Text_Display::highlight_data(Fl_Text_Buffer *styleBuffer, mHighlightCBArg = cbArg; mStyleBuffer->canUndo(0); -#if 0 - // FIXME: this is in nedit code -- is it needed? - /* Call TextDSetFont to combine font information from style table and - primary font, adjust font-related parameters, and then redisplay */ - TextDSetFont(textD, textD->fontStruct); -#endif damage(FL_DAMAGE_EXPOSE); } -#if 0 - // FIXME: this is in nedit code -- is it needed? -/** - Change the (non highlight) font -*/ -void TextDSetFont(textDisp *textD, XFontStruct *fontStruct) { - Display *display = XtDisplay(textD->w); - int i, maxAscent = fontStruct->ascent, maxDescent = fontStruct->descent; - int width, height, fontWidth; - Pixel bgPixel, fgPixel, selectFGPixel, selectBGPixel; - Pixel highlightFGPixel, highlightBGPixel; - XGCValues values; - XFontStruct *styleFont; - - /* If font size changes, cursor will be redrawn in a new position */ - blankCursorProtrusions(textD); - - /* If there is a (syntax highlighting) style table in use, find the new - maximum font height for this text display */ - for (i=0; i<textD->nStyles; i++) { - styleFont = textD->styleTable[i].font; - if (styleFont != NULL && styleFont->ascent > maxAscent) - maxAscent = styleFont->ascent; - if (styleFont != NULL && styleFont->descent > maxDescent) - maxDescent = styleFont->descent; - } - textD->ascent = maxAscent; - textD->descent = maxDescent; - - /* If all of the current fonts are fixed and match in width, compute */ - fontWidth = fontStruct->max_bounds.width; - if (fontWidth != fontStruct->min_bounds.width) - fontWidth = -1; - else { - for (i=0; i<textD->nStyles; i++) { - styleFont = textD->styleTable[i].font; - if (styleFont != NULL && (styleFont->max_bounds.width != fontWidth || - styleFont->max_bounds.width != styleFont->min_bounds.width)) - fontWidth = -1; - } - } - textD->fixedFontWidth = fontWidth; - - /* Don't let the height dip below one line, or bad things can happen */ - if (textD->height < maxAscent + maxDescent) - textD->height = maxAscent + maxDescent; - - /* Change the font. In most cases, this means re-allocating the - affected GCs (they are shared with other widgets, and if the primary - font changes, must be re-allocated to change it). Unfortunately, - this requres recovering all of the colors from the existing GCs */ - textD->fontStruct = fontStruct; - XGetGCValues(display, textD->gc, GCForeground|GCBackground, &values); - fgPixel = values.foreground; - bgPixel = values.background; - XGetGCValues(display, textD->selectGC, GCForeground|GCBackground, &values); - selectFGPixel = values.foreground; - selectBGPixel = values.background; - XGetGCValues(display, textD->highlightGC,GCForeground|GCBackground,&values); - highlightFGPixel = values.foreground; - highlightBGPixel = values.background; - releaseGC(textD->w, textD->gc); - releaseGC(textD->w, textD->selectGC); - releaseGC(textD->w, textD->highlightGC); - releaseGC(textD->w, textD->selectBGGC); - releaseGC(textD->w, textD->highlightBGGC); - if (textD->lineNumGC != NULL) - releaseGC(textD->w, textD->lineNumGC); - textD->lineNumGC = NULL; - allocateFixedFontGCs(textD, fontStruct, bgPixel, fgPixel, selectFGPixel, - selectBGPixel, highlightFGPixel, highlightBGPixel); - XSetFont(display, textD->styleGC, fontStruct->fid); - - /* Do a full resize to force recalculation of font related parameters */ - width = textD->width; - height = textD->height; - textD->width = textD->height = 0; - TextDResize(textD, width, height); - - /* Redisplay */ - TextDRedisplayRect(textD, textD->left, textD->top, textD->width, - textD->height); - - /* Clean up line number area in case spacing has changed */ - draw_line_numbers(textD, True); -} - -int TextDMinFontWidth(textDisp *textD, Boolean considerStyles) { - int fontWidth = textD->fontStruct->max_bounds.width; - int i; - - if (considerStyles) { - for (i = 0; i < textD->nStyles; ++i) { - int thisWidth = (textD->styleTable[i].font)->min_bounds.width; - if (thisWidth < fontWidth) { - fontWidth = thisWidth; - } - } - } - return(fontWidth); -} - -int TextDMaxFontWidth(textDisp *textD, Boolean considerStyles) { - int fontWidth = textD->fontStruct->max_bounds.width; - int i; - - if (considerStyles) { - for (i = 0; i < textD->nStyles; ++i) { - int thisWidth = (textD->styleTable[i].font)->max_bounds.width; - if (thisWidth > fontWidth) { - fontWidth = thisWidth; - } - } - } - return(fontWidth); -} -#endif - int Fl_Text_Display::longest_vline() const { int longest = 0; for (int i = 0; i < mNVisibleLines; i++) |
