|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/gtk-doc/html/pango/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Text Attribute Markup</title> <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> <link rel="start" href="index.html" title="Pango Reference Manual"> <link rel="up" href="pango.html" title="Basic Pango Interfaces"> <link rel="prev" href="pango-Tab-Stops.html" title="Tab Stops"> <link rel="next" href="pango-Layout-Objects.html" title="Layout Objects"> <meta name="generator" content="GTK-Doc V1.6 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="chapter" href="pango.html" title="Basic Pango Interfaces"> <link rel="chapter" href="rendering.html" title="Rendering with Pango"> <link rel="chapter" href="lowlevel.html" title="Low Level Functionality"> <link rel="chapter" href="tools.html" title="Pango Tools"> <link rel="index" href="ix01.html" title="Index"> <link rel="index" href="ix02.html" title="Index of deprecated symbols"> <link rel="index" href="ix03.html" title="Index of new symbols in 1.2"> <link rel="index" href="ix04.html" title="Index of new symbols in 1.4"> <link rel="index" href="ix05.html" title="Index of new symbols in 1.6"> <link rel="index" href="ix06.html" title="Index of new symbols in 1.8"> <link rel="index" href="ix07.html" title="Index of new symbols in 1.10"> <link rel="index" href="ix08.html" title="Index of new symbols in 1.12"> <link rel="index" href="ix09.html" title="Index of new symbols in 1.14"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"> <td><a accesskey="p" href="pango-Tab-Stops.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> <td><a accesskey="u" href="pango.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> <th width="100%" align="center">Pango Reference Manual</th> <td><a accesskey="n" href="pango-Layout-Objects.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr></table> <div class="refentry" lang="en"> <a name="PangoMarkupFormat"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle">Text Attribute Markup</span></h2> <p>Text Attribute Markup — Simple markup language to encode text with attributes</p> </td> <td valign="top" align="right"></td> </tr></table></div> <div class="refsect1" lang="en"> <a name="id2812150"></a><h2>Pango Text Attribute Markup Language</h2> <p> Frequently, you want to display some text to the user with attributes applied to part of the text (for example, you might want bold or italicized words). With the base Pango interfaces, you could create a <a href="pango-Text-Attributes.html#PangoAttrList">PangoAttrList</a> and apply it to the text; the problem is that you'd need to apply attributes to some numeric range of characters, for example "characters 12-17." This is broken from an internationalization standpoint; once the text is translated, the word you wanted to italicize could be in a different position. </p> <p> The solution is to include the text attributes in the string to be translated. Pango provides this feature with a small markup language. You can parse a marked-up string into the string text plus a <a href="pango-Text-Attributes.html#PangoAttrList">PangoAttrList</a> using the function <a href="pango-Text-Attributes.html#pango-parse-markup">pango_parse_markup()</a>. </p> <p> A simple example of a marked-up string might be: <code class="literal">"<span foreground="blue" size="x-large">Blue text</span> is <i>cool</i>!"</code> </p> <p> The root tag of a marked-up document is <markup>, but <a href="pango-Text-Attributes.html#pango-parse-markup">pango_parse_markup()</a> allows you to omit this tag, so you will most likely never need to use it. The most general markup tag is <span>, then there are some convenience tags. <span> has the following attributes: </p> <div class="variablelist"> <p class="title"><b><span> attributes</b></p> <table border="0"> <col align="left" valign="top"> <tbody> <tr> <td> <span class="term">font_desc</span></td> <td><p> A font description string, such as "Sans Italic 12"; note that any other span attributes will override this description. So if you have "Sans Italic" and also a style="normal" attribute, you will get Sans normal, not italic. </p></td> </tr> <tr> <td> <span class="term">font_family</span></td> <td><p> A font family name </p></td> </tr> <tr> <td> <span class="term">face</span></td> <td><p> Synonym for font_family </p></td> </tr> <tr> <td> <span class="term">size</span></td> <td><p> Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'. If you want to specify a absolute size, it's usually easier to take advantage of the ability to specify a partial font description using 'font_desc'; you can use <code class="literal">font_desc='12.5'</code> rather than <code class="literal">size='12800'</code>. </p></td> </tr> <tr> <td> <span class="term">style</span></td> <td><p> One of 'normal', 'oblique', 'italic' </p></td> </tr> <tr> <td> <span class="term">weight</span></td> <td><p> One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight </p></td> </tr> <tr> <td> <span class="term">variant</span></td> <td><p> 'normal' or 'smallcaps' </p></td> </tr> <tr> <td> <span class="term">stretch</span></td> <td><p> One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded' </p></td> </tr> <tr> <td> <span class="term">foreground</span></td> <td><p> An RGB color specification such as '#00FF00' or a color name such as 'red' </p></td> </tr> <tr> <td> <span class="term">background</span></td> <td><p> An RGB color specification such as '#00FF00' or a color name such as 'red' </p></td> </tr> <tr> <td> <span class="term">underline</span></td> <td><p> One of 'single', 'double', 'low', 'none' </p></td> </tr> <tr> <td> <span class="term">underline_color</span></td> <td><p> The color of underlines; an RGB color specification such as '#00FF00' or a color name such as 'red' </p></td> </tr> <tr> <td> <span class="term">rise</span></td> <td><p> Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript. </p></td> </tr> <tr> <td> <span class="term">strikethrough</span></td> <td><p> 'true' or 'false' whether to strike through the text </p></td> </tr> <tr> <td> <span class="term">strikethrough_color</span></td> <td><p> The color of strikethrough lines; an RGB color specification such as '#00FF00' or a color name such as 'red' </p></td> </tr> <tr> <td> <span class="term">fallback</span></td> <td><p> 'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback. </p></td> </tr> <tr> <td> <span class="term">lang</span></td> <td><p> A language code, indicating the text language </p></td> </tr> </tbody> </table> </div> <p> </p> <p> The following convenience tags are provided: </p> <div class="variablelist"> <p class="title"><b>Convenience tags</b></p> <table border="0"> <col align="left" valign="top"> <tbody> <tr> <td> <span class="term">b</span></td> <td><p> Bold </p></td> </tr> <tr> <td> <span class="term">big</span></td> <td><p> Makes font relatively larger, equivalent to <span size="larger"> </p></td> </tr> <tr> <td> <span class="term">i</span></td> <td><p> Italic </p></td> </tr> <tr> <td> <span class="term">s</span></td> <td><p> Strikethrough </p></td> </tr> <tr> <td> <span class="term">sub</span></td> <td><p> Subscript </p></td> </tr> <tr> <td> <span class="term">sup</span></td> <td><p> Superscript </p></td> </tr> <tr> <td> <span class="term">small</span></td> <td><p> Makes font relatively smaller, equivalent to <span size="smaller"> </p></td> </tr> <tr> <td> <span class="term">tt</span></td> <td><p> Monospace font </p></td> </tr> <tr> <td> <span class="term">u</span></td> <td><p> Underline </p></td> </tr> </tbody> </table> </div> <p> </p> </div> </div> </body> </html>