The variant attribute seems not to work well

Hi folks,

I read this: 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

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

ashbb

Hi,

In [email protected]
“[ruby-gnome2-devel-en] The variant attribute seems not to work well.”
on Mon, 21 Nov 2011 15:48:45 +0100,
“Satoshi A.” [email protected] 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

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

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. :slight_smile:

ashbb