⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.10
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
doc
/
libgtk-3-dev
/
pango
/
View File Name :
pango-Markup.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Markup: Pango Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="Pango Reference Manual"> <link rel="up" href="pango.html" title="Basic Pango Interfaces"> <link rel="prev" href="pango-Text-Attributes.html" title="Attributes"> <link rel="next" href="pango-Layout-Objects.html" title="Layout Objects"> <meta name="generator" content="GTK-Doc V1.32 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </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="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#pango-Markup.description" class="shortcut">Description</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="pango.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="pango-Text-Attributes.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="pango-Layout-Objects.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="pango-Markup"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="pango-Markup.top_of_page"></a>Markup</span></h2> <p>Markup — Simple markup language for text with attributes</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="pango-Markup.functions"></a><h2>Functions</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="functions_proto_type"> <col class="functions_proto_name"> </colgroup> <tbody> <tr> <td class="function_type"> <a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="pango-Markup.html#pango-parse-markup" title="pango_parse_markup ()">pango_parse_markup</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="../glib/glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> * </td> <td class="function_name"> <a class="link" href="pango-Markup.html#pango-markup-parser-new" title="pango_markup_parser_new ()">pango_markup_parser_new</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="pango-Markup.html#pango-markup-parser-finish" title="pango_markup_parser_finish ()">pango_markup_parser_finish</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="pango-Markup.description"></a><h2>Description</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 class="link" href="pango-Text-Attributes.html#PangoAttrList"><span class="type">PangoAttrList</span></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 class="link" href="pango-Text-Attributes.html#PangoAttrList"><span class="type">PangoAttrList</span></a> using either of <a class="link" href="pango-Markup.html#pango-parse-markup" title="pango_parse_markup ()"><code class="function">pango_parse_markup()</code></a> or <a class="link" href="pango-Markup.html#pango-markup-parser-new" title="pango_markup_parser_new ()"><code class="function">pango_markup_parser_new()</code></a>.</p> <p>A simple example of a marked-up string might be:</p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1</pre></td> <td class="listing_code"><pre class="programlisting"><span class="o"><</span><span class="n">span</span> <span class="n">foreground</span><span class="o">=</span><span class="s">"blue"</span> <span class="n">size</span><span class="o">=</span><span class="s">"x-large"</span><span class="o">></span><span class="n">Blue</span> <span class="n">text</span><span class="o"></</span><span class="n">span</span><span class="o">></span> <span class="n">is</span> <span class="o"><</span><span class="n">i</span><span class="o">></span><span class="n">cool</span><span class="o"></</span><span class="n">i</span><span class="o">>!</span></pre></td> </tr> </tbody> </table> </div> <p></p> <p>Pango uses <span class="type">GMarkup</span> to parse this language, which means that XML features such as numeric character entities such as &<span class="type">169</span>; for © can be used too.</p> <p>The root tag of a marked-up document is <markup>, but <a class="link" href="pango-Markup.html#pango-parse-markup" title="pango_parse_markup ()"><code class="function">pango_parse_markup()</code></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.</p> <p><span> has the following attributes:</p> <p>font_desc : A font description string, such as "Sans Italic 12". See <a class="link" href="pango-Fonts.html#pango-font-description-from-string" title="pango_font_description_from_string ()"><code class="function">pango_font_description_from_string()</code></a> for a description of the format of the string representation . 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> <p>font_family : A font family name</p> <p>font_size, size : 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'; you can use |font='12.5'| rather than |size='12800'|.</p> <p>font_style : One of 'normal', 'oblique', 'italic'</p> <p>font_weight : One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight</p> <p>font_variant : One of 'normal' or 'smallcaps'</p> <p>font_stretch, stretch : One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'</p> <p>font_features : A comma separated list of OpenType font feature settings, in the same syntax as accepted by CSS. E.g: |font_features='dlig=1, -kern, afrc on'|</p> <p>foreground, fgcolor : An RGB color specification such as '<span class="type">00FF00</span>' or a color name such as 'red'. Since 1.38, an RGBA color specification such as '<span class="type">00FF007F</span>' will be interpreted as specifying both a foreground color and foreground alpha.</p> <p>background, bgcolor : An RGB color specification such as '<span class="type">00FF00</span>' or a color name such as'red'. Since 1.38, an RGBA color specification such as '<span class="type">00FF007F</span>' will be interpreted as specifying both a background color and background alpha.</p> <p>alpha, fgalpha : An alpha value for the foreground color, either a plain integer between 1 and 65536 or a percentage value like '50%'.</p> <p>background_alpha, bgalpha : An alpha value for the background color, either a plain integer between 1 and 65536 or a percentage value like '50%'.</p> <p>underline : One of 'none', 'single', 'double', 'low', 'error'</p> <p>underline_color : The color of underlines; an RGB color specification such as '<span class="type">00FF00</span>' or a color name such as 'red'</p> <p>rise : Vertical displacement, in Pango units. Can be negative for subscript, positive for superscript.</p> <p>strikethrough : 'true' or 'false' whether to strike through the text</p> <p>strikethrough_color : The color of strikethrough lines; an RGB color specification such as '<span class="type">00FF00</span>' or a color name such as 'red'</p> <p>fallback : '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> <p>allow_breaks : 'true' or 'false' whether to allow line breaks or not. If not allowed, the range will be kept in a single run as far as possible. Breaks are allowed by default.</p> <p>insert_hyphens : 'true' or 'false' whether to insert hyphens when breaking lines in the middle of a word. Hyphens are inserted by default.</p> <p>show : A value determining how invisible characters are treated. Possible values are 'spaces', 'line-breaks', 'ignorables' or combinations, such as 'spaces|line-breaks'.</p> <p>lang : A language code, indicating the text language</p> <p>letter_spacing : Inter-letter spacing in 1024ths of a point.</p> <p>gravity : One of 'south', 'east', 'north', 'west', 'auto'.</p> <p>gravity_hint : One of 'natural', 'strong', 'line'.</p> <p>The following convenience tags are provided:</p> <p><b> : Bold</p> <p><big> : Makes font relatively larger, equivalent to <span size="larger"></p> <p><i> : Italic</p> <p><s> : Strikethrough</p> <p><sub> : Subscript</p> <p><sup> : Superscript</p> <p><small> : Makes font relatively smaller, equivalent to <span size="smaller"></p> <p><tt> : Monospace</p> <p><u> : Underline</p> </div> <div class="refsect1"> <a name="pango-Markup.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="pango-parse-markup"></a><h3>pango_parse_markup ()</h3> <pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> pango_parse_markup (<em class="parameter"><code>const <span class="type">char</span> *markup_text</code></em>, <em class="parameter"><code><span class="type">int</span> length</code></em>, <em class="parameter"><code><a href="../glib/glib-Unicode-Manipulation.html#gunichar"><span class="type">gunichar</span></a> accel_marker</code></em>, <em class="parameter"><code><a class="link" href="pango-Text-Attributes.html#PangoAttrList"><span class="type">PangoAttrList</span></a> **attr_list</code></em>, <em class="parameter"><code><span class="type">char</span> **text</code></em>, <em class="parameter"><code><a href="../glib/glib-Unicode-Manipulation.html#gunichar"><span class="type">gunichar</span></a> *accel_char</code></em>, <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>Parses marked-up text (see</p> markup format) to create <p>a plain-text string and an attribute list.</p> <p>If <em class="parameter"><code>accel_marker</code></em> is nonzero, the given character will mark the character following it as an accelerator. For example, <em class="parameter"><code>accel_marker</code></em> might be an ampersand or underscore. All characters marked as an accelerator will receive a <a class="link" href="pango-Text-Attributes.html#PANGO-UNDERLINE-LOW:CAPS"><code class="literal">PANGO_UNDERLINE_LOW</code></a> attribute, and the first character so marked will be returned in <em class="parameter"><code>accel_char</code></em> . Two <em class="parameter"><code>accel_marker</code></em> characters following each other produce a single literal <em class="parameter"><code>accel_marker</code></em> character.</p> <p>To parse a stream of pango markup incrementally, use <a class="link" href="pango-Markup.html#pango-markup-parser-new" title="pango_markup_parser_new ()"><code class="function">pango_markup_parser_new()</code></a>.</p> <p>If any error happens, none of the output arguments are touched except for <em class="parameter"><code>error</code></em> .</p> <div class="refsect3"> <a name="pango-parse-markup.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>markup_text</p></td> <td class="parameter_description"><p>markup to parse (see markup format)</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>length</p></td> <td class="parameter_description"><p>length of <em class="parameter"><code>markup_text</code></em> , or -1 if nul-terminated</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>accel_marker</p></td> <td class="parameter_description"><p>character that precedes an accelerator, or 0 for none</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>attr_list</p></td> <td class="parameter_description"><p>address of return location for a <a class="link" href="pango-Text-Attributes.html#PangoAttrList"><span class="type">PangoAttrList</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>text</p></td> <td class="parameter_description"><p>address of return location for text with tags stripped, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>accel_char</p></td> <td class="parameter_description"><p>address of return location for accelerator char, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>address of return location for errors, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="pango-parse-markup.returns"></a><h4>Returns</h4> <p> <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set, otherwise <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a></p> </div> </div> <hr> <div class="refsect2"> <a name="pango-markup-parser-new"></a><h3>pango_markup_parser_new ()</h3> <pre class="programlisting"><a href="../glib/glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> * pango_markup_parser_new (<em class="parameter"><code><a href="../glib/glib-Unicode-Manipulation.html#gunichar"><span class="type">gunichar</span></a> accel_marker</code></em>);</pre> <p>Parses marked-up text (see</p> markup format) to create <p>a plain-text string and an attribute list.</p> <p>If <em class="parameter"><code>accel_marker</code></em> is nonzero, the given character will mark the character following it as an accelerator. For example, <em class="parameter"><code>accel_marker</code></em> might be an ampersand or underscore. All characters marked as an accelerator will receive a <a class="link" href="pango-Text-Attributes.html#PANGO-UNDERLINE-LOW:CAPS"><code class="literal">PANGO_UNDERLINE_LOW</code></a> attribute, and the first character so marked will be returned in <em class="parameter"><code>accel_char</code></em> , when calling <code class="function">finish()</code>. Two <em class="parameter"><code>accel_marker</code></em> characters following each other produce a single literal <em class="parameter"><code>accel_marker</code></em> character.</p> <p>To feed markup to the parser, use <a href="../glib/glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse"><code class="function">g_markup_parse_context_parse()</code></a> on the returned <a href="../glib/glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>. When done with feeding markup to the parser, use <a class="link" href="pango-Markup.html#pango-markup-parser-finish" title="pango_markup_parser_finish ()"><code class="function">pango_markup_parser_finish()</code></a> to get the data out of it, and then use <a href="../glib/glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-free"><code class="function">g_markup_parse_context_free()</code></a> to free it.</p> <p>This function is designed for applications that read pango markup from streams. To simply parse a string containing pango markup, the simpler <a class="link" href="pango-Markup.html#pango-parse-markup" title="pango_parse_markup ()"><code class="function">pango_parse_markup()</code></a> API is recommended instead.</p> <div class="refsect3"> <a name="pango-markup-parser-new.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>accel_marker</p></td> <td class="parameter_description"><p>character that precedes an accelerator, or 0 for none</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="pango-markup-parser-new.returns"></a><h4>Returns</h4> <p>a <a href="../glib/glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a> that should be destroyed with <a href="../glib/glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-free"><code class="function">g_markup_parse_context_free()</code></a>. </p> <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="api-index-1-31-0.html#api-index-1.31.0">1.31.0</a></p> </div> <hr> <div class="refsect2"> <a name="pango-markup-parser-finish"></a><h3>pango_markup_parser_finish ()</h3> <pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> pango_markup_parser_finish (<em class="parameter"><code><a href="../glib/glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a> *context</code></em>, <em class="parameter"><code><a class="link" href="pango-Text-Attributes.html#PangoAttrList"><span class="type">PangoAttrList</span></a> **attr_list</code></em>, <em class="parameter"><code><span class="type">char</span> **text</code></em>, <em class="parameter"><code><a href="../glib/glib-Unicode-Manipulation.html#gunichar"><span class="type">gunichar</span></a> *accel_char</code></em>, <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>After feeding a pango markup parser some data with <a href="../glib/glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse"><code class="function">g_markup_parse_context_parse()</code></a>, use this function to get the list of pango attributes and text out of the markup. This function will not free <em class="parameter"><code>context</code></em> , use <a href="../glib/glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-free"><code class="function">g_markup_parse_context_free()</code></a> to do so.</p> <div class="refsect3"> <a name="pango-markup-parser-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>context</p></td> <td class="parameter_description"><p>A valid parse context that was returned from <a class="link" href="pango-Markup.html#pango-markup-parser-new" title="pango_markup_parser_new ()"><code class="function">pango_markup_parser_new()</code></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>attr_list</p></td> <td class="parameter_description"><p>address of return location for a <a class="link" href="pango-Text-Attributes.html#PangoAttrList"><span class="type">PangoAttrList</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>text</p></td> <td class="parameter_description"><p>address of return location for text with tags stripped, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>accel_char</p></td> <td class="parameter_description"><p>address of return location for accelerator char, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>address of return location for errors, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="pango-markup-parser-finish.returns"></a><h4>Returns</h4> <p> <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set, otherwise <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a></p> </div> <p class="since">Since: <a class="link" href="api-index-1-31-0.html#api-index-1.31.0">1.31.0</a></p> </div> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.32</div> </body> </html>