# Pango::layout background color

**URL:** <https://www.ruby-forum.com/t/pango-layout-background-color/81953>\
**Category:** Ruby-Gnome 2\
**Created:** [January 16, 2007, 2:54pm UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953 "2007-01-16T14:54:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [January 16, 2007, 2:54pm UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953/1 "2007-01-16T14:54:40Z")

</div>

* * *

Take Surveys. Earn Cash. Influence the Future of IT  
Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
your  
opinions on IT & business topics through brief surveys - and earn cash  
[http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)

---

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [January 19, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953/2 "2007-01-19T16:20:21Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] pango::layout background color” on Tue, 16 Jan  
2007 15:54:02 +0200,  
Dobai-Pataky Bálint [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> i finally generate a print preview for my treeviews.  
> i wanna set the background color of the columns’ headers. they are  
> pango::layouts.  
> if anyone know how to, please guide me.

Could you show us your sample script?

## Thanks,

kou

* * *

Take Surveys. Earn Cash. Influence the Future of IT  
Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
your  
opinions on IT & business topics through brief surveys - and earn cash  
[http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)

---

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [January 19, 2007, 11:08pm UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953/3 "2007-01-19T23:08:15Z")

</div>

there is no sample yet:  
text\_cell = cr.create\_pango\_layout  
text\_cell.set\_font\_description(Pango::FontDescription.new(“sans 12”))  
text\_cell.set\_text(‘test’)

i wanna set background for this pango layout, or something similar.  
i wanted to place a pango rectangle there, to border the text, but it’s  
not supported.

i might place a cairo rectange, but found no docs for it.

so i thought at least i should change the background of the pango  
layout.

thanks

balint

---

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [January 21, 2007, 2:46am UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953/4 "2007-01-21T02:46:58Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] pango::layout background color” on Sun, 21  
Jan 2007 00:17:34 +0900 (JST),  
Kouhei S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> y = …  
> w, h = text\_cell.pixel\_size  
> cr.rectangle(x, y, w, h)  
> cr.draw

I found a typo.

> cr.draw

cr.stroke

## Thanks,

kou

* * *

Take Surveys. Earn Cash. Influence the Future of IT  
Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
your  
opinions on IT & business topics through brief surveys - and earn cash  
[http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)

---

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [January 20, 2007, 4:18pm UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953/5 "2007-01-20T16:18:42Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] pango::layout background color” on Sat, 20  
Jan 2007 00:06:21 +0200,  
Dobai-Pataky B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> there is no sample yet:  
> text\_cell = cr.create\_pango\_layout  
> text\_cell.set\_font\_description(Pango::FontDescription.new(“sans 12”))  
> text\_cell.set\_text(‘test’)

> i wanna set background for this pango layout, or something similar.  
> i wanted to place a pango rectangle there, to border the text, but it’s not  
> supported.

x = …  
y = …  
w, h = text\_cell.pixel\_size  
cr.rectangle(x, y, w, h)  
cr.draw

## Thanks,

kou

* * *

Take Surveys. Earn Cash. Influence the Future of IT  
Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
your  
opinions on IT & business topics through brief surveys - and earn cash  
[http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)

---

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [January 24, 2007, 4:54pm UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953/6 "2007-01-24T16:54:31Z")

</div>

Hi,

As far as I know, the documentation for rcairo is very light, however,  
in the doc of ruby-gtk2, you have some samples that give a broad  
aspect of rcairo. On my system, I have them under  
/usr/share/doc/ruby-gtk2-0.14.1/sample/gtk-demo/cairo\*

I hope that helps.

Alexis

PS: It seems I have two days’ lag on my mailer, forgive me if I appear  
late…

On 1/22/07, Dobai-Pataky Bálint [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > x = …
> 
> * * *

* * *

Take Surveys. Earn Cash. Influence the Future of IT  
Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
your  
opinions on IT & business topics through brief surveys - and earn cash  
[http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)

---

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [January 24, 2007, 4:44pm UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953/7 "2007-01-24T16:44:26Z")

</div>

Kouhei S. wrote:

> > y = …  
> > w, h = text\_cell.pixel\_size  
> > cr.rectangle(x, y, w, h)  
> > cr.draw  
> > cr.stroke

this works, draws a rectangle.  
is there a way i can fill this rectangle with a color?

my first idea was to draw a bar with a light color.

Kou, can you please tell me where i can find the documentation for  
rcairo?

thanks,

balint

---

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [January 24, 2007, 8:30pm UTC](https://www.ruby-forum.com/t/pango-layout-background-color/81953/8 "2007-01-24T20:30:27Z")

</div>

* * *

Take Surveys. Earn Cash. Influence the Future of IT  
Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
your  
opinions on IT & business topics through brief surveys - and earn cash  
[http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)
