Page 2 of 3

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-06T08:27:12-07:00
by Bob Pickle
This looks promising. I can see how to do strokes/outlines, but haven't yet come up with line spacing. We'll keep at it.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-06T09:09:04-07:00
by snibgo
I would use line-height as an attribute of flowRoot. See http://www.w3.org/TR/CSS2/visudet.html#line-height

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-06T11:29:11-07:00
by Bob Pickle
snibgo wrote:I would use line-height as an attribute of flowRoot. See http://www.w3.org/TR/CSS2/visudet.html#line-height
snibgo, could you tell me how to get IM to use Inkscape, since I think flowRoot is something that Inkscape uses, not IM? I'm running IM under cygwin.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-06T11:52:07-07:00
by Bob Pickle
Maybe I've found out how. We'll see.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-06T12:02:58-07:00
by snibgo
To use Inkscape from IM:

1. Download from http://inkscape.org/en/download/?lang=en and install.
2. Put the Inkscape directory in the system path. (I use Windows, so I "set PATH={inkscape's directory};%PATH%".)
3. IM will now use Inkscape. Check this by converting a SVG file to PNG with "-verbose". It should give the Inkscape command, and should not say MSVG or RSVG.

"flowroot" is an SVG tag. See my example at viewtopic.php?f=1&t=24381&p=104664 . I contained the text in fancy shapes. You might want a rectangle.

Change the flowroot line to be "<flowRoot font-size="30" line-height="150%" ..." or whatever you want.

This works, when driving Inkscape from IM; it puts a bigger space between lines, which I think is what you want. As far as I know flowroot etc is the only way to break text lines in SVG. I haven't tried it in Arabic.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-08T10:40:10-07:00
by Bob Pickle
I got InkScape installed under CygWin, but can't get IM to use it, whether the IM version installed via CygWin, or the latest CygWin version downloaded from here. Any suggestions on how to tell IM where to find InkScape?

Further, while Pango still works, the output looks terrible now, sort of like it's being produced in a very, very small resolution, and then blown up to the requested size. I don't get what would have caused such a change. That's using the same version of IM that I was using before.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-08T11:52:51-07:00
by snibgo
Sorry, I don't use Cygwin. In ordinary Windows, it works as I've described.

Perhaps you need to specify the path to Inkscape in delegates.xml.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-08T12:44:39-07:00
by snibgo
It occurs to me: When you are in cygwin, can you start Inkscape from the command line? If not, then you should either do whatever you need to in cycwin to enable this, or include the path to inkscape in delegates.xml.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-08T13:00:44-07:00
by Bob Pickle
I can reach Inkscape from the command line, and by twiddling with delegates.xml, was able to pass commands to Inkscape.

But not correctly.

Code: Select all

convert: unable to open image `/tmp/magick-6204TJ_ZRYGCOXlM': No such file or directory @ error/blob.c/OpenBlob/2644.
convert: unable to open file `/tmp/magick-6204TJ_ZRYGCOXlM': No such file or directory @ error/constitute.c/ReadImage/591.
convert: no images defined `arabic3.png' @ error/convert.c/ConvertImageCommand/3106.
Using the verbose option I also get:

Code: Select all

"/bin/inkscape" "0" --export-png="0" --export-dpi="0" --export-background="0" --export-background-opacity="0" > "0" 2>&1
Obviously, that's way wrong. The line in delegates.xml is as follows:

Code: Select all

  <delegate decode="svg" stealth="True" command=""/bin/inkscape" "%s" --export-png="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
It used to say svg:decode. Maybe that's the problem. But when I use svg:decode I get:

Code: Select all

convert: no decode delegate for this image format `arabic3.svg' @ error/constitute.c/ReadImage/552.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-08T16:01:06-07:00
by snibgo
Someone who uses IM under Cygwin may be able to help more than I can. My delegates.xml, for IM v6.8.7-0, running under normal Windows 7, has:

Code: Select all

<delegate decode="svg:decode" stealth="True" command=""inkscape" "%s" --export-png="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
As you can run Inkscape from the command line, you could simply do that, as a workaround.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-11T17:11:28-07:00
by Bob Pickle
snibgo wrote:As you can run Inkscape from the command line, you could simply do that, as a workaround.
Possibly. I was trying to get it set up in Cygwin because the ultimate destination is Linux rather than Windows. In playing around with IM on Linux I discovered this:

Code: Select all

Version: ImageMagick 6.8.7-4 2013-11-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype gslib jng jp2 jpeg lcms ltdl openexr pango pangocairo png ps png rsvg tiff webp wmf x xml zlib
I see that Cairo, Pango, and PangoCairo are listed as separate delegates. What exactly does that mean? I know how to invoke Pango. How does one invoke Cairo and/or PangoCairo, or does "convert pango:" on the commandline automatically invoke all three?

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-11T17:27:10-07:00
by fmw42
If you have installed pango, then IM should see it and use it when you do

convert .... PANGO:"some text here" result

(unless you have potential conflicts between your various pango, cairo, pangocairo???)

see
http://www.imagemagick.org/Usage/text/#pango

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-11T17:37:52-07:00
by Bob Pickle
Yes, I know how to use Pango. The reason I was asking is that I'm under the impression that Cairo or PangoCairo may have some features that just Pango doesn't have. So I'd like to try out PangoCairo, but have no idea how to do that, since convert pangocairo: and convert cairo: don't do anything.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-11T18:40:27-07:00
by fmw42
IM automatically calls the delegates (that it knows about) when some particular command (such as PANGO) is called or some specific input image or output image format is needed. For example when reading PDFs, IM uses Ghostscript. When doing -liquid-rescale, IM calls liblqr, if available.

When calling PANGO, it will use whichever is needed. There is no such thing in IM as PANGOCAIRO: or CAIRO:. Only PANGO:

Try

convert -verbose -size 500x500 xc:white -fill black PANGO:"this is some text" result.png

See if the -verbose, spits out what delegate is being used by calling PANGO:. This presumes when you installed IM, the "correct" PANGO was recognized.

If you want to try the others, then you have to call them outside of IM by their proper names as defined by their documentation.

Re: Strokes in Pango vs. Complex scripts in IM

Posted: 2013-12-11T19:36:46-07:00
by Bob Pickle
Thank you for your reply. Could you explain why cairopango and cairo are listed as delegates?

Code: Select all

Version: ImageMagick 6.8.7-4 2013-11-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype gslib jng jp2 jpeg lcms ltdl openexr pango pangocairo png ps png rsvg tiff webp wmf x xml zlib
When do they get used? When using pango?

Your suggested command produced the following output.

Code: Select all

-bash-4.1$ convert -verbose -size 500x500 xc:white -fill black PANGO:"this is some text" result.png
xc:white=>white XC 500x500 500x500+0+0 16-bit sRGB 0.000u 0:00.000
PANGO:this is some text=>this is some text PANGO 500x500 500x500+0+0 16-bit sRGB 0.020u 0:00.010
xc:white=>result-0.png[0] XC 500x500 500x500+0+0 8-bit sRGB 1c 296B 0.040u 0:00.039
PANGO:this is some text=>result-1.png[1] PANGO 500x500 500x500+0+0 8-bit sRGB 130c 1.39KB 0.040u 0:00.029