<HTML ><HEAD ><TITLE >Pango Text Attribute Markup</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Pango Reference Manual" HREF="index.html"><LINK REL="UP" TITLE="Basic Pango Interfaces" HREF="pango.html"><LINK REL="PREVIOUS" TITLE="Tab Stops" HREF="pango-tab-stops.html"><LINK REL="NEXT" TITLE="Layout Objects" HREF="pango-layout-objects.html"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" BGCOLOR="#000000" CELLPADDING="1" CELLSPACING="0" ><TR ><TH COLSPAN="4" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="5" >Pango Reference Manual</FONT ></TH ></TR ><TR ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="left" ><A HREF="pango-tab-stops.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><<< Previous Page</B ></FONT ></A ></TD ><TD WIDTH="25%" BGCOLOR="#0000C0" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="index.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Home</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#00C000" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="pango.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Up</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="right" ><A HREF="pango-layout-objects.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Next Page >>></B ></FONT ></A ></TD ></TR ></TABLE ></DIV ><H1 ><A NAME="PANGOMARKUPFORMAT" ></A >Pango Text Attribute Markup</H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN5617" ></A ><H2 >Name</H2 >Pango Text Attribute Markup -- Simple markup language to encode text plus a <A HREF="pango-text-attributes.html#PANGOATTRLIST" >PangoAttrList</A ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN5621" ></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: <TT CLASS="LITERAL" >"<span foreground="blue" size="100">Blue text</span> is <i>cool</i>!"</TT ></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 ></P ><DIV CLASS="VARIABLELIST" ><P ><B ><span> attributes</B ></P ><DL ><DT >font_desc</DT ><DD ><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 ></DD ><DT >font_family</DT ><DD ><P >A font family name</P ></DD ><DT >face</DT ><DD ><P >Synonym for font_family</P ></DD ><DT >size</DT ><DD ><P >Font size in 1000ths of a point, 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'.</P ></DD ><DT >style</DT ><DD ><P >One of 'normal', 'oblique', 'italic'</P ></DD ><DT >weight</DT ><DD ><P >One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight</P ></DD ><DT >variant</DT ><DD ><P >'normal' or 'smallcaps'</P ></DD ><DT >stretch</DT ><DD ><P >One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'</P ></DD ><DT >foreground</DT ><DD ><P >An RGB color specification such as '#00FF00' or a color name such as 'red'</P ></DD ><DT >background</DT ><DD ><P >An RGB color specification such as '#00FF00' or a color name such as 'red'</P ></DD ><DT >underline</DT ><DD ><P >One of 'single', 'double', 'low', 'none'</P ></DD ><DT >rise</DT ><DD ><P >Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.</P ></DD ><DT >strikethrough</DT ><DD ><P >'true' or 'false' whether to strike through the text</P ></DD ><DT >lang</DT ><DD ><P >A language code, indicating the text language</P ></DD ></DL ></DIV > </P ><P >The following convenience tags are provided: <P ></P ><DIV CLASS="VARIABLELIST" ><P ><B >Convenience tags</B ></P ><DL ><DT >b</DT ><DD ><P >Bold</P ></DD ><DT >big</DT ><DD ><P >Makes font relatively larger, equivalent to <span size="larger"></P ></DD ><DT >i</DT ><DD ><P >Italic</P ></DD ><DT >s</DT ><DD ><P >Strikethrough</P ></DD ><DT >sub</DT ><DD ><P >Subscript</P ></DD ><DT >sup</DT ><DD ><P >Superscript</P ></DD ><DT >small</DT ><DD ><P >Makes font relatively smaller, equivalent to <span size="smaller"></P ></DD ><DT >tt</DT ><DD ><P >Monospace font</P ></DD ><DT >u</DT ><DD ><P >Underline</P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="NAVFOOTER" ><BR CLEAR="all"><BR><TABLE WIDTH="100%" BORDER="0" BGCOLOR="#000000" CELLPADDING="1" CELLSPACING="0" ><TR ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="left" ><A HREF="pango-tab-stops.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><<< Previous Page</B ></FONT ></A ></TD ><TD WIDTH="25%" BGCOLOR="#0000C0" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="index.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Home</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#00C000" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="pango.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Up</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="right" ><A HREF="pango-layout-objects.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Next Page >>></B ></FONT ></A ></TD ></TR ><TR ><TD COLSPAN="2" ALIGN="left" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Tab Stops</B ></FONT ></TD ><TD COLSPAN="2" ALIGN="right" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Layout Objects</B ></FONT ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >