📄 pangocairo.xml
字号:
<title>Output of <xref linkend="rotated-example"/></title> <graphic fileref="rotated-text.png" format="PNG"/></figure></refsect1><refsect1 id="details"><title id="details.title">Details</title><refsect2><title><anchor id="PangoCairoFontMap-struct" role="struct"/>PangoCairoFontMap</title><indexterm role="1.10"><primary>PangoCairoFontMap</primary></indexterm><programlisting>typedef struct _PangoCairoFontMap PangoCairoFontMap;</programlisting><para><link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link> is an interface exported by font maps foruse with Cairo. The actual type of the font map will dependon the particular font technology Cairo was compiled to use.</para><para></para><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-font-map-new" role="function" condition="since:1.10"/>pango_cairo_font_map_new ()</title><indexterm role="1.10"><primary>pango_cairo_font_map_new</primary></indexterm><programlisting><link linkend="PangoFontMap">PangoFontMap</link>* pango_cairo_font_map_new (void);</programlisting><para>Creates a new <link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link> object; a fontmap is usedto cache information about available fonts, and holdscertain global parameters such as the resolution.In most cases, you can use <link linkend="pango-cairo-font-map-get-default"><function>pango_cairo_font_map_get_default()</function></link>instead.</para><para>Note that the type of the returned object will dependon the particular font backend Cairo was compiled to use;You generally should only use the <link linkend="PangoFontMap"><type>PangoFontMap</type></link> and<link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link> interfaces on the returned object.</para><para></para><variablelist role="params"><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the newly allocated <link linkend="PangoFontMap"><type>PangoFontMap</type></link>, which should be freed with <link linkend="g-object-unref"><function>g_object_unref()</function></link>.</simpara></listitem></varlistentry></variablelist><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-font-map-get-default" role="function" condition="since:1.10"/>pango_cairo_font_map_get_default ()</title><indexterm role="1.10"><primary>pango_cairo_font_map_get_default</primary></indexterm><programlisting><link linkend="PangoFontMap">PangoFontMap</link>* pango_cairo_font_map_get_default (void);</programlisting><para>Gets a default font map to use with Cairo.</para><para></para><variablelist role="params"><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the default Cairo fontmap for <link linkend="Pango"><type>Pango</type></link>. This object is owned by Pango and must not be freed.</simpara></listitem></varlistentry></variablelist><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-font-map-set-resolution" role="function" condition="since:1.10"/>pango_cairo_font_map_set_resolution ()</title><indexterm role="1.10"><primary>pango_cairo_font_map_set_resolution</primary></indexterm><programlisting><link linkend="void">void</link> pango_cairo_font_map_set_resolution (<link linkend="PangoCairoFontMap">PangoCairoFontMap</link> *fontmap, <link linkend="double">double</link> dpi);</programlisting><para>Sets the resolution for the fontmap. This is a scale factor betweenpoints specified in a <link linkend="PangoFontDescription"><type>PangoFontDescription</type></link> and Cairo units. Thedefault value is 96, meaning that a 10 point font will be 13units high. (10 * 96. / 72. = 13.3).</para><para></para><variablelist role="params"><varlistentry><term><parameter>fontmap</parameter> :</term><listitem><simpara> a <link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link></simpara></listitem></varlistentry><varlistentry><term><parameter>dpi</parameter> :</term><listitem><simpara> the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)</simpara></listitem></varlistentry></variablelist><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-font-map-get-resolution" role="function" condition="since:1.10"/>pango_cairo_font_map_get_resolution ()</title><indexterm role="1.10"><primary>pango_cairo_font_map_get_resolution</primary></indexterm><programlisting><link linkend="double">double</link> pango_cairo_font_map_get_resolution (<link linkend="PangoCairoFontMap">PangoCairoFontMap</link> *fontmap);</programlisting><para>Gets the resolution for the fontmap. See <link linkend="pango-cairo-font-map-set-resolution"><function>pango_cairo_font_map_set_resolution()</function></link></para><para></para><variablelist role="params"><varlistentry><term><parameter>fontmap</parameter> :</term><listitem><simpara> a <link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link></simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resolution in "dots per inch"</simpara></listitem></varlistentry></variablelist><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-font-map-create-context" role="function" condition="since:1.10"/>pango_cairo_font_map_create_context ()</title><indexterm role="1.10"><primary>pango_cairo_font_map_create_context</primary></indexterm><programlisting><link linkend="PangoContext">PangoContext</link>* pango_cairo_font_map_create_context (<link linkend="PangoCairoFontMap">PangoCairoFontMap</link> *fontmap);</programlisting><para>Create a <link linkend="PangoContext"><type>PangoContext</type></link> for the given fontmap.</para><para></para><variablelist role="params"><varlistentry><term><parameter>fontmap</parameter> :</term><listitem><simpara> a <link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link></simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the newly created context; free with <link linkend="g-object-unref"><function>g_object_unref()</function></link>.</simpara></listitem></varlistentry></variablelist><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-context-set-resolution" role="function" condition="since:1.10"/>pango_cairo_context_set_resolution ()</title><indexterm role="1.10"><primary>pango_cairo_context_set_resolution</primary></indexterm><programlisting><link linkend="void">void</link> pango_cairo_context_set_resolution (<link linkend="PangoContext">PangoContext</link> *context, <link linkend="double">double</link> dpi);</programlisting><para>Sets the resolution for the context. This is a scale factor betweenpoints specified in a <link linkend="PangoFontDescription"><type>PangoFontDescription</type></link> and Cairo units. Thedefault value is 96, meaning that a 10 point font will be 13units high. (10 * 96. / 72. = 13.3).</para><para></para><variablelist role="params"><varlistentry><term><parameter>context</parameter> :</term><listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>, from <link linkend="pango-cairo-font-map-create-context"><function>pango_cairo_font_map_create_context()</function></link></simpara></listitem></varlistentry><varlistentry><term><parameter>dpi</parameter> :</term><listitem><simpara> the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) A 0 or negative value means to use the resolution from the font map.</simpara></listitem></varlistentry></variablelist><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-context-get-resolution" role="function" condition="since:1.10"/>pango_cairo_context_get_resolution ()</title><indexterm role="1.10"><primary>pango_cairo_context_get_resolution</primary></indexterm><programlisting><link linkend="double">double</link> pango_cairo_context_get_resolution (<link linkend="PangoContext">PangoContext</link> *context);</programlisting><para>Gets the resolution for the context. See <link linkend="pango-cairo-context-set-resolution"><function>pango_cairo_context_set_resolution()</function></link></para><para></para><variablelist role="params"><varlistentry><term><parameter>context</parameter> :</term><listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>, from <link linkend="pango-cairo-font-map-create-context"><function>pango_cairo_font_map_create_context()</function></link></simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resolution in "dots per inch". A negative value will be returned if no resolution has previously been set.</simpara></listitem></varlistentry></variablelist><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-context-set-font-options" role="function"/>pango_cairo_context_set_font_options ()</title><indexterm><primary>pango_cairo_context_set_font_options</primary></indexterm><programlisting><link linkend="void">void</link> pango_cairo_context_set_font_options (<link linkend="PangoContext">PangoContext</link> *context, const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options);</programlisting><para>Sets the font options used when rendering text with this context.These options override any options that <link linkend="pango-cairo-update-context"><function>pango_cairo_update_context()</function></link>derives from the target surface.</para><para></para><variablelist role="params"><varlistentry><term><parameter>context</parameter> :</term><listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>, from <link linkend="pango-cairo-font-map-create-context"><function>pango_cairo_font_map_create_context()</function></link></simpara></listitem></varlistentry><varlistentry><term><parameter>options</parameter> :</term><listitem><simpara> a <link linkend="cairo-font-options-t"><type>cairo_font_options_t</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to unset any previously set options. A copy is made.</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="pango-cairo-context-get-font-options" role="function"/>pango_cairo_context_get_font_options ()</title><indexterm><primary>pango_cairo_context_get_font_options</primary></indexterm><programlisting>const <link linkend="cairo-font-options-t">cairo_font_options_t</link>* pango_cairo_context_get_font_options (<link linkend="PangoContext">PangoContext</link> *context);</programlisting><para>Retrieves any font rendering options previously set with<link linkend="pango-cairo-font-map-set-font-options"><function>pango_cairo_font_map_set_font_options()</function></link>. This functions not report optionsthat are derived from the target surface by <link linkend="pango-cairo-update-context"><function>pango_cairo_update_context()</function></link></para><para></para><variablelist role="params"><varlistentry><term><parameter>context</parameter> :</term><listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>, from <link linkend="pango-cairo-font-map-create-context"><function>pango_cairo_font_map_create_context()</function></link></simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the font options previously set on the context, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if no options have been set. This value is owned by the context and must not be modified or freed.</simpara></listitem></varlistentry></variablelist></refsect2><refsect2><title><anchor id="pango-cairo-update-context" role="function" condition="since:1.10"/>pango_cairo_update_context ()</title><indexterm role="1.10"><primary>pango_cairo_update_context</primary></indexterm><programlisting><link linkend="void">void</link> pango_cairo_update_context (<link linkend="cairo-t">cairo_t</link> *cr, <link linkend="PangoContext">PangoContext</link> *context);</programlisting><para>Updates a <link linkend="PangoContext"><type>PangoContext</type></link> previously created for use with Cairo tomatch the current transformation and target surface of a Cairocontext. If any layouts have been created for the context,it's necessary to call <link linkend="pango-layout-context-changed"><function>pango_layout_context_changed()</function></link> on thoselayouts.</para><para></para><variablelist role="params"><varlistentry><term><parameter>cr</parameter> :</term><listitem><simpara> a Cairo context</simpara></listitem></varlistentry><varlistentry><term><parameter>context</parameter> :</term><listitem><simpara> a <link linkend="PangoContext"><type>PangoContext</type></link>, from <link linkend="pango-cairo-font-map-create-context"><function>pango_cairo_font_map_create_context()</function></link></simpara></listitem></varlistentry></variablelist><para>Since 1.10</para></refsect2><refsect2><title><anchor id="pango-cairo-create-layout" role="function" condition="since:1.10"/>pango_cairo_create_layout ()</title><indexterm role="1.10"><primary>pango_cairo_create_layout</primary></indexterm><programlisting><link linkend="PangoLayout">PangoLayout</link>* pango_cairo_create_layout (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting><para>Creates a layout object set up to match the current transformationand target surface of the Cairo context. This layout can then beused for text measurement with functions like<link linkend="pango-layout-get-size"><function>pango_layout_get_size()</function></link> or drawing with functions like<link linkend="pango-cairo-show-layout"><function>pango_cairo_show_layout()</function></link>. If you change the transformationor target surface for <parameter>cr</parameter>, you need to call <link linkend="pango-cairo-update-layout"><function>pango_cairo_update_layout()</function></link></para><para>This function is the most convenient way to use Cairo with Pango,however it is slightly inefficient since it creates a separate<link linkend="PangoContext"><type>PangoContext</type></link> object for each layout. This might matter in anapplication that was laying out large amounts of text.</para>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -