如何阻止 .EPS 文件在 PostScript 中将文本分成多行?

发布于 2024-10-16 02:20:29 字数 1151 浏览 7 评论 0原文

我正在尝试专门更改 Adob​​e 产品(例如 Illustrator 或 InDesign)生成的 .EPS 文件中的文本。无论出于何种原因,某些字体被分成单独的行并移动了一点点。这不是 TrueType 与 OpenType 之争。

这是一个示例,文本是“$$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$$”:

%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 之类的文件时,文件将出错。

任何帮助都非常非常非常感谢!

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.

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

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)

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.

Any help is greatly greatly greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

马蹄踏│碎落叶 2024-10-23 02:20:29

产品生成的后记通常 - 实际情况 - 是不可阅读或可编辑的。

作为一种功能齐全的语言,如果确实或多或少从头开始创建 postscript 文件,那么它最终会比上面的示例更具可读性,并且在本例中是可编辑的。

Postscript 本身并不难 - 因为您正在生成 EPS,也许将所有文本生成部分作为人工生成的代码来完成会更容易,而不是像上面那样依赖自动生成的代码。您将失去一些排版细节,因为每个字母对之间的距离似乎是计算出来的(在附言之外)并在上面进行了硬编码。您可能只想保留 EPS 文件的剩余部分并替换“文本核心”部分 - 然后,maiking 会像在任何语言的常规程序中一样调整为人类可读的部分。

示例渲染可能如下所示:

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

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

从那里标记文本中断要容易得多。
如果你想要更复杂的东西并且有 postscrit 来处理
换行符本身,而不是从生成器代码中估计,
这是可能的 - 但你必须将该逻辑编码到 postscript 本身中。

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.

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.

A sample rendering could be like:

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

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文