/usr/share/doc/ruby-pango/examples/item.rb is in ruby-pango 2.2.5-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # -*- coding: utf-8 -*-
=begin
item.rb - Ruby/Pango sample script.
Copyright (c) 2005 Ruby-GNOME2 Project
This program is licenced under the same licence as Ruby-GNOME2.
$Id: item.rb,v 1.3 2006/06/17 13:37:01 mutoh Exp $
=end
require 'gtk2'
str = "Ruby-GNOME2こんにちわ"
win = Gtk::Window.new("Ruby/Pango sample")
win.realize
p screen = Gdk::Screen.default
p context = Gdk::Pango.context(screen)
p attrlist = Pango::AttrList.new
p a = Pango::AttrBackground.new(65535, 0, 0)
attrlist.insert(Pango::AttrBackground.new(65535, 0,0))
attrs = [Pango::AttrBackground.new(65535, 0,0), Pango::AttrForeground.new(65535, 0,0)]
items = context.itemize(Pango::Context::DIRECTION_RTL, str, 0, 40, attrlist)
items.each do |v|
ana = v.analysis
puts "shape_engine = #{ana.shape_engine}, lang_engine = #{ana.lang_engine}, font = #{ana.font}, level = #{ana.level}"
puts "language = #{ana.language}"
p ana.font.get_glyph_extents("a".codepoints.first)[0].to_a
ana.set_extra_attrs(attrs)
p ana.extra_attrs
end
|