SVGKit - Illustrator SVG 曲线从相对到绝对
我正在尝试使用 SVGKit (看起来是一个很棒的工具!)来渲染包含比一个简单的矩形或圆形。我首先尝试模仿 SVGKit 示例中的 SVG (XML),我注意到 Illustrator (CS4) 导出的 SVG 有点不同。
Illustrator 中的开放
标记与示例中的封闭
标记。不过,事实证明这是无关紧要的。Illustrator 中的相对
曲线
(c
) 与 SVGKit 示例中的绝对曲线
(C
)。< /p>
- 我尝试将示例中几个路径的 SVG 复制到 Illustrator 生成的 SVG 文件中。
- 但是,在 Illustrator 中打开并将新复制的对象移动到新的 (x,y) 位置后,
curveto
命令似乎已从绝对命令 (C
) 到相对 (c
)(因此包括负值)。
这些不再在 SVGKit 中呈现。 (实际上它们会导致 EXC_BAD_ACCESS 错误和 Core Graphics 抛出错误)。
长话短说,有什么好方法可以强制 Illustrator 在其 SVG 中保留绝对的 curveto
命令吗?或者防止它显着改变仅移动的形状上的 SVG 命令?
I'm trying to get SVGKit (looks like a great tool!) to render files containing anything more complicated than a simple rectangle or circle. I started by trying to mimmic the SVG (XML) from the SVGKit samples and I noticed the SVG that Illustrator (CS4) exports is a bit different.
Open
<path ... />
tags from Illustrator vs. closed<path ... ></path>
tags from the samples. This turns out to be irrelevant, though.Relative
curveto
(c
) in Illustrator vs. absolutecurveto
(C
) from SVGKit samples.
- I tried copying the SVG for a couple paths from the samples into my Illustrator-generated SVG file.
- However, upon opening in Illustrator and moving the newly-copied objects to a new (x,y) location, it seems that the
curveto
commands have been altered from absolute (C
) to relative (c
) (and thus include negative values).
These no longer render in SVGKit. (Actually they cause EXC_BAD_ACCESS errors and Core Graphics to throw errors).
Long story short, is there any good way to force Illustrator to keep absolute curveto
commands in its SVG? Or to keep it from significantly altering the SVG commands on shapes that are simply being moved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短回答:2011 年 12 月,SVGKit 对大多数 SVG 来说“不起作用”。
您描述的所有内容都在今年年初得到了修复,现在它越来越接近符合规范。
另外......即将发生一个大的变化,使 API 更简单/更易于使用(更接近 SVG 规范)。您可以在这里尝试一下: https://github.com/adamgit/SVGKit/tree/transforms< /a> - 但该分支目前正在“开发中”。它非常稳定,但有时会得到实验性的提交。
Short answer: in Dec 2011, SVGKit just "didn't work" for most SVGs.
All the stuff you describe got fixed early this year, and now it's geting much closer to conforming with the spec.
Also ... a big change coming soon to simpler / easier to use API (which is closer to the SVG spec). You can try it out here: https://github.com/adamgit/SVGKit/tree/transforms - but that branch is currently "in development". It's pretty stable, but sometimes gets exprimental commits.