[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-txtw-textview

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 3日 (月) 02:54:27 JST


-------------------------
REMOTE_ADDR = 70.49.49.99
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-textview
-------------------------
@@ -142,6 +142,17 @@
 :Pango::FontDescription.new(str = nil):   
     Creates a new font description from a string representation in the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace separated list of words where each WORD describes one of style, variant, weight, or stretch, and SIZE is an decimal number (size in points). Any one of the options may be absent. If FAMILY-LIST is absent, then the family_name field of the resulting font description will be initialized to nil. If STYLE-OPTIONS is missing, then all style options will be set to the default values. If SIZE is missing, the size in the resulting font description will be set to 0. If str is nil, creates a new font description structure with all fields unset. 
 
+In our example we set the font with the following code:
+
+ font = Pango::FontDescription.new("Monospace Bold 10")
+ textview.modify_font(font)
+ 
+Sometimes you may want to give user the control over which font style and size they would like to set the font to. In that event you would most likely employ((*Font Selection Dialog*))and then initialiye the font in a way reminiscent of the code we have just seen. Let's run our imagination and pretend we needed something like the following:
+
+ font = dialog.font_name
+ desc = Pango::FontDescription.new(font)
+ label.text = "Font: %s" % [desc]
+ label.modify_font(desc)  
 
 
 === Pango Tab Arrays




ruby-gnome2-cvs メーリングリストの案内
Back to archive index