summaryrefslogtreecommitdiffstats
path: root/src/bltGrPSOutput.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/bltGrPSOutput.C
parentbbdf932bc3724c5a11cb4c415995e5385cb251ec (diff)
downloadblt-53fb30583d98af5691e8581fcf33fc3b8fadf923.zip
blt-53fb30583d98af5691e8581fcf33fc3b8fadf923.tar.gz
blt-53fb30583d98af5691e8581fcf33fc3b8fadf923.tar.bz2
*** empty log message ***
Diffstat (limited to 'src/bltGrPSOutput.C')
-rw-r--r--src/bltGrPSOutput.C53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C
index dbfed5e..9e8da53 100644
--- a/src/bltGrPSOutput.C
+++ b/src/bltGrPSOutput.C
@@ -814,9 +814,62 @@ void PostScript::prolog()
" stroke\n"
"} def\n"
"\n"
+"/baseline 0 def\n"
+"/height 0 def\n"
+"/justify 0 def\n"
+"/lineLength 0 def\n"
+"/spacing 0 def\n"
+"/strings 0 def\n"
+"/xoffset 0 def\n"
+"/yoffset 0 def\n"
+"/baselineSampler ( TXygqPZ) def\n"
+"% Put an extra-tall character in; done this way to avoid encoding trouble\n"
+"baselineSampler 0 196 put\n"
+"\n"
+"/cstringshow {\n"
+" {\n"
+" dup type /stringtype eq\n"
+" { show } { glyphshow }\n"
+" ifelse\n"
+" } forall\n"
+"} bind def\n"
+"\n"
+"/cstringwidth {\n"
+" 0 exch 0 exch\n"
+" {\n"
+" dup type /stringtype eq\n"
+" { stringwidth } {\n"
+" currentfont /Encoding get exch 1 exch put (\001)\n"
+" stringwidth\n"
+" }\n"
+" ifelse\n"
+" exch 3 1 roll add 3 1 roll add exch\n"
+" } forall\n"
+"} bind def\n"
+"\n"
"/DrawText {\n"
" gsave\n"
+" /justify exch def\n"
+" /yoffset exch def\n"
+" /xoffset exch def\n"
+" /spacing exch def\n"
" /strings exch def\n"
+" % First scan through all of the text to find the widest line.\n"
+" /lineLength 0 def\n"
+" strings {\n"
+" cstringwidth pop\n"
+" dup lineLength gt {/lineLength exch def} {pop} ifelse\n"
+" newpath\n"
+" } forall\n"
+" % Compute the baseline offset and the actual font height.\n"
+" 0 0 moveto baselineSampler false charpath\n"
+" pathbbox dup /baseline exch def\n"
+" exch pop exch sub /height exch def pop\n"
+" newpath\n"
+" % Translate and rotate coordinates first so that the origin is at\n"
+" % the upper-left corner of the text's bounding box. Remember that\n"
+" % angle for rotating, and x and y for positioning are still on the\n"
+" % stack.\n"
" translate\n"
" neg rotate\n"
" 0 0 moveto\n"