Text Align with Pango

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
rafaelt
Posts: 2
Joined: 2013-12-12T11:02:56-07:00
Authentication code: 6789
Location: Campinas, Sao Paulo, Brazil

Text Align with Pango

Post by rafaelt »

Hello!

I'm currently using ImageMagick with Pango and the image consists in a background with three texts.

A main text on the top and two others in the footer. I want them align on the right side, but I can't find a pango command to do so. I also tried "justify", just to see the effect and it didn't work. Am I doing anything wrong? My command is:

Code: Select all

    convert -size 390x30 -background transparent -define pango:justify=true pango:"footer 1" footer1.png
    convert -size 390x30 -background transparent -define pango:justify=true pango:"footer 2" footer2.png
    convert -size 390x390 -background transparent -define pango:wrap=word-char pango:"main text" main.png
    
    convert -size 512x512 \
            -page +0+0 /opt/images/backgrounds/green.png  \
            -page +61+61 -size 390x390 footer1.png \
            -page +55+447 -size 390x30  footer2.png \
            -page +55+465 -size 390x30  main.png \
            -layers flatten final-image.jpg
My questions are:

1. Am I doing anything wrong?
2. Is there a Pango+IM command to align footer #1 and footer #2 to the right?
3. Is there a Pango+IM command to vertical align the main text to the bottom?


Thanks a lot for your attention!
Last edited by rafaelt on 2013-12-12T11:52:24-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: TextAlign with Pango

Post by fmw42 »

I have not used PANGO, yet.

But for 3) add the IM command -gravity south.

You may try also -define pango:gravity=east for the alignment. But that is just a guess.
rafaelt
Posts: 2
Joined: 2013-12-12T11:02:56-07:00
Authentication code: 6789
Location: Campinas, Sao Paulo, Brazil

Re: Text Align with Pango

Post by rafaelt »

For 3), when I use -gravity south, the text goes to the bottom but it also flips. I thought it was the normal behavior of -gravity south.

For -define pango:gravity=east, it does not change anything in the text alignment. Weird, huh? :?

I did not know about -define pango:gravity=east, I was trying -gravity from IM, but it does not seem to be the solution to my problems since when I try to generate images in Japanese or Chinese, for instance, the text goes to the right but each character rotates 90º to east, so they look like they were lying.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Text Align with Pango

Post by fmw42 »

rafaelt wrote:For 3), when I use -gravity south, the text goes to the bottom but it also flips. I thought it was the normal behavior of -gravity south.

For -define pango:gravity=east, it does not change anything in the text alignment. Weird, huh? :?

I did not know about -define pango:gravity=east, I was trying -gravity from IM, but it does not seem to be the solution to my problems since when I try to generate images in Japanese or Chinese, for instance, the text goes to the right but each character rotates 90º to east, so they look like they were lying.



-define pango:gravity=east was just a guess on my part. I suppose it does not exist.

-gravity south in the IM command should not flip the text, only move it to the bottom.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Text Align with Pango

Post by magick »

Here are the defines that affect Pango rendering: -define pango:auto-dir=true/false, -define pango:ellipsize=start/middle/end, -define pango:gravity-hint=natural/strong/line, -define pango:hinting=none/auto/full, -define pango:indent=points, -define pango:justify=true/false, -define pango:language=en_US/etc, -define pango:markup=true/false, -define pango:single-paragraph=true/false and -define pango:wrap=word/char/word-char.
Post Reply