Pango - Slowness
Pango - Slowness
Hello,
I'm using Pango to write arabic sentences over image but the problem that it is much slower than Label.
For example, each time I use label it takes 8 milliseconds and Pango takes 25 milliseconds.
Is there something to do about the speed?
BTW, I would rather use draw text than Pango or Label, so if you know any other way to write Arabic character with draw text it would be great.
Thank you
I'm using Pango to write arabic sentences over image but the problem that it is much slower than Label.
For example, each time I use label it takes 8 milliseconds and Pango takes 25 milliseconds.
Is there something to do about the speed?
BTW, I would rather use draw text than Pango or Label, so if you know any other way to write Arabic character with draw text it would be great.
Thank you
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Pango - Slowness
In my IM experiments with Arabic text, the only correct rendering is with Pango.
snibgo's IM pages: im.snibgo.com
Re: Pango - Slowness
oh, well do you know any way to scale up an image, or maybe create a vector?
What I'm looking to do is to create one image/vector with the Arabic sentence and then scale it up and down as I need to.
And one more thing is, how can I create stroke to text with Pango?
Thanks!
What I'm looking to do is to create one image/vector with the Arabic sentence and then scale it up and down as I need to.
And one more thing is, how can I create stroke to text with Pango?
Thanks!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Pango - Slowness
You can write the Arabic text into an SVG file, then render that. Inkscape works fine for that. IM can tell Inkscape to scale to whatever size you want.
snibgo's IM pages: im.snibgo.com
Re: Pango - Slowness
Ok, I can try that. Do you have an example for how to create svg file with pango?
What about the stroke, any ideas?
What about the stroke, any ideas?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Pango - Slowness
No. But you can create one with a text editor. For example, paste this into a file called arabicSvg2.svg:rotem wrote:Do you have an example for how to create svg file with pango?
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
width="400px"
height="200px"
id="svg2"
version="1.1">
<g
id="layer1">
<text
xml:space="preserve"
style="fill:#000000;fill-opacity:1;stroke:none"
x="100"
y="100"
id="text2816"><tspan
id="tspan2818"
>šŋĩβģő élève äëïöü صَوْرة سِحْر</tspan></text>
</g>
</svg>
Then run this command:
Code: Select all
convert -verbose -density 400 arabicSvg2.svg -trim +repage arabicSvg2.png
SVG with Inkscape is much slower than Pango.
I don't know what "create stroke to text" means.
snibgo's IM pages: im.snibgo.com
Re: Pango - Slowness
Thank you for the SVG example.
When I run the command you gave me I get:
and this is the result image
am I doing something wrong?
(as for the stroke I mean the text stroke which can be added with the SVG)
--------------------------- UPDATE ------------------------------
I installed inkscape and now I get this message and an empty image
When I run the command you gave me I get:
Code: Select all
'inkscape' '/var/tmp/magick-57991dFioi5ZvgEps' --export-png='/var/tmp/magick-57991FCnP3PrpjFMj' --export-dpi='400,400' --export-background='rgb(0%,0%,0%)' --export-background-opacity='0' > '/var/tmp/magick-57991X06JGQLS2JSi' 2>&1
Fontconfig error: Cannot load default config file
Fontconfig error: Cannot load default config file
mvg:/var/tmp/magick-57991fbO4OlNaMKaq=>/var/tmp/magick-57991fbO4OlNaMKaq MVG 2222x1111 2222x1111+0+0 16-bit sRGB 337B 0.030u 0:00.029
1.svg MVG 2222x1111 2222x1111+0+0 16-bit sRGB 337B 0.010u 0:00.019
1.svg=>1.png MVG 2222x1111=>887x69 8-bit sRGB 11.3KB 0.010u 0:00.009
am I doing something wrong?
(as for the stroke I mean the text stroke which can be added with the SVG)
--------------------------- UPDATE ------------------------------
I installed inkscape and now I get this message and an empty image
Code: Select all
'inkscape' '/var/tmp/magick-75838qR4kn1zwPs3J' --export-png='/var/tmp/magick-75838bSUH0TYvxEOD' --export-dpi='300,300' --export-background='rgb(100%,100%,100%)' --export-background-opacity='1' > '/var/tmp/magick-75838kkXJNVLcFAoy' 2>&1
/var/tmp/magick-75838bSUH0TYvxEOD PNG 1333x667 1333x667+0+0 8-bit sRGB 5.16KB 0.020u 0:00.019
1.svg SVG 1333x667 1333x667+0+0 8-bit sRGB 5.16KB 0.000u 0:00.009
1.svg=>1.png SVG 1333x667=>1x1 8-bit sRGB 2c 317B 0.000u 0:00.000
convert: geometry does not contain image `1.svg' @ warning/attribute.c/GetImageBoundingBox/247.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Pango - Slowness
In your result, each character is written separately, and in the wrong order (left to right), so something is wrong.
Yes, Inkscape will do text strokes. It does most of SVG 1.1.
So the problem may be in "fontconfig".Fontconfig error: Cannot load default config file
Yes, Inkscape will do text strokes. It does most of SVG 1.1.
snibgo's IM pages: im.snibgo.com
Re: Pango - Slowness
Hey,
I managed to fix the fontconfig error but the output is still reversed...
What I couldn't figure out is how Pango and Inkscape are connected?
If I install Inkscape with `brew install inkscape` and now I get this message and an empty image file
if I remove the `-trim` I get an image with the right size but without any text inside it
I managed to fix the fontconfig error but the output is still reversed...
What I couldn't figure out is how Pango and Inkscape are connected?
If I install Inkscape with `brew install inkscape` and now I get this message and an empty image file
Code: Select all
'inkscape' '/var/tmp/magick-75838qR4kn1zwPs3J' --export-png='/var/tmp/magick-75838bSUH0TYvxEOD' --export-dpi='300,300' --export-background='rgb(100%,100%,100%)' --export-background-opacity='1' > '/var/tmp/magick-75838kkXJNVLcFAoy' 2>&1
/var/tmp/magick-75838bSUH0TYvxEOD PNG 1333x667 1333x667+0+0 8-bit sRGB 5.16KB 0.020u 0:00.019
1.svg SVG 1333x667 1333x667+0+0 8-bit sRGB 5.16KB 0.000u 0:00.009
1.svg=>1.png SVG 1333x667=>1x1 8-bit sRGB 2c 317B 0.000u 0:00.000
convert: geometry does not contain image `1.svg' @ warning/attribute.c/GetImageBoundingBox/247.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Pango - Slowness
Inkscape doesn't use Pango. Pango doesn't use Inkscape.
Try running Inkscape without IM. Can it read your SVG? Does it show correctly?
Try running Inkscape without IM. Can it read your SVG? Does it show correctly?
snibgo's IM pages: im.snibgo.com
Re: Pango - Slowness
I will try it in a sec.
Just one more question, can Inkscape with SVG create a good Arabic text like Pango make?
Just one more question, can Inkscape with SVG create a good Arabic text like Pango make?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Pango - Slowness
I don't know. It will depend on the font. Try it and see.
snibgo's IM pages: im.snibgo.com
Re: Pango - Slowness
Well, what font did you use to create the example you sent me?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Pango - Slowness
I didn't specify a font, so Inkscape chose one. It might be Times New Roman.
snibgo's IM pages: im.snibgo.com
Re: Pango - Slowness
This is what I get when I run
The file is in the right size but empty without any text.
What should I do?
Code: Select all
inkscape -z -e 1.png 1.svg
Code: Select all
(process:78596): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
2016-05-23 23:28:34.329 inkscape[78596:5066113] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
Fontconfig error: Cannot load default config file
Fontconfig warning: ignoring UTF-8: not a valid region tag
Background RRGGBBAA: ffffff00
Area 0:0:400:200 exported to 400 x 200 pixels (90 dpi)
Bitmap saved as: 1.png
What should I do?