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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 3日 (月) 06:47:37 JST


-------------------------
REMOTE_ADDR = 70.49.49.99
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-textview
-------------------------
@@ -220,7 +220,9 @@
 
 The Pango::Layout object is used to represent a whole paragraph of text. Normally, Pango uses it internally for laying out text within a widget. However, it can be employed as in our example in the ((*make_tab_array*)) function to calculate the width of the tab string. Note that using tab, let alone changing it makes sense only when you have a mono-spaced text as well when you use the same font through out the text.
 
-In ((*make_tab_array*))method we use Pango::Layout object and a set of other Pango devices to set up our ((*TAB.*))We start up with Gtk::Widget#create_pango_layout(text=nil). In general Pango::Layout object is created by Pango::Layout.new, which creates a new Pango::Layout object with attributes initialized to default values for a particular Pango::Context. However, in our sample program we are employing Gtk::Widget#create_pango_layout instead. API documentation tells us that Gtk::Widget#create_pango_layout(text=nil) creates a new Pango::Layout with the appropriate colormap, font description, and base direction for drawing text for this widget.
+In ((*make_tab_array*))method we use Pango::Layout object and a set of other Pango devices to set up our ((*TAB.*))We start up with Gtk::Widget#create_pango_layout(text=nil). In general Pango::Layout object is created by Pango::Layout.new, which creates a new Pango::Layout object with attributes initialized to default values for a particular Pango::Context. However, in our sample program we are employing Gtk::Widget#create_pango_layout, with a string parameter containing as many spaces as we would like our TAB to expand. instead. API documentation tells us that Gtk::Widget#create_pango_layout(text=nil) creates a new Pango::Layout with the appropriate colormap, font description, and base direction for drawing text for this widget.
+
+Next we need to tell our Pango::Layout object what is the font we are using in the text buffer, for which we wish to calculate TAB size. At this point we can request the pixel size, which returns an array of width and height elements. As TAB is concerned with the horizontal layout only, we are interested in width only. We will need to convey the size to Pango::TabArray, which we create next. We will accomplish this with  Pango::TabArray#set_tab to which just obtained pixel width is passed as the third argument. Finally we pass our tab array object to our text buffer.
 
 Between the following are the methods we used in order to implement our tab size altering functionality:
 




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