⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pango_markup.sgml

📁 GTK+-2.0源码之pango-1.15.6.tar.gz
💻 SGML
字号:
<refentry id="PangoMarkupFormat" revision="11 Dec 2002"><refmeta><refentrytitle>Text Attribute Markup</refentrytitle><manvolnum>3</manvolnum><refmiscinfo>Pango Library</refmiscinfo></refmeta><refnamediv><refname>Text Attribute Markup</refname><refpurpose>Simplemarkup language to encode text with attributes</refpurpose></refnamediv><refsect1><title>Pango Text Attribute Markup Language</title><para>Frequently, you want to display some text to the user with attributesapplied to part of the text (for example, you might want bold oritalicized words). With the base Pango interfaces, you could create a<link linkend="PangoAttrList">PangoAttrList</link> and apply it to thetext; the problem is that you'd need to apply attributes to somenumeric range of characters, for example "characters 12-17." This isbroken from an internationalization standpoint; once the text istranslated, the word you wanted to italicize could be in a differentposition.</para><para>The solution is to include the text attributes in the string to betranslated. Pango provides this feature with a small markup language.You can parse a marked-up string into the string text plus a<link linkend="PangoAttrList">PangoAttrList</link> using the function <link linkend="pango-parse-markup">pango_parse_markup()</link>.</para><para>A simple example of a marked-up string might be:<literal>"&lt;span foreground="blue" size="x-large"&gt;Blue text&lt;/span&gt; is &lt;i&gt;cool&lt;/i&gt;!"</literal></para><para>The root tag of a marked-up document is &lt;markup&gt;, but <linklinkend="pango-parse-markup">pango_parse_markup()</link> allows you toomit this tag, so you will most likely never need to use it. The mostgeneral markup tag is &lt;span&gt;, then there are some conveniencetags. &lt;span&gt; has the following attributes:<variablelist><title>&lt;span&gt; attributes</title><varlistentry><term>font_desc</term><listitem><para>A font description string, such as "Sans Italic 12"; note that any other span attributes will override this description. So if you have "SansItalic" and also a style="normal" attribute, you will get Sans normal,not italic.</para></listitem></varlistentry><varlistentry><term>font_family</term><listitem><para>A font family name</para></listitem></varlistentry><varlistentry><term>face</term><listitem><para>Synonym for font_family</para></listitem></varlistentry><varlistentry><term>size</term><listitem><para>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 easierto take advantage of the ability to specify a partialfont description using 'font_desc'; you can use<literal>font_desc='12.5'</literal> rather than<literal>size='12800'</literal>.</para></listitem></varlistentry><varlistentry><term>style</term><listitem><para>One of 'normal', 'oblique', 'italic'</para></listitem></varlistentry><varlistentry><term>weight</term><listitem><para>One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy',or a numeric weight</para></listitem></varlistentry><varlistentry><term>variant</term><listitem><para>'normal' or 'smallcaps'</para></listitem></varlistentry><varlistentry><term>stretch</term><listitem><para>One of 'ultracondensed', 'extracondensed', 'condensed','semicondensed', 'normal', 'semiexpanded', 'expanded','extraexpanded', 'ultraexpanded'</para></listitem></varlistentry><varlistentry><term>foreground</term><listitem><para>An RGB color specification such as '#00FF00' or a color name such as 'red'</para></listitem></varlistentry><varlistentry><term>background</term><listitem><para>An RGB color specification such as '#00FF00' or a color name such as 'red'</para></listitem></varlistentry><varlistentry><term>underline</term><listitem><para>One of 'single', 'double', 'low', 'none'</para></listitem></varlistentry><varlistentry><term>underline_color</term><listitem><para>The color of underlines; an RGB color specification such as '#00FF00'or a color name such as 'red'</para></listitem></varlistentry><varlistentry><term>rise</term><listitem><para>Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.</para></listitem></varlistentry><varlistentry><term>strikethrough</term><listitem><para>'true' or 'false' whether to strike through the text</para></listitem></varlistentry><varlistentry><term>strikethrough_color</term><listitem><para>The color of strikethrough lines; an RGB color specification such as'#00FF00' or a color name such as 'red'</para></listitem></varlistentry><varlistentry><term>fallback</term><listitem><para>'true' or 'false' whether to enable fallback. If disabled, then characterswill only be used from the closest matching font on the system. No fallbackwill be done to other fonts on the system that might contain the charactersin the text.  Fallback is enabled by default. Most applications should notdisable fallback.</para></listitem></varlistentry><varlistentry><term>lang</term><listitem><para>A language code, indicating the text language</para></listitem></varlistentry></variablelist></para><para>The following convenience tags are provided:<variablelist><title>Convenience tags</title><varlistentry><term>b</term><listitem><para>Bold</para></listitem></varlistentry><varlistentry><term>big</term><listitem><para>Makes font relatively larger, equivalent to &lt;span size="larger"&gt;</para></listitem></varlistentry><varlistentry><term>i</term><listitem><para>Italic</para></listitem></varlistentry><varlistentry><term>s</term><listitem><para>Strikethrough</para></listitem></varlistentry><varlistentry><term>sub</term><listitem><para>Subscript</para></listitem></varlistentry><varlistentry><term>sup</term><listitem><para>Superscript</para></listitem></varlistentry><varlistentry><term>small</term><listitem><para>Makes font relatively smaller, equivalent to &lt;span size="smaller"&gt;</para></listitem></varlistentry><varlistentry><term>tt</term><listitem><para>Monospace font</para></listitem></varlistentry><varlistentry><term>u</term><listitem><para>Underline</para></listitem></varlistentry></variablelist></para></refsect1></refentry>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -