Re: [PATCH] How to setup image converters on Mac?

2017-09-30 Thread Scott Kostyshak
On Thu, Sep 28, 2017 at 07:30:45AM +, Enrico Forestieri wrote:
> On Wed, Sep 27, 2017 at 10:34:20PM +0200, Stephan Witt wrote:
> > 
> > Ok, here is my next proposed patch. Now lyxconvert should be compiled
> > and installed on Mac only, in convertDefault.py a test for platform
> > darwin is active to ensure it is called on Mac only.
> > 
> > This should avoid to fix something not broken on Linux and Windows.
> > 
> > I’ve tested on Mac with (a temporary change to) INSTALL_WINDOWS to
> > ensure it works as null target on other platforms - but that’s not a
> > real test. It would be nice to hear if it works on Linux, Cygwin and
> > Windows as well.
> 
> It works on Linux, Cygwin, and Windows when compiling with mingw ed autotools.

Thanks for testing. Stephan, please go ahead for 2.3.x branch.

Scott


signature.asc
Description: PGP signature


Re: [PATCH] How to setup image converters on Mac?

2017-09-28 Thread Enrico Forestieri
On Wed, Sep 27, 2017 at 10:34:20PM +0200, Stephan Witt wrote:
> 
> Ok, here is my next proposed patch. Now lyxconvert should be compiled
> and installed on Mac only, in convertDefault.py a test for platform
> darwin is active to ensure it is called on Mac only.
> 
> This should avoid to fix something not broken on Linux and Windows.
> 
> I’ve tested on Mac with (a temporary change to) INSTALL_WINDOWS to
> ensure it works as null target on other platforms - but that’s not a
> real test. It would be nice to hear if it works on Linux, Cygwin and
> Windows as well.

It works on Linux, Cygwin, and Windows when compiling with mingw ed autotools.

-- 
Enrico


Re: [PATCH] How to setup image converters on Mac?

2017-09-27 Thread Stephan Witt
Am 27.09.2017 um 18:54 schrieb Scott Kostyshak :
> 
> On Tue, Sep 26, 2017 at 09:32:34PM +, Enrico Forestieri wrote:
> 
>>> What do you think? IMO, the benefit on Mac is enough to take the risk.
>>> That’s not true for the other platforms.
>> 
>> I agree.
> 
> Whatever you all agree on for 2.3.x is fine in my opinion. Thanks for
> all of your work on this issue.

Ok, here is my next proposed patch. Now lyxconvert should be compiled
and installed on Mac only, in convertDefault.py a test for platform
darwin is active to ensure it is called on Mac only.

This should avoid to fix something not broken on Linux and Windows.

I’ve tested on Mac with (a temporary change to) INSTALL_WINDOWS to
ensure it works as null target on other platforms - but that’s not a
real test. It would be nice to hear if it works on Linux, Cygwin and
Windows as well.

Stephan



0007-imgconvert.patch
Description: Binary data


Re: [PATCH] How to setup image converters on Mac?

2017-09-27 Thread Scott Kostyshak
On Tue, Sep 26, 2017 at 09:32:34PM +, Enrico Forestieri wrote:

> > What do you think? IMO, the benefit on Mac is enough to take the risk.
> > That’s not true for the other platforms.
> 
> I agree.

Whatever you all agree on for 2.3.x is fine in my opinion. Thanks for
all of your work on this issue.

Scott


signature.asc
Description: PGP signature


Re: [PATCH] How to setup image converters on Mac?

2017-09-26 Thread Enrico Forestieri
On Tue, Sep 26, 2017 at 11:07:00PM +0200, Stephan Witt wrote:
> Am 26.09.2017 um 21:10 schrieb Enrico Forestieri :
> > 
> > On Mon, Sep 25, 2017 at 11:38:05PM +0200, Stephan Witt wrote:
> >> Am 25.09.2017 um 23:23 schrieb Enrico Forestieri :
> >>> 
> >>> 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 have cleaned up some of the icons but not all.
> 
> Thank you. BTW, what’s the tool to convert text to paths?

I get it from the menu "Path->Object to Path"

> >> 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.
> > 
> > I think this is going to work on all platforms.
> > 
> >> 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.
> > 
> > I see the text when using the offscreen plugin but not when using the
> > minimal one (characters are replaced by boxes in this case).
> 
> That makes sense. Minimal is a pure QImage as „screen“ - no fonts at all.
> And „offscreen" is supported by e.g. Xnest for a long time with X11.
> The Qt docs contain the statement it works good with X11 and is unfinished
> on other platforms, AFAIR.
> 
> Therefore I’d propose to make the whole lyxconvert „project“ platform
> specific as it tries to solve a problem we’re having on Mac only.
> The Mac bundle has the version-suffix at container level - no need
> to care for it in convertDefault.py. Instead I’d check for the platform
> and call lyxconvert on „darwin“ only with -platform minimal. Of course
> the user has to install Inkscape.app when he wants to include „real“ SVG
> images in his documents.
> 
> What do you think? IMO, the benefit on Mac is enough to take the risk.
> That’s not true for the other platforms.

I agree.

-- 
Enrico


Re: [PATCH] How to setup image converters on Mac?

2017-09-26 Thread Stephan Witt
Am 26.09.2017 um 21:10 schrieb Enrico Forestieri :
> 
> On Mon, Sep 25, 2017 at 11:38:05PM +0200, Stephan Witt wrote:
>> Am 25.09.2017 um 23:23 schrieb Enrico Forestieri :
>>> 
>>> 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 have cleaned up some of the icons but not all.

Thank you. BTW, what’s the tool to convert text to paths?

>> 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.
> 
> I think this is going to work on all platforms.
> 
>> 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.
> 
> I see the text when using the offscreen plugin but not when using the
> minimal one (characters are replaced by boxes in this case).

That makes sense. Minimal is a pure QImage as „screen“ - no fonts at all.
And „offscreen" is supported by e.g. Xnest for a long time with X11.
The Qt docs contain the statement it works good with X11 and is unfinished
on other platforms, AFAIR.

Therefore I’d propose to make the whole lyxconvert „project“ platform
specific as it tries to solve a problem we’re having on Mac only.
The Mac bundle has the version-suffix at container level - no need
to care for it in convertDefault.py. Instead I’d check for the platform
and call lyxconvert on „darwin“ only with -platform minimal. Of course
the user has to install Inkscape.app when he wants to include „real“ SVG
images in his documents.

What do you think? IMO, the benefit on Mac is enough to take the risk.
That’s not true for the other platforms.

Stephan

Re: [PATCH] How to setup image converters on Mac?

2017-09-26 Thread Enrico Forestieri
On Mon, Sep 25, 2017 at 11:38:05PM +0200, Stephan Witt wrote:
> Am 25.09.2017 um 23:23 schrieb Enrico Forestieri :
> > 
> > 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 have cleaned up some of the icons but not all.

> 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.

I think this is going to work on all platforms.

> 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.

I see the text when using the offscreen plugin but not when using the
minimal one (characters are replaced by boxes in this case).

-- 
Enrico


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Stephan Witt
Am 25.09.2017 um 23:23 schrieb Enrico Forestieri :
> 
> On Mon, Sep 25, 2017 at 08:50:11PM +0200, Stephan Witt wrote:
>> Am 25.09.2017 um 17:05 schrieb Enrico Forestieri :
>>> 
>>> 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

Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Enrico Forestieri
On Mon, Sep 25, 2017 at 08:50:11PM +0200, Stephan Witt wrote:
> Am 25.09.2017 um 17:05 schrieb Enrico Forestieri :
> > 
> > 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.

> 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. 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.

-- 
Enrico


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Stephan Witt
Am 25.09.2017 um 17:05 schrieb Enrico Forestieri :
> 
> On Mon, Sep 25, 2017 at 03:13:18PM +0200, Stephan Witt wrote:
> 
>> Am 25.09.2017 um 14:15 schrieb Enrico Forestieri :
>>> 
>>> On Mon, Sep 25, 2017 at 09:17:41AM +0200, Stephan Witt wrote:
 
 Oh no. I did some further testing and now I’m feeling blue.
 
 Not all SVG images we provide can be converted this way.
 
 $ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
 lyx/lib/images/math-subscript.svgz math-subscript.pdf
 lyxconvert: Load file 'lyx/lib/images/math-subscript.svgz', infmt is 'auto'
 Segmentation fault: 11
 $ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
 lyx/lib/images/math-superscript.svgz math-superscript.pdf
 lyxconvert: Load file 'lyx/lib/images/math-superscript.svgz', infmt is 
 'auto'
 lyxconvert: Save converted image to file 'math-superscript.pdf', outfmt is 
 ‚pdf'
 $
 
 Both images can be displayed in LyX work area. ImageMagick convert 
 processes them too.
 
 I’ve attached the current lyxconvert.cpp. Any idea?
>>> 
>>> Seemingly, this is due to using QCoreApplication instead of QApplication.
>>> Replace that and it should not segfault anymore.
>> 
>> That’s a possibility… I’ll try that. :(
>> 
>> But I was so happy being able to use QCoreApplication. Using QApplication
>> while latexing the user guide is a nightmare. Every converter call switches
>> the window focus away and back again (appr. 150 times).
> 
> I had a closer look at it seems the crash is due to the presence of text.
> In the specific case you report above, the text is empty but its
> specification is in the file. After removing the empty text it does not
> crash anymore. See the the attached image (I used a text editor and
> removed all ... elements from the svg).
> 
> 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.

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.

Stephan



0006-imgconvert.patch
Description: Binary data


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Kornel Benko
Am Montag, 25. September 2017 um 16:12:08, schrieb Stephan Witt 

> Am 25.09.2017 um 15:00 schrieb Kornel Benko :
> > 
> > Am Montag, 25. September 2017 um 14:33:04, schrieb Enrico Forestieri 
> > 
> >> On Mon, Sep 25, 2017 at 09:31:45AM +0200, Jean-Marc Lasgouttes wrote:
> >>> Le 25/09/2017 à 08:26, Stephan Witt a écrit :
>  Now I wonder if it would be better to name the utility lyxconvert.
>  It will be installed in /usr/local/bin or something like that?
> >>> 
> >>> I was about to suggest this. And then do we want to honor version-suffix? 
> >>> I
> >>> guess not, but we might end up installing several utilities with the same
> >>> name.
> > 
> > I'd say yes. The problem arises with package manager if I want different 
> > lyx-versions installed.
> > ATM, I have lyx2.1, lyx2.2, lyx2.3 and lyx2.4 installed without conflicts.
> 
> The version-suffix needs to be passed to or be part of convertDefault.py then?

Either way. I prefer it be part of convertDefault.py. This could be created 
from convertDefault.py.in.

> Stephan
> 
> > Cmake for debian seems (still) to be complicated in respect of creating 
> > multiple distinct packages
> > needed for e.g. common lyx data.
> > 
> >> Indeed. Maybe a specific install target would solve this. I mean it could
> >> be installed only if one explicitly issues "make install-lyxconvert".
> >> 
> > 
Kornel


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Enrico Forestieri
On Mon, Sep 25, 2017 at 03:13:18PM +0200, Stephan Witt wrote:

> Am 25.09.2017 um 14:15 schrieb Enrico Forestieri :
> > 
> > On Mon, Sep 25, 2017 at 09:17:41AM +0200, Stephan Witt wrote:
> >> 
> >> Oh no. I did some further testing and now I’m feeling blue.
> >> 
> >> Not all SVG images we provide can be converted this way.
> >> 
> >> $ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
> >> lyx/lib/images/math-subscript.svgz math-subscript.pdf
> >> lyxconvert: Load file 'lyx/lib/images/math-subscript.svgz', infmt is 'auto'
> >> Segmentation fault: 11
> >> $ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
> >> lyx/lib/images/math-superscript.svgz math-superscript.pdf
> >> lyxconvert: Load file 'lyx/lib/images/math-superscript.svgz', infmt is 
> >> 'auto'
> >> lyxconvert: Save converted image to file 'math-superscript.pdf', outfmt is 
> >> ‚pdf'
> >> $
> >> 
> >> Both images can be displayed in LyX work area. ImageMagick convert 
> >> processes them too.
> >> 
> >> I’ve attached the current lyxconvert.cpp. Any idea?
> > 
> > Seemingly, this is due to using QCoreApplication instead of QApplication.
> > Replace that and it should not segfault anymore.
> 
> That’s a possibility… I’ll try that. :(
> 
> But I was so happy being able to use QCoreApplication. Using QApplication
> while latexing the user guide is a nightmare. Every converter call switches
> the window focus away and back again (appr. 150 times).

I had a closer look at it seems the crash is due to the presence of text.
In the specific case you report above, the text is empty but its
specification is in the file. After removing the empty text it does not
crash anymore. See the the attached image (I used a text editor and
removed all ... elements from the svg).

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.

-- 
Enrico


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Stephan Witt
Am 25.09.2017 um 15:00 schrieb Kornel Benko :
> 
> Am Montag, 25. September 2017 um 14:33:04, schrieb Enrico Forestieri 
> 
>> On Mon, Sep 25, 2017 at 09:31:45AM +0200, Jean-Marc Lasgouttes wrote:
>>> Le 25/09/2017 à 08:26, Stephan Witt a écrit :
 Now I wonder if it would be better to name the utility lyxconvert.
 It will be installed in /usr/local/bin or something like that?
>>> 
>>> I was about to suggest this. And then do we want to honor version-suffix? I
>>> guess not, but we might end up installing several utilities with the same
>>> name.
> 
> I'd say yes. The problem arises with package manager if I want different 
> lyx-versions installed.
> ATM, I have lyx2.1, lyx2.2, lyx2.3 and lyx2.4 installed without conflicts.

The version-suffix needs to be passed to or be part of convertDefault.py then?

Stephan

> Cmake for debian seems (still) to be complicated in respect of creating 
> multiple distinct packages
> needed for e.g. common lyx data.
> 
>> Indeed. Maybe a specific install target would solve this. I mean it could
>> be installed only if one explicitly issues "make install-lyxconvert".
>> 
> 
>   Kornel



Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Stephan Witt
Am 25.09.2017 um 14:15 schrieb Enrico Forestieri :
> 
> On Mon, Sep 25, 2017 at 09:17:41AM +0200, Stephan Witt wrote:
>> 
>> Oh no. I did some further testing and now I’m feeling blue.
>> 
>> Not all SVG images we provide can be converted this way.
>> 
>> $ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
>> lyx/lib/images/math-subscript.svgz math-subscript.pdf
>> lyxconvert: Load file 'lyx/lib/images/math-subscript.svgz', infmt is 'auto'
>> Segmentation fault: 11
>> $ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
>> lyx/lib/images/math-superscript.svgz math-superscript.pdf
>> lyxconvert: Load file 'lyx/lib/images/math-superscript.svgz', infmt is 'auto'
>> lyxconvert: Save converted image to file 'math-superscript.pdf', outfmt is 
>> ‚pdf'
>> $
>> 
>> Both images can be displayed in LyX work area. ImageMagick convert processes 
>> them too.
>> 
>> I’ve attached the current lyxconvert.cpp. Any idea?
> 
> Seemingly, this is due to using QCoreApplication instead of QApplication.
> Replace that and it should not segfault anymore.

That’s a possibility… I’ll try that. :(

But I was so happy being able to use QCoreApplication. Using QApplication
while latexing the user guide is a nightmare. Every converter call switches
the window focus away and back again (appr. 150 times).

Stephan

Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Kornel Benko
Am Montag, 25. September 2017 um 14:33:04, schrieb Enrico Forestieri 

> On Mon, Sep 25, 2017 at 09:31:45AM +0200, Jean-Marc Lasgouttes wrote:
> > Le 25/09/2017 à 08:26, Stephan Witt a écrit :
> > > Now I wonder if it would be better to name the utility lyxconvert.
> > > It will be installed in /usr/local/bin or something like that?
> > 
> > I was about to suggest this. And then do we want to honor version-suffix? I
> > guess not, but we might end up installing several utilities with the same
> > name.

I'd say yes. The problem arises with package manager if I want different 
lyx-versions installed.
ATM, I have lyx2.1, lyx2.2, lyx2.3 and lyx2.4 installed without conflicts.

Cmake for debian seems (still) to be complicated in respect of creating 
multiple distinct packages
needed for e.g. common lyx data.

> Indeed. Maybe a specific install target would solve this. I mean it could
> be installed only if one explicitly issues "make install-lyxconvert".
> 

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Enrico Forestieri
On Mon, Sep 25, 2017 at 09:31:45AM +0200, Jean-Marc Lasgouttes wrote:
> Le 25/09/2017 à 08:26, Stephan Witt a écrit :
> > Now I wonder if it would be better to name the utility lyxconvert.
> > It will be installed in /usr/local/bin or something like that?
> 
> I was about to suggest this. And then do we want to honor version-suffix? I
> guess not, but we might end up installing several utilities with the same
> name.

Indeed. Maybe a specific install target would solve this. I mean it could
be installed only if one explicitly issues "make install-lyxconvert".

-- 
Enrico


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Enrico Forestieri
On Mon, Sep 25, 2017 at 09:17:41AM +0200, Stephan Witt wrote:
> 
> Oh no. I did some further testing and now I’m feeling blue.
> 
> Not all SVG images we provide can be converted this way.
> 
> $ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
> lyx/lib/images/math-subscript.svgz math-subscript.pdf
> lyxconvert: Load file 'lyx/lib/images/math-subscript.svgz', infmt is 'auto'
> Segmentation fault: 11
> $ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
> lyx/lib/images/math-superscript.svgz math-superscript.pdf
> lyxconvert: Load file 'lyx/lib/images/math-superscript.svgz', infmt is 'auto'
> lyxconvert: Save converted image to file 'math-superscript.pdf', outfmt is 
> ‚pdf'
> $
> 
> Both images can be displayed in LyX work area. ImageMagick convert processes 
> them too.
> 
> I’ve attached the current lyxconvert.cpp. Any idea?

Seemingly, this is due to using QCoreApplication instead of QApplication.
Replace that and it should not segfault anymore.

-- 
Enrico


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Jean-Marc Lasgouttes

Le 25/09/2017 à 10:57, Stephan Witt a écrit :

Am 25.09.2017 um 09:31 schrieb Jean-Marc Lasgouttes :


Le 25/09/2017 à 08:26, Stephan Witt a écrit :

Now I wonder if it would be better to name the utility lyxconvert.
It will be installed in /usr/local/bin or something like that?


I was about to suggest this. And then do we want to honor version-suffix? I 
guess not, but we might end up installing several utilities with the same name.

Another solution is to name it qimageconvert or something and distribute it 
separately.


I wanted to avoid the Q because of the option to re-implement it with libcairo.


Fine with me.

JMarc


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Stephan Witt
Am 25.09.2017 um 09:31 schrieb Jean-Marc Lasgouttes :
> 
> Le 25/09/2017 à 08:26, Stephan Witt a écrit :
>> Now I wonder if it would be better to name the utility lyxconvert.
>> It will be installed in /usr/local/bin or something like that?
> 
> I was about to suggest this. And then do we want to honor version-suffix? I 
> guess not, but we might end up installing several utilities with the same 
> name.
> 
> Another solution is to name it qimageconvert or something and distribute it 
> separately.

I wanted to avoid the Q because of the option to re-implement it with libcairo.

Stephan

Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Jean-Marc Lasgouttes

Le 25/09/2017 à 08:26, Stephan Witt a écrit :

Now I wonder if it would be better to name the utility lyxconvert.
It will be installed in /usr/local/bin or something like that?


I was about to suggest this. And then do we want to honor 
version-suffix? I guess not, but we might end up installing several 
utilities with the same name.


Another solution is to name it qimageconvert or something and distribute 
it separately.


JMarc


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Stephan Witt
Am 25.09.2017 um 04:35 schrieb Scott Kostyshak :
> 
> On Sun, Sep 24, 2017 at 11:39:09PM +0200, Enrico Forestieri wrote:
> 
>> It works for me on linux and cygwin. Of course, one has to move away
>> convert, rsvg-convert, and inkscape to appreciate that.
> 
> Thanks, Stephan, for the patch, and Enrico, for testing on Linux and
> Cygwin. I think it is a good plan for 2.3.0. Stephan, I would say go
> ahead and put it in the 2.3.x branch if you are comfortable with it.
> 
> Scott

Oh no. I did some further testing and now I’m feeling blue.

Not all SVG images we provide can be converted this way.

$ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
lyx/lib/images/math-subscript.svgz math-subscript.pdf
lyxconvert: Load file 'lyx/lib/images/math-subscript.svgz', infmt is 'auto'
Segmentation fault: 11
$ lyx-build/LyX-2.4.0dev.app/Contents/MacOS/lyxconvert -d 
lyx/lib/images/math-superscript.svgz math-superscript.pdf
lyxconvert: Load file 'lyx/lib/images/math-superscript.svgz', infmt is 'auto'
lyxconvert: Save converted image to file 'math-superscript.pdf', outfmt is ‚pdf'
$

Both images can be displayed in LyX work area. ImageMagick convert processes 
them too.

I’ve attached the current lyxconvert.cpp. Any idea?

Stephan



lyxconvert.cpp
Description: Binary data


Re: [PATCH] How to setup image converters on Mac?

2017-09-25 Thread Stephan Witt
Am 24.09.2017 um 23:39 schrieb Enrico Forestieri :
> 
> On Sun, Sep 24, 2017 at 10:06:24PM +0200, Stephan Witt wrote:
>> Am 24.09.2017 um 18:26 schrieb Stephan Witt :
>>> Am 24.09.2017 um 18:12 schrieb Enrico Forestieri :
 On Sun, Sep 24, 2017 at 12:24:26PM +0200, Stephan Witt wrote:
> 
> This is the solution I’d like to propose. It’s not tested on Linux and
> Windows.
> 
> The idea is to add imgconvert as fallback-converter for SVG to PDF and
> PNG to PDF.
> At the moment it uses the Qt library routines for image processing. I’ll
> plan to investigate how to integrate libcairo for real vector graphics
> conversion.
> 
> I’d like to hear your comments.
 
 I think it is fine. However, I would avoid introducing 2 more converters
 and instead I would modify convertDefault.py so that when imagemagick is
 not installed the new imgconvert command is used.
 
 In this way, whatever conversion between image formats supported by Qt
 would succeed (without the need of new converter definitions).
>>> 
>>> This is a good idea too. I have to admit, I had scruple to do this.
>>> I’ll try to present a patch with this alternative.
>> 
>> Here it is.
>> 
>> I’ve improved imgconvert utility further and modified convertDefault.py
>> to call it if the version of convert couldn’t be detected.
>> 
>> Stephan
>> 
>> PS. Of course not tested on Linux and Windows (again).
> 
> It works for me on linux and cygwin. Of course, one has to move away
> convert, rsvg-convert, and inkscape to appreciate that.

Thank you for testing.

Now I wonder if it would be better to name the utility lyxconvert.
It will be installed in /usr/local/bin or something like that?

I’d like to change it to avoid a potential name conflict. What do you think?

Stephan

Re: [PATCH] How to setup image converters on Mac?

2017-09-24 Thread Scott Kostyshak
On Sun, Sep 24, 2017 at 11:39:09PM +0200, Enrico Forestieri wrote:

> It works for me on linux and cygwin. Of course, one has to move away
> convert, rsvg-convert, and inkscape to appreciate that.

Thanks, Stephan, for the patch, and Enrico, for testing on Linux and
Cygwin. I think it is a good plan for 2.3.0. Stephan, I would say go
ahead and put it in the 2.3.x branch if you are comfortable with it.

Scott


signature.asc
Description: PGP signature


Re: [PATCH] How to setup image converters on Mac?

2017-09-24 Thread Enrico Forestieri
On Sun, Sep 24, 2017 at 10:06:24PM +0200, Stephan Witt wrote:
> Am 24.09.2017 um 18:26 schrieb Stephan Witt :
> > Am 24.09.2017 um 18:12 schrieb Enrico Forestieri :
> >> On Sun, Sep 24, 2017 at 12:24:26PM +0200, Stephan Witt wrote:
> >>> 
> >>> This is the solution I’d like to propose. It’s not tested on Linux and
> >>> Windows.
> >>> 
> >>> The idea is to add imgconvert as fallback-converter for SVG to PDF and
> >>> PNG to PDF.
> >>> At the moment it uses the Qt library routines for image processing. I’ll
> >>> plan to investigate how to integrate libcairo for real vector graphics
> >>> conversion.
> >>> 
> >>> I’d like to hear your comments.
> >> 
> >> I think it is fine. However, I would avoid introducing 2 more converters
> >> and instead I would modify convertDefault.py so that when imagemagick is
> >> not installed the new imgconvert command is used.
> >> 
> >> In this way, whatever conversion between image formats supported by Qt
> >> would succeed (without the need of new converter definitions).
> > 
> > This is a good idea too. I have to admit, I had scruple to do this.
> > I’ll try to present a patch with this alternative.
> 
> Here it is.
> 
> I’ve improved imgconvert utility further and modified convertDefault.py
> to call it if the version of convert couldn’t be detected.
> 
> Stephan
> 
> PS. Of course not tested on Linux and Windows (again).

It works for me on linux and cygwin. Of course, one has to move away
convert, rsvg-convert, and inkscape to appreciate that.

-- 
Enrico


Re: [PATCH] How to setup image converters on Mac?

2017-09-24 Thread Stephan Witt
Am 24.09.2017 um 18:26 schrieb Stephan Witt :
> 
> Am 24.09.2017 um 18:12 schrieb Enrico Forestieri :
>> 
>> On Sun, Sep 24, 2017 at 12:24:26PM +0200, Stephan Witt wrote:
>>> 
>>> This is the solution I’d like to propose. It’s not tested on Linux and
>>> Windows.
>>> 
>>> The idea is to add imgconvert as fallback-converter for SVG to PDF and PNG 
>>> to
>>> PDF.
>>> At the moment it uses the Qt library routines for image processing. I’ll 
>>> plan
>>> to investigate how to integrate libcairo for real vector graphics 
>>> conversion.
>>> 
>>> I’d like to hear your comments.
>> 
>> I think it is fine. However, I would avoid introducing 2 more converters
>> and instead I would modify convertDefault.py so that when imagemagick is
>> not installed the new imgconvert command is used.
>> 
>> In this way, whatever conversion between image formats supported by Qt
>> would succeed (without the need of new converter definitions).
> 
> This is a good idea too. I have to admit, I had scruple to do this.
> I’ll try to present a patch with this alternative.

Here it is.

I’ve improved imgconvert utility further and modified convertDefault.py
to call it if the version of convert couldn’t be detected.

Stephan

PS. Of course not tested on Linux and Windows (again).



0003-imgconvert.patch
Description: Binary data


Re: [PATCH] How to setup image converters on Mac?

2017-09-24 Thread Stephan Witt
Am 24.09.2017 um 18:12 schrieb Enrico Forestieri :
> 
> On Sun, Sep 24, 2017 at 12:24:26PM +0200, Stephan Witt wrote:
>> 
>> This is the solution I’d like to propose. It’s not tested on Linux and
>> Windows.
>> 
>> The idea is to add imgconvert as fallback-converter for SVG to PDF and PNG to
>> PDF.
>> At the moment it uses the Qt library routines for image processing. I’ll plan
>> to investigate how to integrate libcairo for real vector graphics conversion.
>> 
>> I’d like to hear your comments.
> 
> I think it is fine. However, I would avoid introducing 2 more converters
> and instead I would modify convertDefault.py so that when imagemagick is
> not installed the new imgconvert command is used.
> 
> In this way, whatever conversion between image formats supported by Qt
> would succeed (without the need of new converter definitions).

This is a good idea too. I have to admit, I had scruple to do this.
I’ll try to present a patch with this alternative.

Stephan