"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "pango-1.20.5/docs/pango_markup.sgml" of archive pango-1.20.5.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) XML source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 <refentry id="PangoMarkupFormat" revision="11 Dec 2002">
    2 <refmeta>
    3 <refentrytitle>Text Attribute Markup</refentrytitle>
    4 <manvolnum>3</manvolnum>
    5 <refmiscinfo>Pango Library</refmiscinfo>
    6 </refmeta>
    7 
    8 <refnamediv>
    9 <refname>Text Attribute Markup</refname><refpurpose>Simple
   10 markup language to encode text with attributes</refpurpose>
   11 </refnamediv>
   12 
   13 <refsect1>
   14 <title>Pango Text Attribute Markup Language</title>
   15 
   16 <para>
   17 Frequently, you want to display some text to the user with attributes
   18 applied to part of the text (for example, you might want bold or
   19 italicized words). With the base Pango interfaces, you could create a
   20 <link linkend="PangoAttrList">PangoAttrList</link> and apply it to the
   21 text; the problem is that you'd need to apply attributes to some
   22 numeric range of characters, for example "characters 12-17." This is
   23 broken from an internationalization standpoint; once the text is
   24 translated, the word you wanted to italicize could be in a different
   25 position.
   26 </para>
   27 
   28 <para>
   29 The solution is to include the text attributes in the string to be
   30 translated. Pango provides this feature with a small markup language.
   31 You can parse a marked-up string into the string text plus a
   32 <link linkend="PangoAttrList">PangoAttrList</link> using the function
   33 <link linkend="pango-parse-markup">pango_parse_markup()</link>.
   34 </para>
   35 
   36 <para>
   37 A simple example of a marked-up string might be:
   38 <literal>"&lt;span foreground="blue" size="x-large"&gt;Blue text&lt;/span&gt; is &lt;i&gt;cool&lt;/i&gt;!"</literal>
   39 </para>
   40 
   41 <para>
   42 The root tag of a marked-up document is &lt;markup&gt;, but <link
   43 linkend="pango-parse-markup">pango_parse_markup()</link> allows you to
   44 omit this tag, so you will most likely never need to use it. The most
   45 general markup tag is &lt;span&gt;, then there are some convenience
   46 tags. &lt;span&gt; has the following attributes:
   47 <variablelist><title>&lt;span&gt; attributes</title>
   48 
   49 <varlistentry><term>font_desc</term>
   50 <listitem><para>
   51 A font description string, such as "Sans Italic 12". See
   52 <link linkend="pango-font-description-from-string">pango_font_description_from_string()</link>
   53 for a description of the format of the string representation . Note that any
   54 other span attributes will override this description. So if you have
   55 "Sans Italic" and also a style="normal" attribute, you will get Sans normal,
   56 not italic.</para></listitem>
   57 </varlistentry>
   58 
   59 <varlistentry><term>font_family</term>
   60 <listitem><para>
   61 A font family name
   62 </para></listitem>
   63 </varlistentry>
   64 
   65 <varlistentry><term>face</term>
   66 <listitem><para>
   67 Synonym for font_family
   68 </para></listitem>
   69 </varlistentry>
   70 
   71 <varlistentry><term>size</term>
   72 <listitem><para>
   73 Font size in 1024ths of a point, or one of the absolute sizes
   74 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large',
   75 'xx-large', or one of the relative sizes 'smaller' or 'larger'.
   76 If you want to specify a absolute size, it's usually easier
   77 to take advantage of the ability to specify a partial
   78 font description using 'font_desc'; you can use
   79 <literal>font_desc='12.5'</literal> rather than
   80 <literal>size='12800'</literal>.
   81 </para></listitem>
   82 </varlistentry>
   83 
   84 <varlistentry><term>style</term>
   85 <listitem><para>
   86 One of 'normal', 'oblique', 'italic'
   87 </para></listitem>
   88 </varlistentry>
   89 
   90 <varlistentry><term>weight</term>
   91 <listitem><para>
   92 One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy',
   93 or a numeric weight
   94 </para></listitem>
   95 </varlistentry>
   96 
   97 <varlistentry><term>variant</term>
   98 <listitem><para>
   99 'normal' or 'smallcaps'
  100 </para></listitem>
  101 </varlistentry>
  102 
  103 <varlistentry><term>stretch</term>
  104 <listitem><para>
  105 One of 'ultracondensed', 'extracondensed', 'condensed',
  106 'semicondensed', 'normal', 'semiexpanded', 'expanded',
  107 'extraexpanded', 'ultraexpanded'
  108 </para></listitem>
  109 </varlistentry>
  110 
  111 <varlistentry><term>foreground</term>
  112 <listitem><para>
  113 An RGB color specification such as '#00FF00' or a color name such as
  114 'red'
  115 </para></listitem>
  116 </varlistentry>
  117 
  118 <varlistentry><term>background</term>
  119 <listitem><para>
  120 An RGB color specification such as '#00FF00' or a color name such as
  121 'red'
  122 </para></listitem>
  123 </varlistentry>
  124 
  125 <varlistentry><term>underline</term>
  126 <listitem><para>
  127 One of 'none', 'single', 'double', 'low', 'error'
  128 </para></listitem>
  129 </varlistentry>
  130 
  131 <varlistentry><term>underline_color</term>
  132 <listitem><para>
  133 The color of underlines; an RGB color specification such as '#00FF00'
  134 or a color name such as 'red'
  135 </para></listitem>
  136 </varlistentry>
  137 
  138 <varlistentry><term>rise</term>
  139 <listitem><para>
  140 Vertical displacement, in 10000ths of an em. Can be negative for
  141 subscript, positive for superscript.
  142 </para></listitem>
  143 </varlistentry>
  144 
  145 <varlistentry><term>strikethrough</term>
  146 <listitem><para>
  147 'true' or 'false' whether to strike through the text
  148 </para></listitem>
  149 </varlistentry>
  150 
  151 <varlistentry><term>strikethrough_color</term>
  152 <listitem><para>
  153 The color of strikethrough lines; an RGB color specification such as
  154 '#00FF00' or a color name such as 'red'
  155 </para></listitem>
  156 </varlistentry>
  157 
  158 <varlistentry><term>fallback</term>
  159 <listitem><para>
  160 'true' or 'false' whether to enable fallback. If disabled, then characters
  161 will only be used from the closest matching font on the system. No fallback
  162 will be done to other fonts on the system that might contain the characters
  163 in the text.  Fallback is enabled by default. Most applications should not
  164 disable fallback.
  165 </para></listitem>
  166 </varlistentry>
  167 
  168 <varlistentry><term>lang</term>
  169 <listitem><para>
  170 A language code, indicating the text language
  171 </para></listitem>
  172 </varlistentry>
  173 
  174 <varlistentry><term>letter_spacing</term>
  175 <listitem><para>
  176 Inter-letter spacing in 1024ths of a point.
  177 </para></listitem>
  178 </varlistentry>
  179 
  180 <varlistentry><term>gravity</term>
  181 <listitem><para>
  182 One of 'south', 'east', 'north', 'west', 'auto'.
  183 </para></listitem>
  184 </varlistentry>
  185 
  186 <varlistentry><term>gravity_hint</term>
  187 <listitem><para>
  188 One of 'natural', 'strong', 'line'.
  189 </para></listitem>
  190 </varlistentry>
  191 
  192 </variablelist>
  193 
  194 </para>
  195 
  196 <para>
  197 The following convenience tags are provided:
  198 
  199 <variablelist><title>Convenience tags</title>
  200 <varlistentry><term>b</term>
  201 <listitem><para>
  202 Bold
  203 </para></listitem>
  204 </varlistentry>
  205 <varlistentry><term>big</term>
  206 <listitem><para>
  207 Makes font relatively larger, equivalent to &lt;span size="larger"&gt;
  208 </para></listitem>
  209 </varlistentry>
  210 <varlistentry><term>i</term>
  211 <listitem><para>
  212 Italic
  213 </para></listitem>
  214 </varlistentry>
  215 <varlistentry><term>s</term>
  216 <listitem><para>
  217 Strikethrough
  218 </para></listitem>
  219 </varlistentry>
  220 <varlistentry><term>sub</term>
  221 <listitem><para>
  222 Subscript
  223 </para></listitem>
  224 </varlistentry>
  225 <varlistentry><term>sup</term>
  226 <listitem><para>
  227 Superscript
  228 </para></listitem>
  229 </varlistentry>
  230 <varlistentry><term>small</term>
  231 <listitem><para>
  232 Makes font relatively smaller, equivalent to &lt;span size="smaller"&gt;
  233 </para></listitem>
  234 </varlistentry>
  235 <varlistentry><term>tt</term>
  236 <listitem><para>
  237 Monospace font
  238 </para></listitem>
  239 </varlistentry>
  240 <varlistentry><term>u</term>
  241 <listitem><para>
  242 Underline
  243 </para></listitem>
  244 </varlistentry>
  245 </variablelist>
  246 
  247 </para>
  248 
  249 </refsect1>
  250 
  251 </refentry>