summaryrefslogtreecommitdiffstats
path: root/src/bltGrText.C
diff options
context:
space:
mode:
authorjoye <joye>2014-06-10 18:37:20 (GMT)
committerjoye <joye>2014-06-10 18:37:20 (GMT)
commit53fb30583d98af5691e8581fcf33fc3b8fadf923 (patch)
treebcfae60fbcbe4849f547b89b5a06098bd3b9a1ca /src/bltGrText.C
parentbbdf932bc3724c5a11cb4c415995e5385cb251ec (diff)
downloadblt-53fb30583d98af5691e8581fcf33fc3b8fadf923.zip
blt-53fb30583d98af5691e8581fcf33fc3b8fadf923.tar.gz
blt-53fb30583d98af5691e8581fcf33fc3b8fadf923.tar.bz2
*** empty log message ***
Diffstat (limited to 'src/bltGrText.C')
-rw-r--r--src/bltGrText.C32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/bltGrText.C b/src/bltGrText.C
index d2f0fd3..f806e72 100644
--- a/src/bltGrText.C
+++ b/src/bltGrText.C
@@ -142,14 +142,38 @@ void TextStyle::printText(PostScript* psPtr, const char *text, int x, int y)
ops->justify, 0, &w1, &h1);
// cerr << '(' << x << ',' << y << ')' << ' ' << text << endl;
+
+ int xx =0;
+ int yy =0;
+ switch (ops->anchor) {
+ case TK_ANCHOR_NW: xx = 0; yy = 0; break;
+ case TK_ANCHOR_N: xx = 1; yy = 0; break;
+ case TK_ANCHOR_NE: xx = 2; yy = 0; break;
+ case TK_ANCHOR_E: xx = 2; yy = 1; break;
+ case TK_ANCHOR_SE: xx = 2; yy = 2; break;
+ case TK_ANCHOR_S: xx = 1; yy = 2; break;
+ case TK_ANCHOR_SW: xx = 0; yy = 2; break;
+ case TK_ANCHOR_W: xx = 0; yy = 1; break;
+ case TK_ANCHOR_CENTER: xx = 1; yy = 1; break;
+ }
+
+ const char* justify =NULL;
+ switch (ops->justify) {
+ case TK_JUSTIFY_LEFT: justify = "0"; break;
+ case TK_JUSTIFY_CENTER: justify = "0.5"; break;
+ case TK_JUSTIFY_RIGHT: justify = "1"; break;
+ }
+
+ Tk_FontMetrics fm;
+ Tk_GetFontMetrics(ops->font, &fm);
+
psPtr->format("%g %d %d [\n", ops->angle, x, y);
Tcl_ResetResult(graphPtr_->interp_);
Tk_TextLayoutToPostscript(graphPtr_->interp_, layout);
- const char* ss = Tcl_GetStringResult(graphPtr_->interp_);
- psPtr->append(ss);
+ psPtr->append(Tcl_GetStringResult(graphPtr_->interp_));
Tcl_ResetResult(graphPtr_->interp_);
- psPtr->format("] DrawText\n");
- // psPtr->format("] %d %g %g %s %s DrawText\n", fm.linespace, xx/-2.0, yy/2.0, justify, "false");
+ psPtr->format("] %d %g %g %s DrawText\n",
+ fm.linespace, xx/-2.0, yy/2.0, justify);
#if 0
double w2, h2;