# The variant attribute seems not to work well

**URL:** <https://www.ruby-forum.com/t/the-variant-attribute-seems-not-to-work-well/214091>\
**Category:** Ruby-Gnome 2\
**Created:** [November 21, 2011, 3:48pm UTC](https://www.ruby-forum.com/t/the-variant-attribute-seems-not-to-work-well/214091 "2011-11-21T15:48:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [November 21, 2011, 3:48pm UTC](https://www.ruby-forum.com/t/the-variant-attribute-seems-not-to-work-well/214091/1 "2011-11-21T15:48:45Z")

</div>

Hi folks,

I read this: [http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup](http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup)

And I ran the following snippet on Windows 7.

# I’m using Ruby 1.9.3p0. The gtk2, cairo and pango are all 1.0.3.

require ‘cairo’  
require ‘pango’  
require ‘gtk2’  
win = Gtk::Window.new  
surface = Cairo::ImageSurface.new Cairo::FORMAT\_ARGB32, 300, 300  
context = Cairo::Context.new surface  
layout = context.create\_pango\_layout  
markup = “small-CAPS\nSMALL-CAPS”  
attr\_list, text = Pango.parse\_markup(markup)  
layout.text = text  
layout.attributes = attr\_list  
context.show\_pango\_layout layout  
context.show\_page  
surface.write\_to\_png ‘hello.png’  
img = Gtk::Image.new ‘hello.png’  
canvas = Gtk::Layout.new  
canvas.put img, 0, 0  
win.add canvas  
win.show\_all  
Gtk.main

I expected that it’d show the same two 'SMALL-CAPS’s.  
But I got this: [http://www.rin-shun.com/tmp/smallcaps.png](http://www.rin-shun.com/tmp/smallcaps.png)

The variant attribute seems not to work well…  
Please correct me if I’m wrong.

ashbb

---

<div class="post-metadata">

**Author:** ![satoshi\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@satoshi\_a](https://www.ruby-forum.com/u/satoshi_a)\
**Post date:** [December 4, 2011, 5:38am UTC](https://www.ruby-forum.com/t/the-variant-attribute-seems-not-to-work-well/214091/2 "2011-12-04T05:38:03Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] The variant attribute seems not to work well.”  
on Mon, 21 Nov 2011 15:48:45 +0100,  
“Satoshi A.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> context = Cairo::Context.new surface  
> canvas = Gtk::Layout.new  
> canvas.put img, 0, 0  
> win.add canvas  
> win.show\_all  
> Gtk.main
> 
> I expected that it’d show the same two 'SMALL-CAPS’s.  
> But I got this: [http://www.rin-shun.com/tmp/smallcaps.png](http://www.rin-shun.com/tmp/smallcaps.png)
> 
> The variant attribute seems not to work well…  
> Please correct me if I’m wrong.

I looked at Pango’s source code and noticed that Pango  
doesn’t implement variant… Pango just accepts ‘normal’ or  
‘smallcaps’. So you can’t use variant in Pango markup.

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![satoshi\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@satoshi\_a](https://www.ruby-forum.com/u/satoshi_a)\
**Post date:** [December 21, 2011, 11:38am UTC](https://www.ruby-forum.com/t/the-variant-attribute-seems-not-to-work-well/214091/3 "2011-12-21T11:38:55Z")

</div>

Hi Kou,

Thank you so much for taking your time to figure out the problem.  
Okay, I’m looking forward to see Pango’s update in the future. 🙂

ashbb
