如何阻止.EPS文件在PostScript中将文本分成多行? [英] How do I stop an .EPS file from breaking text into multiple lines in PostScript?

查看:132
本文介绍了如何阻止.EPS文件在PostScript中将文本分成多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图从Adobe产品(例如Illustrator或InDesign)生成的.EPS文件中专门更改文本。不管出于何种原因,某些字体都会分成几行并移动一点。这不是TrueType还是OpenType。

I'm trying to specifically change out text from an .EPS file that's generated by an Adobe product, like Illustrator or InDesign. For whatever reason some fonts are broken onto separate lines and moved a tiny bit. It's not a TrueType versus OpenType thing.

这里是一个示例,文本为 $$ tag1 $$:

Here's an example, the text is "$$tag1$$":

%ADOEndSubsetFont
/ZDCMCB+NiagaraSolid-Reg /NiagaraSolid-Reg findfont ct_VMDictPut
/ZDCMCB+NiagaraSolid-Reg*1 
[36{/.notdef}rp /dollar 12{/.notdef}rp /one 47{/.notdef}rp /a 5{/.notdef}rp /g 
12{/.notdef}rp /t 139{/.notdef}rp]
ZDCMCB+NiagaraSolid-Reg nf
ZDCMCB+NiagaraSolid-Reg*1 [9 0 0 -9 0 0 ]msf
264.206 109.1 mo
($$t)sh
270.916 109.1 mo
(ag1$$)
[2.42188 2.51758 1.45117 2.53906 0 ]xsh

下面是一个不中断的示例,文本为 $$ tag1 $$:

Here's an example where it doesn't break, the text is "$$tag1$$":

%ADOEndSubsetFont
/ZDCMCC+Utsaah-BoldItalic /Utsaah-BoldItalic findfont ct_VMDictPut
/ZDCMCC+Utsaah-BoldItalic*1 
[36{/.notdef}rp /dollar 13{/.notdef}rp /two 46{/.notdef}rp /a 5{/.notdef}rp /g 
12{/.notdef}rp /t 139{/.notdef}rp]
ZDCMCC+Utsaah-BoldItalic nf
ZDCMCC+Utsaah-BoldItalic*1 [9 0 0 -9 0 0 ]msf
264.206 118.1 mo
($$tag2$$)sh
%ADOBeginSubsetFont: Garamond-Bold Initial
%ADOt1write: (1.0.24)

我们正在使用PHP交换变量并重新保存文件具有新的价值。问题是我们无法可靠地确定文本将在何处折断,如果不能做到,我们将无法替换,否则在尝试将其转换为PDF时文件会出错。

We're using PHP to swap out the variables and resave the file with new values. The problem is we can't reliably determine where the text will break and if it does we can't replace it or the file will error out when trying to convert it to something like a PDF.

非常感谢任何帮助!

推荐答案

产品生成的附言通常是-就是这种情况-不可读或不可编辑的幽默。

Postscript generated by products is normally - as is the case - not humam readable or editable.

作为一种功能齐全的语言,如果确实确实从头开始或多或少地创建了一个后记文件,那么它的可读性将比上面的示例高得多,并且在这种情况下,可编辑。

As a fully featured Language, if one does indeed create a postscript file more or less from scratch, it ends up being much more readable than the samples above, and it is in this case, editable.

后记本身并不难-因为您正在生成EPS,所以您可能会更容易地完成所有文本生成部分,例如人工生成的一段代码,而不是依赖于如上所述的自动生成的代码。您将失去一些排版方面的技巧,因为似乎每个字母对之间的距离似乎都已计算出来(在后记之外)并在上面进行了硬编码。您可能只想保持EPS文件的完整性,并替换文本核心部分-然后,就像在常规程序中使用任何语言一样,调整适应人类可读的部分。

Postscript is not hard per se - since you are generating an EPS, maybe it would be easier for you to do all the text generating parts as a human-generated piece of code, instead of rely on automatically generated code as above. You will loose some typesetting niceties, since the distance between each letter pair seems to be calculated (outside of postscript) and hardcoded above. You might just want keep teh remainign of the EPS file and replace the "text core" parts - then, maiking adjusts to human readable parts as you do in a regular program in any language.

示例渲染可能类似于:

%!PS-Adobe EPSF-3.0
%%BoundingBox: 0 0 800 200

(VeraSeeBd.ttf) findfont 70 scalefont setfont
10 10 moveto
(Hello World!) show

从此处标记文本中断要容易得多。
如果您想要更复杂的东西并且让postcrit处理
换行符本身,可以从
生成器代码中估算出来,而不是根据生成器代码进行估算,但是您必须将该逻辑编码为后记本身。

It is a lot easier to mark your text break from there. If you want something more sophisticatedand have the postscrit to take care of the line breaks itself, instead of estimating from the generator code, it is possible - but you have to code that logic into postscript itself.

这篇关于如何阻止.EPS文件在PostScript中将文本分成多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆