File: attribute.rb

package info (click to toggle)
ruby-gnome2 0.15.0-1.1
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 7,692 kB
  • ctags: 8,558
  • sloc: ansic: 69,912; ruby: 19,511; makefile: 97; xml: 35; sql: 13
file content (82 lines) | stat: -rw-r--r-- 1,810 bytes parent folder | download | duplicates (11)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
=begin
  attribute.rb - Ruby/Pango sample script.

  Copyright (c) 2002,2003 Ruby-GNOME2 Project Team
  This program is licenced under the same licence as Ruby-GNOME2.

  $Id: attribute.rb,v 1.6 2006/06/17 13:37:01 mutoh Exp $
=end

require 'pango'

p a = Pango::AttrSize.new(1)
puts "value = #{a.value}"
puts "start_index = #{a.start_index}"
puts "end_index = #{a.end_index}"

p a = Pango::AttrStyle.new(Pango::FontDescription::STYLE_NORMAL)
puts "value = #{a.value}"

p a = Pango::AttrVariant.new(Pango::FontDescription::VARIANT_SMALL_CAPS)
puts "value = #{a.value}"

p a = Pango::AttrStretch.new(Pango::FontDescription::STRETCH_EXPANDED)
puts "value = #{a.value}"

p a = Pango::AttrWeight.new(Pango::FontDescription::WEIGHT_BOLD)
puts "value = #{a.value}"

p a = Pango::AttrRise.new(10)
puts "value = #{a.value}"

p a = Pango::AttrLanguage.new(Pango::Language.new("ja"))
p a.value
p a.value.to_str

p a = Pango::AttrFamily.new("family")
p a.value

p b = Pango::FontDescription.new
p b.to_str
p a = Pango::AttrFontDescription.new(b)
p a.value
p a.value.to_str

p a = Pango::AttrForeground.new(10, 20, 30)
p a.value
p a.value.to_a

p a = Pango::AttrBackground.new(20, 30, 40)
p a.value
p a.value.to_a

p a = Pango::AttrStrikethrough.new(true)
p a.value

p Pango::AttrUnderline::SINGLE
p a = Pango::AttrUnderline.new(Pango::AttrUnderline::SINGLE)
p a.value

p ink = Pango::Rectangle.new(1, 2, 3, 4)
p log = Pango::Rectangle.new(5, 6, 7, 8)
p a = Pango::AttrShape.new(ink, log)
p a.value[0].to_a
p a.value[1].to_a

p a = Pango::AttrScale.new(2.3)
p a.value

begin
  require 'gtk2'
rescue
  p "Ruby/GTK2 is not existed."
  exit 0
end
  p a = Gdk::PangoAttrEmbossed.new(true)
  p a.value

  mask = Gdk::Pixmap.new(Gtk::Window.new.realize.window, 100, 100, 1)
  p a = Gdk::PangoAttrStipple.new(mask)
  p a.value