Cairo(图形库)可以用来渲染数学公式和图片(latex风格)吗?
它是否需要任何依赖项来实现成熟的 unicode 字符渲染,或者它可以读取和渲染任何平台 (Linux/Max/Windows) 的本机字体字形而没有太多问题吗?
它可以在生成的 pdf 文件中导入/渲染 eps/pdf/svg 吗?还是我必须手动解析图像文件,并在开罗重新绘制它?
Does it need any dependencies for full-fledged unicode character rendering, or can it read and render any platform's (Linux/Max/Windows) native font glyphs without much problems?
Can it import/render eps/pdf/svg inside a produced pdf file, or would I have to manually parse the image file, and redraw it in Cairo?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Cairo 本身并不执行“公式” - 它可以使用全套 unicode 字符,但我认为如果您将“pango”库与 Cairo 一起使用,文本支持会更好。
至于导入矢量格式,有“librsvg”,它与 cairo 一起工作,使其能够用于渲染 SVG 文件 - 这允许其他库 - 也许是 Tex 本身,来渲染数学公式本身。
至于图片,是的,Cairo 可以导入并自行绘制光栅图片。
我有一个在 Cairo 上使用 librsvg 的示例 在此答案 ,虽然它是用 Python 编写的,而不是用 C 语言编写的。您必须查找两个库的在线文档才能获取它在 C 中工作的示例。(我记得有这样的,因为那里由于没有 Python 示例,我必须根据 C) 中给出的示例来实现此示例。
Cairo per se does not do "formulas" - it can work with the full set of unicode characters, but I think text support is better if you use the "pango" library along with Cairo.
As for importing a vector format, there is "librsvg" which works along with cairo enabling it to be used to render SVG files - this lets up to other libraries - maybe Tex itself, to render mathematical formulas themselves.
As for Pictures, yes, Cairo can import and draw raster pictures on itself.
I have an example of using librsvg with Cairo on this answer, though it is in Python, not in C. You will have to look for the online docs on both libraries to get examples of it working in C. (I remeber there were such, because there were no Python examples, I had to get this one working from the examples given in C).