Strokes in Pango vs. Complex scripts in IM
-
- Posts: 20
- Joined: 2013-11-11T08:52:56-07:00
- Authentication code: 6789
Re: Strokes in Pango vs. Complex scripts in IM
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Strokes in Pango vs. Complex scripts in IM
I would use line-height as an attribute of flowRoot. See http://www.w3.org/TR/CSS2/visudet.html#line-height
snibgo's IM pages: im.snibgo.com
-
- Posts: 20
- Joined: 2013-11-11T08:52:56-07:00
- Authentication code: 6789
Re: Strokes in Pango vs. Complex scripts in IM
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.snibgo wrote:I would use line-height as an attribute of flowRoot. See http://www.w3.org/TR/CSS2/visudet.html#line-height
-
- Posts: 20
- Joined: 2013-11-11T08:52:56-07:00
- Authentication code: 6789
Re: Strokes in Pango vs. Complex scripts in IM
Maybe I've found out how. We'll see.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Strokes in Pango vs. Complex scripts in IM
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.
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.
snibgo's IM pages: im.snibgo.com
-
- Posts: 20
- Joined: 2013-11-11T08:52:56-07:00
- Authentication code: 6789
Re: Strokes in Pango vs. Complex scripts in IM
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.
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Strokes in Pango vs. Complex scripts in IM
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.
Perhaps you need to specify the path to Inkscape in delegates.xml.
snibgo's IM pages: im.snibgo.com
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Strokes in Pango vs. Complex scripts in IM
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.
snibgo's IM pages: im.snibgo.com
-
- Posts: 20
- Joined: 2013-11-11T08:52:56-07:00
- Authentication code: 6789
Re: Strokes in Pango vs. Complex scripts in IM
I can reach Inkscape from the command line, and by twiddling with delegates.xml, was able to pass commands to Inkscape.
But not correctly.
Using the verbose option I also get:
Obviously, that's way wrong. The line in delegates.xml is as follows:
It used to say svg:decode. Maybe that's the problem. But when I use svg:decode I get:
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.
Code: Select all
"/bin/inkscape" "0" --export-png="0" --export-dpi="0" --export-background="0" --export-background-opacity="0" > "0" 2>&1
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"/>
Code: Select all
convert: no decode delegate for this image format `arabic3.svg' @ error/constitute.c/ReadImage/552.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Strokes in Pango vs. Complex scripts in IM
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:
As you can run Inkscape from the command line, you could simply do that, as a workaround.
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"/>
snibgo's IM pages: im.snibgo.com
-
- Posts: 20
- Joined: 2013-11-11T08:52:56-07:00
- Authentication code: 6789
Re: Strokes in Pango vs. Complex scripts in IM
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:snibgo wrote:As you can run Inkscape from the command line, you could simply do that, as a workaround.
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
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Strokes in Pango vs. Complex scripts in IM
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
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
-
- Posts: 20
- Joined: 2013-11-11T08:52:56-07:00
- Authentication code: 6789
Re: Strokes in Pango vs. Complex scripts in IM
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.
Last edited by Bob Pickle on 2013-12-11T19:29:06-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Strokes in Pango vs. Complex scripts in IM
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.
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.
-
- Posts: 20
- Joined: 2013-11-11T08:52:56-07:00
- Authentication code: 6789
Re: Strokes in Pango vs. Complex scripts in IM
Thank you for your reply. Could you explain why cairopango and cairo are listed as delegates?
When do they get used? When using pango?
Your suggested command produced the following output.
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
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