List Info

Thread: Pango problem




Pango problem
country flaguser name
Poland
2007-08-19 16:08:41
Hello

I'm rendering a line of text with Pango. The markup has
foreground and 
background attributes used few times to change colors. I'm
drawing the 
layout to a pixmap with height few (device) pixels greater
then text 
rendered by Pango. The problem is, that on my surplus space,
I have my 
old background color. How I can set up Pango to also draw
text 
background color there?

-- 
Semper Fidelis

Adam Klobukowski
adamklobukowskigmail.com
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-listgnome.org

http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Re: Pango problem
country flaguser name
Canada
2007-08-19 22:41:20
On Sun, 2007-08-19 at 23:08 +0200, Adam Klobukowski wrote:
> Hello
> 
> I'm rendering a line of text with Pango. The markup has
foreground and 
> background attributes used few times to change colors.
I'm drawing the 
> layout to a pixmap with height few (device) pixels
greater then text 
> rendered by Pango. The problem is, that on my surplus
space, I have my 
> old background color. How I can set up Pango to also
draw text 
> background color there?

Hi,

In that case you are best clearing the pixmap to your
desired background
color first and then using pango to render text on it.

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase
a little
 Temporary Safety, deserve neither Liberty nor
Safety."
        -- Benjamin Franklin, 1759



_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-listgnome.org

http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Re: Pango problem
country flaguser name
Poland
2007-08-20 00:31:59
Behdad Esfahbod pisze:
> On Sun, 2007-08-19 at 23:08 +0200, Adam Klobukowski
wrote:
>> Hello
>>
>> I'm rendering a line of text with Pango. The markup
has foreground and 
>> background attributes used few times to change
colors. I'm drawing the 
>> layout to a pixmap with height few (device) pixels
greater then text 
>> rendered by Pango. The problem is, that on my
surplus space, I have my 
>> old background color. How I can set up Pango to
also draw text 
>> background color there?
> 
> Hi,
> 
> In that case you are best clearing the pixmap to your
desired background
> color first and then using pango to render text on it.

Ok, but if I do that, and my pixmap is few pixels higher,
wont I have 
few white lines?

-- 
Semper Fidelis

Adam Klobukowski
adamklobukowskigmail.com
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-listgnome.org

http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Re: Pango problem
country flaguser name
Canada
2007-08-20 01:44:50
On Mon, 2007-08-20 at 07:31 +0200, Adam Klobukowski wrote:
> Behdad Esfahbod pisze:
> > On Sun, 2007-08-19 at 23:08 +0200, Adam
Klobukowski wrote:
> >> Hello
> >>
> >> I'm rendering a line of text with Pango. The
markup has foreground and 
> >> background attributes used few times to change
colors. I'm drawing the 
> >> layout to a pixmap with height few (device)
pixels greater then text 
> >> rendered by Pango. The problem is, that on my
surplus space, I have my 
> >> old background color. How I can set up Pango
to also draw text 
> >> background color there?
> > 
> > Hi,
> > 
> > In that case you are best clearing the pixmap to
your desired background
> > color first and then using pango to render text on
it.
> 
> Ok, but if I do that, and my pixmap is few pixels
higher, wont I have 
> few white lines?

No.  By default pango does not draw any background.

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase
a little
 Temporary Safety, deserve neither Liberty nor
Safety."
        -- Benjamin Franklin, 1759



_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-listgnome.org

http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Re: Pango problem
country flaguser name
Poland
2007-08-20 14:13:53
Behdad Esfahbod pisze:
> On Mon, 2007-08-20 at 07:31 +0200, Adam Klobukowski
wrote:
>> Behdad Esfahbod pisze:
>>> On Sun, 2007-08-19 at 23:08 +0200, Adam
Klobukowski wrote:
>>>> Hello
>>>>
>>>> I'm rendering a line of text with Pango.
The markup has foreground and 
>>>> background attributes used few times to
change colors. I'm drawing the 
>>>> layout to a pixmap with height few (device)
pixels greater then text 
>>>> rendered by Pango. The problem is, that on
my surplus space, I have my 
>>>> old background color. How I can set up
Pango to also draw text 
>>>> background color there?
>>> Hi,
>>>
>>> In that case you are best clearing the pixmap
to your desired background
>>> color first and then using pango to render text
on it.
>> Ok, but if I do that, and my pixmap is few pixels
higher, wont I have 
>> few white lines?
> 
> No.  By default pango does not draw any background.
Ok, but I'm using foreground/background attributes:

<span face="sans-serif"
weight="bold"  background="#0a3b6e"

foreground="white"><i>Connecting
server...</i></span>

and in this case - it does draw background.

I made 2 pictures, one with what I have now 
(http://adamk
.rootnode.pl/example-bad.png 1.9KB size) and second with

what I want to achieve (http://adamk.
rootnode.pl/example-ok.png 1.9KB 
size). Note, that my markup may be much more complicated
with few 
background colors, so drawing 2 boxes above and under text
rendered by 
pango in background color is not possible (there may be few
colors). I 
could analyse pixmap after drawing text, but I'd like to
avoid it.

-- 
Semper Fidelis

Adam Klobukowski
adamklobukowskigmail.com
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-listgnome.org

http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Re: Pango problem
country flaguser name
Poland
2007-08-20 17:02:43
>>>> I'm rendering a line of text with Pango.
The markup has foreground and 
>>>> background attributes used few times to
change colors. I'm drawing the 
>>>> layout to a pixmap with height few (device)
pixels greater then text 
>>>> rendered by Pango. The problem is, that on
my surplus space, I have my 
>>>> old background color. How I can set up
Pango to also draw text 
>>>> background color there?

<cut>

I made a hack with following markup:

<span rise="-%d"> <span
rise="%d"> <span rise="0">

I calculate value of rise form font. Ugly solution, but
works ;) Btw. Is 
EM unit in pango the same as described here: 
http
://en.wikipedia.org/wiki/Em_%28typography%29 ?

If so how can I get it? Atm. I just make layout with single
space 
character and read values from there (another hack).

-- 
Semper Fidelis

Adam Klobukowski
adamklobukowskigmail.com
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-listgnome.org

http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )