PHP / Apache的内部Inkscape中不渲染字体PNG [英] Inkscape inside PHP/Apache doesn't render fonts to PNG

查看:547
本文介绍了PHP / Apache的内部Inkscape中不渲染字体PNG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我发现一个问题是类似于此<一个href=\"http://stackoverflow.com/questions/7827445/processstartinfo-with-inkscape-on-iis-is-not-using-any-fonts\">unanswered问题;虽然不相同的,它可以具有相同的原因。

An issue I discover today is similar to this unanswered problem; though not the same, it may have the same cause.

我使用的渲染SVG文件 Inkscape中,因为无论是PNG或PDF格式。在大多数情况下我打算用Gearman的背景来呈现这些,但现在我创建一个PHP / Apache进程里面的一些缩略图。看来,如果Inkscape中被调用(通过PHP的 EXEC )的Apache进程里面,它不能找到它需要渲染字体。因此,该图形元素渲染细,但任何文本元素未在PNG输出绘制。

I'm rendering SVG files using inkscape, as either PNG or PDF. For the most part I intend to use Gearman to render these in the background, but for now I am creating some thumbnails inside a PHP/Apache process. It seems that if inkscape is called (via PHP's exec) inside an Apache process, it cannot find the fonts it needs to render. Thus, the graphic elements render fine, but any text elements are not drawn in the PNG output.

我怀疑是从内阿帕奇的CLI环境是我平时的bash控制台不同的,这意味着字体不能被看到的一种方式。我在OS X 10.6.8。任何想法?

I suspect that the CLI environment from inside Apache is different to my usual bash console in a way that means fonts cannot be seen. I'm on OS X 10.6.8. Any ideas?

编辑:从意见下,我已经捕获 PHP -i Apache和Gearman的内部,显示差异第一对第二(所以理论上运用差异将使其工作)。该结果是这里

following on from comments, I've captured php -i inside both Apache and Gearman, and diffed the first against the second (so in theory applying the diff would make it work). The result is here.

编辑2:我已经试过转换-list字体使用系统这两个环境 - 都没有差异

Edit 2: I've tried convert -list font in both environments using system - no differences at all.

推荐答案

正如在评论中确定以上,这是由环境差异造成的 - 在首页的环境变量是在执行过程中的内部设置不同。使用 proc_open ,而不是简单的 EXEC 给过该方法更precise控制,并明确设置,的环境变量解决了这个问题。

As was determined in the comments above, this was caused by an environmental difference - the HOME env var was set differently inside the executed process. Using proc_open instead of simple exec gave more precise control over said process and explicitly setting that env var solved the issue.

这篇关于PHP / Apache的内部Inkscape中不渲染字体PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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