This file is indexed.

/usr/share/doc/python-gtk2-tutorial/html/sec-TextTagsAndTextTagTables.html is in python-gtk2-tutorial 2.4-1.

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>13.6. Text Tags and Tag Tables</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Tutorial"><link rel="up" href="ch-TextViewWidget.html" title="Chapter 13. TextView Widget"><link rel="previous" href="sec-TextMarks.html" title="13.5. Text Marks"><link rel="next" href="sec-TextViewExample.html" title="13.7. A TextView Example"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">13.6. Text Tags and Tag Tables</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-TextMarks.html">Prev</a> </td><th width="60%" align="center">Chapter 13. TextView Widget</th><td width="20%" align="right"> <a accesskey="n" href="sec-TextViewExample.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-TextTagsAndTextTagTables"></a>13.6. Text Tags and Tag Tables</h2></div></div><div></div></div><p>TextTags specify attributes that can be applied to a range of text
in a TextBuffer.  Each <tt class="classname">TextBuffer</tt> has a
<tt class="classname">TextTagTable</tt> that contains the
<tt class="classname">TextTag</tt>s that can be applied within the
<tt class="classname">TextBuffer</tt>. <tt class="classname">TextTagTable</tt>s can
be used with more than one <tt class="classname">TextBuffer</tt> to provide
consistent text styles.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sec-TextTags"></a>13.6.1. Text Tags</h3></div></div><div></div></div><p><tt class="classname">TextTag</tt>s can be named or anonymous. A
<tt class="classname">TextTag</tt> is created using the function:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  tag = gtk.TextTag(<b class="parameter"><tt>name</tt></b>=None)
</pre></td></tr></table><p>If <i class="parameter"><tt>name</tt></i> is not specified or is
<tt class="literal">None</tt> the <i class="parameter"><tt>tag</tt></i> will be
anonymous. <tt class="classname">TextTag</tt>s can also be created using the
<tt class="classname">TextBuffer</tt> convenience method
<tt class="methodname">create_tag</tt>() which also allows you specify the
<i class="parameter"><tt>tag</tt></i> attributes and adds the
<i class="parameter"><tt>tag</tt></i> to the buffer's tag table (see <a href="sec-TextBuffers.html" title="13.3. Text Buffers">Section 13.3, &#8220;Text Buffers&#8221;</a>).</p><p>The attributes that can be contained in a
<tt class="classname">TextTag</tt> are:</p><div class="informaltable"><table width="100%" border="1"><colgroup><col><col><col></colgroup><tbody><tr><td>name</td><td>Read / Write</td><td>Name of the text tag. <tt class="literal">None</tt> if anonymous.</td></tr><tr><td>background</td><td>Write</td><td>Background color as a string</td></tr><tr><td>foreground</td><td>Write</td><td>Foreground color as a string</td></tr><tr><td>background-gdk</td><td>Read / Write</td><td>Background color as a GdkColor</td></tr><tr><td>foreground-gdk</td><td>Read / Write</td><td>Foreground color as a GdkColor</td></tr><tr><td>background-stipple</td><td>Read / Write</td><td>Bitmap to use as a mask when drawing the text background</td></tr><tr><td>foreground-stipple</td><td>Read / Write</td><td>Bitmap to use as a mask when drawing the text foreground</td></tr><tr><td>font</td><td>Read / Write</td><td>Font description as a string, e.g. "Sans Italic 12"</td></tr><tr><td>font-desc</td><td>Read / Write</td><td>Font description as a PangoFontDescription  </td></tr><tr><td>family</td><td>Read / Write</td><td>Name of the font family, e.g. Sans, Helvetica, Times, Monospace</td></tr><tr><td>style</td><td>Read / Write</td><td>Font style as a PangoStyle, e.g. pango.STYLE_ITALIC.</td></tr><tr><td>variant</td><td>Read / Write</td><td>Font variant as a PangoVariant, e.g. pango.VARIANT_SMALL_CAPS.</td></tr><tr><td>weight</td><td>Read / Write</td><td>Font weight as an integer, see predefined values in PangoWeight; for example, pango.WEIGHT_BOLD.</td></tr><tr><td>stretch</td><td>Read / Write</td><td>Font stretch as a PangoStretch, e.g. pango.STRETCH_CONDENSED.</td></tr><tr><td>size</td><td>Read / Write</td><td>Font size in Pango units.</td></tr><tr><td>size-points</td><td>Read / Write</td><td>Font size in points</td></tr><tr><td>scale</td><td>Read / Write</td><td>Font size as a scale factor relative to the default font size. This properly adapts to theme changes etc. so is recommended. Pango predefines some scales such as pango.SCALE_X_LARGE.</td></tr><tr><td>pixels-above-lines</td><td>Read / Write</td><td>Pixels of blank space above paragraphs</td></tr><tr><td>pixels-below-lines</td><td>Read / Write</td><td>Pixels of blank space below paragraphs</td></tr><tr><td>pixels-inside-wrap</td><td>Read / Write</td><td>Pixels of blank space between wrapped lines in a paragraph</td></tr><tr><td>editable</td><td>Read / Write</td><td>Whether the text can be modified by the user</td></tr><tr><td>wrap-mode</td><td>Read / Write</td><td>Whether to wrap lines never, at word boundaries, or at character boundaries</td></tr><tr><td>justification</td><td>Read / Write</td><td>Left, right, or center justification</td></tr><tr><td>direction</td><td>Read / Write</td><td>Text direction, e.g. right-to-left or left-to-right</td></tr><tr><td>left-margin</td><td>Read / Write</td><td>Width of the left margin in pixels</td></tr><tr><td>indent</td><td>Read / Write</td><td>Amount to indent the paragraph, in pixels</td></tr><tr><td>strikethrough</td><td>Read / Write</td><td>Whether to strike through the text</td></tr><tr><td>right-margin</td><td>Read / Write</td><td>Width of the right margin in pixels</td></tr><tr><td>underline</td><td>Read / Write</td><td>Style of underline for this text</td></tr><tr><td>rise</td><td>Read / Write</td><td>Offset of text above the baseline (below the baseline if rise is negative) in pixels</td></tr><tr><td>background-full-height</td><td>Read / Write</td><td>Whether the background color fills the entire line height or only the height of the tagged characters</td></tr><tr><td>language</td><td>Read / Write</td><td>The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If you don't understand this parameter, you probably don't need it.</td></tr><tr><td>tabs</td><td>Read / Write</td><td>Custom tabs for this text</td></tr><tr><td>invisible</td><td>Read / Write</td><td>Whether this text is hidden. Not implemented in GTK+ 2.0</td></tr></tbody></table></div><p>The attributes can be set by using the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  tag.set_property(name, value)
</pre></td></tr></table><p>Where <i class="parameter"><tt>name</tt></i> is a string containing the
name of the property and <i class="parameter"><tt>value</tt></i> is what the property
should be set to.</p><p>Likewise the attribute value can be retrieved with the
method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  value = tag.get_property(name)
</pre></td></tr></table><p>Since the tag does not have a value set for every attribute
there are a set of boolean properties that indicate whether the attribute
has been set in the tag:</p><div class="informaltable"><table width="100%" border="1"><colgroup><col><col></colgroup><tbody><tr><td>background-set</td><td>Read / Write</td></tr><tr><td>foreground-set</td><td>Read / Write</td></tr><tr><td>background-stipple-set</td><td>Read / Write</td></tr><tr><td>foreground-stipple-set</td><td>Read / Write</td></tr><tr><td>family-set</td><td>Read / Write</td></tr><tr><td>style-set</td><td>Read / Write</td></tr><tr><td>variant-set</td><td>Read / Write</td></tr><tr><td>weight-set</td><td>Read / Write</td></tr><tr><td>stretch-set</td><td>Read / Write</td></tr><tr><td>size-set</td><td>Read / Write</td></tr><tr><td>scale-set</td><td>Read / Write</td></tr><tr><td>pixels-above-lines-set</td><td>Read / Write</td></tr><tr><td>pixels-below-lines-set</td><td>Read / Write</td></tr><tr><td>pixels-inside-wrap-set</td><td>Read / Write</td></tr><tr><td>editable-set</td><td>Read / Write</td></tr><tr><td>wrap-mode-set</td><td>Read / Write</td></tr><tr><td>justification-set</td><td>Read / Write</td></tr><tr><td>direction-set</td><td>Read / Write</td></tr><tr><td>left-margin-set</td><td>Read / Write</td></tr><tr><td>indent-set</td><td>Read / Write</td></tr><tr><td>strikethrough-set</td><td>Read / Write</td></tr><tr><td>right-margin-set</td><td>Read / Write</td></tr><tr><td>underline-set</td><td>Read / Write</td></tr><tr><td>rise-set</td><td>Read / Write</td></tr><tr><td>background-full-height-set</td><td>Read / Write</td></tr><tr><td>language-set</td><td>Read / Write</td></tr><tr><td>tabs-set</td><td>Read / Write</td></tr><tr><td>invisible-set</td><td>Read / Write</td></tr></tbody></table></div><p>Therefore to obtain the attribute from a tag, you have to
first check whether the attribute has been set in the tag. For example to
get a valid justification attribute you may have to do something
like:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  if tag.get_property("justification-set"):
	justification = tag.get_property("justification")
</pre></td></tr></table><p>The priority of a tag is by default the order in which they are
added to the <tt class="classname">TextTagTable</tt>. The higher priority tag
takes precedence if multiple tags try to set the same attribute for a range
of text. The priority can be obtained and set with the methods:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  priority = tag.get_priority()

  tag.set_priority(<b class="parameter"><tt>priority</tt></b>)
</pre></td></tr></table><p>The priority of a tag must be between 0 and one less than the
<tt class="classname">TextTagTable</tt> size.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sec-TextTagTables"></a>13.6.2. Text Tag Tables</h3></div></div><div></div></div><p>A <tt class="classname">TextTagTable</tt> will be created by default
when a <tt class="classname">TextBuffer</tt> is created. A
<tt class="classname">TextTagTable</tt> can also be created with the
function:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table = TextTagTable()
</pre></td></tr></table><p>A <tt class="classname">TextTag</tt> can be added to a
<tt class="classname">TextTagTable</tt> using the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table.add(<b class="parameter"><tt>tag</tt></b>)
</pre></td></tr></table><p>The <i class="parameter"><tt>tag</tt></i> must not be in the
<i class="parameter"><tt>table</tt></i> and must not have the same name as another tag
in the table.</p><p>You can find a <tt class="classname">TextTag</tt> in a
<tt class="classname">TextTagTable</tt> using the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  tag = table.lookup(<b class="parameter"><tt>name</tt></b>)
</pre></td></tr></table><p>The method returns the <i class="parameter"><tt>tag</tt></i> in the table
with the given <i class="parameter"><tt>name</tt></i> or <tt class="literal">None</tt> if no
tag has that <i class="parameter"><tt>name</tt></i>.</p><p>A <tt class="classname">TextTag</tt> can be removed from a
<tt class="classname">TextTagTable</tt> with the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table.remove(<b class="parameter"><tt>tag</tt></b>)
</pre></td></tr></table><p>The size of the <tt class="classname">TextTagTable</tt> can be
obtained with the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  size = table.get_size()
</pre></td></tr></table></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-TextMarks.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-TextViewWidget.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sec-TextViewExample.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">13.5. Text Marks </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 13.7. A TextView Example</td></tr></table></div></body></html>