diff options
Diffstat (limited to 'src/bltGrText.C')
-rw-r--r-- | src/bltGrText.C | 265 |
1 files changed, 0 insertions, 265 deletions
diff --git a/src/bltGrText.C b/src/bltGrText.C index 0b7582c..7b974fc 100644 --- a/src/bltGrText.C +++ b/src/bltGrText.C @@ -448,83 +448,6 @@ Blt_AnchorPoint( /* *--------------------------------------------------------------------------- * - * Blt_MeasureText -- - * - * Draw a string of characters on the screen. Blt_DrawChars() - * expands control characters that occur in the string to - * \xNN sequences. - * - * Results: - * None. - * - * Side effects: - * Information gets drawn on the screen. - * - *--------------------------------------------------------------------------- - */ -int -Blt_MeasureText( - Blt_Font font, /* Font in which characters will be drawn; - * must be the same as font used in GC. */ - const char *text, /* UTF-8 string to be displayed. Need not be - * '\0' terminated. All Tk meta-characters - * (tabs, control characters, and newlines) - * should be stripped out of the string that - * is passed to this function. If they are - * not stripped out, they will be displayed as - * regular printing characters. */ - int textLen, /* # of bytes to draw in text string. */ - int maxLength, - int *countPtr) -{ - int elWidth; - const char *s, *send; - int accum, count, threshold; - int nBytes; - - if (maxLength < 0) { - if (countPtr != NULL) { - nBytes = textLen; - } - return Blt_TextWidth(font, text, textLen); - } - elWidth = Blt_TextWidth(font, "...", 3); - threshold = maxLength - elWidth; - if (threshold <= 0) { - return 0; - } -#if !HAVE_UTF - nBytes = 1; -#endif /* !HAVE_UTF */ - count = accum = 0; - for (s = text, send = s + textLen; s < send; s += nBytes) { -#if HAVE_UTF - Tcl_UniChar ch; -#endif /* HAVE_UTF */ - int w; -#if HAVE_UTF - nBytes = Tcl_UtfToUniChar (s, &ch); -#endif /* HAVE_UTF */ - w = Blt_TextWidth(font, s, nBytes); - if ((accum + w) > threshold) { - if (countPtr != NULL) { - *countPtr = count; - } - return accum + elWidth; - } - accum += w; - count += nBytes; - } - if (countPtr != NULL) { - *countPtr = count; - } - return accum; -} - - -/* - *--------------------------------------------------------------------------- - * * Blt_Ts_CreateLayout -- * * Get the extents of a possibly multiple-lined text string. @@ -806,29 +729,6 @@ Blt_Ts_Bitmap( return bitmap; } -void -Blt_Ts_SetDrawStyle( - TextStyle *stylePtr, - Blt_Font font, - GC gc, - XColor *normalColor, - float angle, - Tk_Anchor anchor, - Tk_Justify justify, - int leader) -{ - stylePtr->xPad.side1 = stylePtr->xPad.side2 = 0; - stylePtr->yPad.side1 = stylePtr->yPad.side2 = 0; - stylePtr->state = 0; - stylePtr->anchor = anchor; - stylePtr->color = normalColor; - stylePtr->font = font; - stylePtr->gc = gc; - stylePtr->justify = justify; - stylePtr->leader = leader; - stylePtr->angle = (float)angle; -} - static void DrawStandardLayout(Tk_Window tkwin, Drawable drawable, TextStyle *stylePtr, TextLayout *layoutPtr, int x, int y) @@ -1295,122 +1195,6 @@ Blt_FreeTextLayout(Tk_TextLayout textLayout) /* *--------------------------------------------------------------------------- * - * NewChunk -- - * - * Helper function for Blt_ComputeTextLayout(). Encapsulates a - * measured set of characters in a chunk that can be quickly - * drawn. - * - * Results: - * A pointer to the new chunk in the text layout. - * - * Side effects: - * The text layout is reallocated to hold more chunks as necessary. - * - * Currently, Tk_ComputeTextLayout() stores contiguous ranges of - * "normal" characters in a chunk, along with individual tab - * and newline chars in their own chunks. All characters in the - * text layout are accounted for. - * - *--------------------------------------------------------------------------- - */ -static LayoutChunk * -NewChunk(TkTextLayout **layoutPtrPtr, int *maxPtr, const char *start, - int numBytes, int curX, int newX, int y) -{ - TkTextLayout *layoutPtr; - LayoutChunk *chunkPtr; - int maxChunks, numChars; - size_t s; - - layoutPtr = *layoutPtrPtr; - maxChunks = *maxPtr; - if (layoutPtr->numChunks == maxChunks) { - maxChunks *= 2; - s = sizeof(TkTextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk)); - layoutPtr = realloc(layoutPtr, s); - *layoutPtrPtr = layoutPtr; - *maxPtr = maxChunks; - } - numChars = Tcl_NumUtfChars(start, numBytes); - chunkPtr = &layoutPtr->chunks[layoutPtr->numChunks]; - chunkPtr->start = start; - chunkPtr->numBytes = numBytes; - chunkPtr->numChars = numChars; - chunkPtr->numDisplayChars = numChars; - chunkPtr->x = curX; - chunkPtr->y = y; - chunkPtr->totalWidth = newX - curX; - chunkPtr->displayWidth = newX - curX; - layoutPtr->numChunks++; - - return chunkPtr; -} - -void -Blt_DrawTextLayout( - Display *display, /* Display on which to draw. */ - Drawable drawable, /* Window or pixmap in which to draw. */ - GC gc, /* Graphics context to use for drawing text. */ - Tk_TextLayout layout, /* Layout information, from a previous call - * to Blt_ComputeTextLayout(). */ - int x, int y, /* Upper-left hand corner of rectangle in - * which to draw (pixels). */ - int firstChar, /* The index of the first character to draw - * from the given text item. 0 specfies the - * beginning. */ - int lastChar) /* The index just after the last character - * to draw from the given text item. A number - * < 0 means to draw all characters. */ -{ - TkTextLayout *layoutPtr; - int i, numDisplayChars, drawX; - const char *firstByte; - const char *lastByte; - LayoutChunk *chunkPtr; - int depth = 24; - - layoutPtr = (TkTextLayout *) layout; - if (layoutPtr == NULL) { - return; - } - - if (lastChar < 0) { - lastChar = 100000000; - } - chunkPtr = layoutPtr->chunks; - for (i = 0; i < layoutPtr->numChunks; i++) { - numDisplayChars = chunkPtr->numDisplayChars; - if ((numDisplayChars > 0) && (firstChar < numDisplayChars)) { - if (firstChar <= 0) { - drawX = 0; - firstChar = 0; - firstByte = chunkPtr->start; - } else { - firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar); - Blt_MeasureChars(layoutPtr->font, chunkPtr->start, - firstByte - chunkPtr->start, -1, 0, &drawX); - } - if (lastChar < numDisplayChars) { - numDisplayChars = lastChar; - } - lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars); - Blt_DrawChars(display, drawable, gc, layoutPtr->font, depth, 0.0f, - firstByte, lastByte - firstByte, - x + chunkPtr->x + drawX, y + chunkPtr->y); - } - firstChar -= chunkPtr->numChars; - lastChar -= chunkPtr->numChars; - if (lastChar <= 0) { - break; - } - chunkPtr++; - } -} - -/* - *--------------------------------------------------------------------------- - * * Tk_CharBbox -- * * Use the information in the Tk_TextLayout token to return the @@ -1537,52 +1321,3 @@ Blt_CharBbox( return 1; } -/* - *--------------------------------------------------------------------------- - * - * Blt_UnderlineTextLayout -- - * - * Use the information in the Tk_TextLayout token to display an - * underline below an individual character. This procedure does - * not draw the text, just the underline. - * - * This procedure is useful for simple widgets that need to - * display single-font, multi-line text with an individual - * character underlined and want Tk to handle the details. - * To display larger amounts of underlined text, construct - * and use an underlined font. - * - * Results: - * None. - * - * Side effects: - * Underline drawn on the screen. - * - *--------------------------------------------------------------------------- - */ - -void -Blt_UnderlineTextLayout( - Display *display, /* Display on which to draw. */ - Drawable drawable, /* Window or pixmap in which to draw. */ - GC gc, /* Graphics context to use for drawing text. */ - Tk_TextLayout layout, /* Layout information, from a previous call - * to Tk_ComputeTextLayout(). */ - int x, int y, /* Upper-left hand corner of rectangle in - * which to draw (pixels). */ - int underline) /* Index of the single character to - * underline, or -1 for no underline. */ -{ - TkTextLayout *layoutPtr; - int xx, yy, width, height; - - if ((Blt_CharBbox(layout, underline, &xx, &yy, &width, &height) != 0) - && (width != 0)) { - Blt_FontMetrics fm; - layoutPtr = (TkTextLayout *) layout; - Blt_GetFontMetrics(layoutPtr->font, &fm); - XFillRectangle(display, drawable, gc, x + xx, - y + yy + fm.ascent + fm.underlinePos, - (unsigned int) width, fm.underlineHeight); - } -} |