diff options
author | joye <joye> | 2013-12-09 19:32:07 (GMT) |
---|---|---|
committer | joye <joye> | 2013-12-09 19:32:07 (GMT) |
commit | 42c465af03672c8882090398363567489976d946 (patch) | |
tree | a599b15bf450a93cc8f152b8d1be16086c68175d | |
parent | 6c3159679a8cd6b9846943c8dde6009ed03631da (diff) | |
download | blt-42c465af03672c8882090398363567489976d946.zip blt-42c465af03672c8882090398363567489976d946.tar.gz blt-42c465af03672c8882090398363567489976d946.tar.bz2 |
*** empty log message ***
-rw-r--r-- | src/bltGrPSOutput.C | 3 | ||||
-rw-r--r-- | src/bltGrText.C | 62 | ||||
-rw-r--r-- | src/bltGrText.h | 100 |
3 files changed, 5 insertions, 160 deletions
diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C index 71d2697..a9a38a1 100644 --- a/src/bltGrPSOutput.C +++ b/src/bltGrPSOutput.C @@ -1025,7 +1025,7 @@ Blt_Ps_XSetFont(PostScript *psPtr, Blt_Font font) } Blt_Ps_Append(psPtr, "12.0 /Helvetica-Bold SetFont\n"); } - +#if 0 static void TextLayoutToPostScript(Blt_Ps ps, int x, int y, TextLayout *textPtr) { @@ -1098,6 +1098,7 @@ TextLayoutToPostScript(Blt_Ps ps, int x, int y, TextLayout *textPtr) fragPtr->width, x + fragPtr->x, y + fragPtr->y); } } +#endif /* *--------------------------------------------------------------------------- diff --git a/src/bltGrText.C b/src/bltGrText.C index 25438fd..820df93 100644 --- a/src/bltGrText.C +++ b/src/bltGrText.C @@ -462,68 +462,6 @@ Blt_AnchorPoint( return t; } -void -Blt_DrawLayout(Tk_Window tkwin, Drawable drawable, GC gc, Blt_Font font, - int depth, float angle, int x, int y, TextLayout *layoutPtr, - int maxLength) -{ - TextFragment *fp, *fend; - Blt_FontMetrics fm; - - Blt_GetFontMetrics(font, &fm); - for (fp = layoutPtr->fragments, fend = fp + layoutPtr->nFrags; - fp < fend; fp++) { - int sx, sy; - - sx = x + fp->sx, sy = y + fp->sy; - Blt_DrawChars(Tk_Display(tkwin), drawable, gc, font, depth, angle, - fp->text, fp->count, sx, sy); - } - if (layoutPtr->underlinePtr != NULL) { - fp = layoutPtr->underlinePtr; - Blt_UnderlineChars(Tk_Display(tkwin), drawable, gc, font, fp->text, - fp->count, x + fp->sx, y + fp->sy, layoutPtr->underline, - layoutPtr->underline + 1, maxLength); - } -} - -static void -RotateStartingTextPositions(TextLayout *lPtr, int w, int h, float angle) -{ - Point2d off1, off2; - TextFragment *fp, *fend; - double radians; - double rw, rh; - double sinTheta, cosTheta; - - Blt_GetBoundingBox(w, h, angle, &rw, &rh, (Point2d *)NULL); - off1.x = (double)w * 0.5; - off1.y = (double)h * 0.5; - off2.x = rw * 0.5; - off2.y = rh * 0.5; - radians = (-angle / 180.0) * M_PI; - - sinTheta = sin(radians), cosTheta = cos(radians); - for (fp = lPtr->fragments, fend = fp + lPtr->nFrags; fp < fend; fp++) { - Point2d p, q; - - p.x = fp->x - off1.x; - p.y = fp->y - off1.y; - q.x = (p.x * cosTheta) - (p.y * sinTheta); - q.y = (p.x * sinTheta) + (p.y * cosTheta); - q.x += off2.x; - q.y += off2.y; - fp->sx = ROUND(q.x); - fp->sy = ROUND(q.y); - } -} - -void -Blt_RotateStartingTextPositions(TextLayout *lPtr, float angle) -{ - RotateStartingTextPositions(lPtr, lPtr->width, lPtr->height, angle); -} - /* *--------------------------------------------------------------------------- * diff --git a/src/bltGrText.h b/src/bltGrText.h index 5099d22..267e502 100644 --- a/src/bltGrText.h +++ b/src/bltGrText.h @@ -39,90 +39,6 @@ #define UPDATE_GC 1 /* - * TextFragment -- - */ -typedef struct { - const char *text; /* Text string to be displayed */ - - size_t count; /* Number of bytes in text. The actual - * character count may differ because of - * multi-byte UTF encodings. */ - - short x, y; /* X-Y offset of the baseline from the - * upper-left corner of the bbox. */ - - short sx, sy; /* Starting offset of text using rotated - * font. */ - - int width; /* Width of segment in pixels. This - * information is used to draw - * PostScript strings the same width - * as X. */ -} TextFragment; - - -/* - * TextItem -- - * - * Parsed form for markup string. Each item is a scrap of text - * describes the font, position, and characters to be displayed. - * - * subscript x_y very small subset of latex markup. - * superscript x^y - * grouping a^{x+y} a_{i,j} - * supersuper a^{10^8} - * \hat{a} \bar{b} \vec{c} - * \overline{} \underline{} - * \frac \tfrac - * \Alpha \Beta ... - * \mathbf{} \mathit{} \mathrm{} \boldsymbol{} - * \angstrom \degree - * - * -mathtext instead of -text - * - * Can use TextItem where you don't directly edit the text: - * label, treeview, graph, barchart... - * - * Font selector (bold, italic, size adjust) from base font. - * Global font table reference counted. - * - */ -typedef struct { - const char *text; /* Text string to be displayed */ - - size_t count; /* Number of bytes in text. The actual - * character count may differ because of - * multi-byte UTF encodings. */ - - short int x, y; /* X-Y offset of the baseline from the - * upper-left corner of the bbox. */ - - short int sx, sy; /* Starting offset of text using rotated - * font. */ - - Blt_Font font; /* Allocated font for this chunk. - * If NULL, use the global font. */ - - int underline; /* Text is underlined */ - - int width; /* Width of segment in pixels. This - * information is used to draw - * PostScript strings the same width - * as X. (deprecated) */ -} TextItem; - -/* - * TextLayout -- - */ -typedef struct { - TextFragment *underlinePtr; - int underline; - size_t width, height; /* Dimensions of text bounding box */ - size_t nFrags; /* # fragments of text */ - TextFragment fragments[1]; /* Information about each fragment of text */ -} TextLayout; - -/* * TextStyle -- * * A somewhat convenient structure to hold text attributes that determine @@ -158,6 +74,9 @@ typedef struct { GC gc; /* GC used to draw the text */ } TextStyle; +extern void Blt_GetTextExtents(Blt_Font font, int leader, const char *text, + int textLen, unsigned int *widthPtr, unsigned int *heightPtr); + extern void Blt_Ts_GetExtents(TextStyle *tsPtr, const char *text, unsigned int *widthPtr, unsigned int *heightPtr); @@ -171,19 +90,6 @@ extern void Blt_DrawText(Tk_Window tkwin, Drawable drawable, extern void Blt_DrawText2(Tk_Window tkwin, Drawable drawable, const char *string, TextStyle *tsPtr, int x, int y, Dim2D * dimPtr); -extern Pixmap Blt_Ts_Bitmap(Tk_Window tkwin, TextLayout *textPtr, - TextStyle *tsPtr, int *widthPtr, int *heightPtr); - -extern void Blt_DrawLayout(Tk_Window tkwin, Drawable drawable, GC gc, - Blt_Font font, int depth, float angle, int x, int y, - TextLayout *layoutPtr, int maxLength); - -extern void Blt_GetTextExtents(Blt_Font font, int leader, const char *text, - int textLen, unsigned int *widthPtr, unsigned int *heightPtr); - -extern void Blt_RotateStartingTextPositions(TextLayout *textPtr, - float angle); - extern void Blt_Ts_DrawText(Tk_Window tkwin, Drawable drawable, const char *text, int textLen, TextStyle *tsPtr, int x, int y); |