How to ensure line widths are the same vertically and horizontally in PostScript?

送分小仙女□ 提交于 2021-01-28 10:41:42

问题


The width of a line in PostScript is defined in terms of distances in the user space. In my use case, the aspect ratio of the device space (e.g. 4:3) is different from the aspect ratio of the user space (e.g. 1:1), which causes the line widths in the device space to be different in vertical and horizontal directions.

How to make line widths the same regardless of the line orientation? The PostScript Language Reference Manual for setlinewidth mentions that if the current transformation matrix (CTM) in effect at the time of the stroke specifies scaling by different factors in the x and y dimensions, then thickness of the lines can vary.

Does this mean that if I set a CTM with the same scaling factor in x and y dimensions before calling stroke and then reset the CTM to the value used elsewhere in the PostScript file, the line widths will be the same without affecting anything else?


回答1:


Yes. stroke will generate an outline of the path corresponding to a pen shape transformed by the CTM. You can use setmatrix to establish a consistent uniform matrix for the pen.

matrix currentmatrix
  matrix identmatrix setmatrix
  stroke
setmatrix


来源:https://stackoverflow.com/questions/64223535/how-to-ensure-line-widths-are-the-same-vertically-and-horizontally-in-postscript

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