How can I write arc text in postscript file

南笙酒味 提交于 2019-12-03 21:07:00

Adobe's famous Blue Book (PostScript Language Tutorial and Cookbook, Adobe Systems, Addison-Wesley 1985; ISBN 0201101793) contains a very well explained example how to do this.

See pages 168ff and the following screenshot:

Not sure why you want to avoid translate, and it's not clear what you mean by "dynamically". But this code gives rotation-like effects without translating. But you can't really hug an arc without defining a center (either with translate and rotate, or algebraically with cos and sin) and accounting (somehow) for the character widths. The Adobe example code does all of this. My code here does not.

%!

/rottxt { 4 dict begin
    /ang exch def
    /str exch def
    /ang ang str length div def
    { pop pop ang rotate }
    str
    kshow
end } def

30 150 moveto
/Palatino-Roman 20 selectfont
(This   is) -20 rottxt
( some  ro) 20 rottxt
(tated   T) -40 rottxt
(ext!!!!!) -100 rottxt
showpage

I think at long last I understand what you're trying to do. The part about translate really threw me for a loop. There's nothing to fear about translate. And it will be necessary. Translate is what lets you control where the center of rotation is.

So you want to draw text on a circle, but you want to change font parameters dynamically. Font-changes in the middle of an arc. That'll take some thought. I'll edit when I've got more.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!