📄 pangocairo.xml
字号:
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); cairo_paint (cr); draw_text (cr); cairo_destroy (cr); status = cairo_surface_write_to_png (surface, filename); cairo_surface_destroy (surface); if (status != CAIRO_STATUS_SUCCESS) { g_printerr ("Could not save png to '%s'\n", filename); return 1; } return 0;}</programlisting></example><figure id="rotated-example-output"> <title>Output of <xref linkend="rotated-example"/></title> <graphic fileref="rotated-text.png" format="PNG"/></figure></refsect1><refsect1 id="pango-Cairo-Rendering.details" role="details"><title role="details.title">Details</title><refsect2 id="PangoCairoFont" role="struct" condition="since:1.18"><title>PangoCairoFont</title><indexterm zone="PangoCairoFont" role="1.18"><primary>PangoCairoFont</primary></indexterm><programlisting>typedef struct _PangoCairoFont PangoCairoFont;</programlisting><para><link linkend="PangoCairoFont"><type>PangoCairoFont</type></link> is an interface exported by fonts foruse with Cairo. The actual type of the font will dependon the particular font technology Cairo was compiled to use.</para><para></para><para role="since">Since 1.18</para></refsect2><refsect2 id="PangoCairoFontMap-struct" role="struct"><title>PangoCairoFontMap</title><indexterm zone="PangoCairoFontMap-struct" 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 role="since">Since 1.10</para></refsect2><refsect2 id="pango-cairo-font-map-get-default" role="function" condition="since:1.10"><title>pango_cairo_font_map_get_default ()</title><indexterm zone="pango-cairo-font-map-get-default" 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 <link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link> to use with Cairo.</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 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 role="since">Since 1.10</para></refsect2><refsect2 id="pango-cairo-font-map-new" role="function" condition="since:1.10"><title>pango_cairo_font_map_new ()</title><indexterm zone="pango-cairo-font-map-new" 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 role="since">Since 1.10</para></refsect2><refsect2 id="pango-cairo-font-map-new-for-font-type" role="function" condition="since:1.18"><title>pango_cairo_font_map_new_for_font_type ()</title><indexterm zone="pango-cairo-font-map-new-for-font-type" role="1.18"><primary>pango_cairo_font_map_new_for_font_type</primary></indexterm><programlisting><link linkend="PangoFontMap">PangoFontMap</link>* pango_cairo_font_map_new_for_font_type (<link linkend="cairo-font-type-t">cairo_font_type_t</link> fonttype);</programlisting><para>Creates a new <link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link> object of the type suitableto be used with cairo font backend of type <parameter>fonttype</parameter>.</para><para>In most cases one should simply use @<link linkend="pango-cairo-font-map-new"><function>pango_cairo_font_map_new()</function></link>,or in fact in most of those cases, just use@<link linkend="pango-cairo-font-map-get-default"><function>pango_cairo_font_map_get_default()</function></link>.</para><para></para><variablelist role="params"><varlistentry><term><parameter>fonttype</parameter> :</term><listitem><simpara> desired <link linkend="cairo-font-type-t"><type>cairo_font_type_t</type></link></simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the newly allocated <link linkend="PangoFontMap"><type>PangoFontMap</type></link> of suitable type which should be freed with <link linkend="g-object-unref"><function>g_object_unref()</function></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the requested cairo font backend is not supported / compiled in.</simpara></listitem></varlistentry></variablelist><para role="since">Since 1.18</para></refsect2><refsect2 id="pango-cairo-font-map-get-font-type" role="function" condition="since:1.18"><title>pango_cairo_font_map_get_font_type ()</title><indexterm zone="pango-cairo-font-map-get-font-type" role="1.18"><primary>pango_cairo_font_map_get_font_type</primary></indexterm><programlisting><link linkend="cairo-font-type-t">cairo_font_type_t</link> pango_cairo_font_map_get_font_type (<link linkend="PangoCairoFontMap">PangoCairoFontMap</link> *fontmap);</programlisting><para>Gets the type of Cairo font backend that <parameter>fontmap</parameter> uses.</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 <link linkend="cairo-font-type-t"><type>cairo_font_type_t</type></link> cairo font backend type</simpara></listitem></varlistentry></variablelist><para role="since">Since 1.18</para></refsect2><refsect2 id="pango-cairo-font-map-set-resolution" role="function" condition="since:1.10"><title>pango_cairo_font_map_set_resolution ()</title><indexterm zone="pango-cairo-font-map-set-resolution" 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 role="since">Since 1.10</para></refsect2><refsect2 id="pango-cairo-font-map-get-resolution" role="function" condition="since:1.10"><title>pango_cairo_font_map_get_resolution ()</title><indexterm zone="pango-cairo-font-map-get-resolution" 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 role="since">Since 1.10</para></refsect2><refsect2 id="pango-cairo-font-map-create-context" role="function" condition="since:1.10"><title>pango_cairo_font_map_create_context ()</title><indexterm zone="pango-cairo-font-map-create-context" 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 role="since">Since 1.10</para></refsect2><refsect2 id="pango-cairo-font-get-scaled-font" role="function" condition="since:1.18"><title>pango_cairo_font_get_scaled_font ()</title><indexterm zone="pango-cairo-font-get-scaled-font" role="1.18"><primary>pango_cairo_font_get_scaled_font</primary></indexterm><programlisting><link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>* pango_cairo_font_get_scaled_font (<link linkend="PangoCairoFont">PangoCairoFont</link> *font);</programlisting><para>Gets the <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> used by <parameter>font</parameter>.The scaled font can be referenced and kept using<link linkend="cairo-scaled-font-reference"><function>cairo_scaled_font_reference()</function></link>.</para><para></para><variablelist role="params"><varlistentry><term><parameter>font</parameter> :</term><listitem><simpara> a <link linkend="PangoFont"><type>PangoFont</type></link> from a <link linkend="PangoCairoFontMap"><type>PangoCairoFontMap</type></link></simpara></listitem></varlistentry><varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> used by <parameter>font</parameter>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>font</parameter> is <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</simpara></listitem></varlistentry></variablelist><para role="since">Since 1.18</para></refsect2><refsect2 id="pango-cairo-context-set-resolution" role="function" condition="since:1.10"><title>pango_cairo_context_set_resolution ()</title><indexterm zone="pango-cairo-context-set-resolution" 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. The
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -