Am 25.09.2017 um 23:23 schrieb Enrico Forestieri <for...@lyx.org>:
> 
> On Mon, Sep 25, 2017 at 08:50:11PM +0200, Stephan Witt wrote:
>> Am 25.09.2017 um 17:05 schrieb Enrico Forestieri <for...@lyx.org>:
>>> 
>>> So, it seems that a QApplication is necessary when the svg image contains
>>> text. All of our icons should be text free, but some pathological cases
>>> may occur, as demonstrated.
>> 
>> You’re right.
>> 
>> Meanwhile I found the relevant bug 
>> https://bugreports.qt.io/browse/QTBUG-31990
>> 
>> We may cleanup our icons. Unfortunately we cannot guarantee the fallback
>> converter is not used by some arbitrary SVG image and crashes.
> 
> There are a few icons with empty text, but there are also all the ipa icons
> that contain text. These texts should be changed to paths, otherwise they
> will be rendered wrongly if the requested font is not present. This is easy
> to do with inkscape.

That would be good, indeed.

>> I tried to pass -platform offscreen to QApplication args. This works too.
>> But I’m not sure how this would work on platforms not being Linux.
>> On Mac I have to fool the QFontDatabase class by creating an empty directory
>> Contents/lib/fonts in the application bundle. On X11-Linux it should work.
>> But Cygwin and Windows… I have no idea how it goes.
>> 
>> Please, try the updated patch attached if possible. Thanks.
> 
> It works on Cygwin.

Nice.

> But I don't know whether the offscreen plugins is to
> be expected on native Windows because it relies on the freetype library.
> Maybe the available plugins can be checked before instantiating a
> QApplication and, if the offscreen one is not there, the -platform option
> can be removed form argv. I don't seem to observe the same adverse effect
> you see on Mac and the behavior on Windows seems to be the same whether
> using a QApplication or a QCoreApplication.

Meanwhile I tested this: 
$ lyxconvert -platform unknown -d math-subscript.svg math-subscript.pdf
This application failed to start because it could not find or load the Qt 
platform plugin "unknown"
in "".

Available platform plugins are: cocoa, minimal, offscreen.

Reinstalling the application may fix this problem.
Abort trap: 6

So I tried this…

$ lyxconvert -platform minimal -d math-subscript.svg math-subscript.pdf
lyxconvert: platform is minimal
lyxconvert: Load file 'math-subscript.svg', infmt is 'auto'
lyxconvert: Save converted image to file 'math-subscript.pdf', outfmt is ‚pdf'

… what worked too - even better because no font database is expected.
Probably the text rendering would be broken then. But I’d guess it’s
broken on Mac with offscreen anyway. At least it seems so if I put some
strings into the math-subscript.svg text elements.

Stephan

Reply via email to