<?xml version='1.0' encoding='UTF-8'?> 
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cairo-win32-font">
<refmeta>
<refentrytitle role="top_of_page" id="cairo-win32-font.top_of_page">Win32 Fonts</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAIRO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Win32 Fonts</refname>
<refpurpose>Font support for Microsoft Windows</refpurpose>
</refnamediv>

<refsynopsisdiv id="cairo-win32-font.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
#define             <link linkend="CAIRO-HAS-WIN32-FONT--CAPS">CAIRO_HAS_WIN32_FONT</link>
<link linkend="cairo-font-face-t">cairo_font_face_t</link> * <link linkend="cairo-win32-font-face-create-for-logfontw">cairo_win32_font_face_create_for_logfontw</link>
                                                        (<link linkend="LOGFONTW--CAPS">LOGFONTW</link> *logfont);
<link linkend="cairo-font-face-t">cairo_font_face_t</link> * <link linkend="cairo-win32-font-face-create-for-hfont">cairo_win32_font_face_create_for_hfont</link>
                                                        (<link linkend="HFONT--CAPS">HFONT</link> font);
<link linkend="cairo-font-face-t">cairo_font_face_t</link> * <link linkend="cairo-win32-font-face-create-for-logfontw-hfont">cairo_win32_font_face_create_for_logfontw_hfont</link>
                                                        (<link linkend="LOGFONTW--CAPS">LOGFONTW</link> *logfont,
                                                         <link linkend="HFONT--CAPS">HFONT</link> font);
<link linkend="cairo-status-t">cairo_status_t</link>      <link linkend="cairo-win32-scaled-font-select-font">cairo_win32_scaled_font_select_font</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
                                                         <link linkend="HDC--CAPS">HDC</link> hdc);
<link linkend="void">void</link>                <link linkend="cairo-win32-scaled-font-done-font">cairo_win32_scaled_font_done_font</link>   (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
<link linkend="double">double</link>              <link linkend="cairo-win32-scaled-font-get-metrics-factor">cairo_win32_scaled_font_get_metrics_factor</link>
                                                        (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
<link linkend="void">void</link>                <link linkend="cairo-win32-scaled-font-get-logical-to-device">cairo_win32_scaled_font_get_logical_to_device</link>
                                                        (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
                                                         <link linkend="cairo-matrix-t">cairo_matrix_t</link> *logical_to_device);
<link linkend="void">void</link>                <link linkend="cairo-win32-scaled-font-get-device-to-logical">cairo_win32_scaled_font_get_device_to_logical</link>
                                                        (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
                                                         <link linkend="cairo-matrix-t">cairo_matrix_t</link> *device_to_logical);
</synopsis>
</refsynopsisdiv>









<refsect1 id="cairo-win32-font.description" role="desc">
<title role="desc.title">Description</title>
<para>
The Microsoft Windows font backend is primarily used to render text on
Microsoft Windows systems.
</para>
</refsect1>

<refsect1 id="cairo-win32-font.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CAIRO-HAS-WIN32-FONT--CAPS" role="macro">
<title>CAIRO_HAS_WIN32_FONT</title>
<indexterm zone="CAIRO-HAS-WIN32-FONT--CAPS"><primary sortas="CAIRO_HAS_WIN32_FONT">CAIRO_HAS_WIN32_FONT</primary></indexterm><programlisting>#define             CAIRO_HAS_WIN32_FONT</programlisting>
<para>
Defined if the Microsoft Windows font backend is available.
This macro can be used to conditionally compile backend-specific code.
</para></refsect2>
<refsect2 id="cairo-win32-font-face-create-for-logfontw" role="function">
<title>cairo_win32_font_face_create_for_logfontw ()</title>
<indexterm zone="cairo-win32-font-face-create-for-logfontw"><primary sortas="cairo_win32_font_face_create_for_logfontw">cairo_win32_font_face_create_for_logfontw</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link> * cairo_win32_font_face_create_for_logfontw
                                                        (<link linkend="LOGFONTW--CAPS">LOGFONTW</link> *logfont);</programlisting>
<para>
Creates a new font for the Win32 font backend based on a
<link linkend="LOGFONT--CAPS"><type>LOGFONT</type></link>. This font can then be used with
<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> or <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link>.
The <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
returned from <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link> is also for the Win32 backend
and can be used with functions such as <link linkend="cairo-win32-scaled-font-select-font"><function>cairo_win32_scaled_font_select_font()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>logfont</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="LOGFONTW--CAPS"><type>LOGFONTW</type></link> structure specifying the font to use.
  The lfHeight, lfWidth, lfOrientation and lfEscapement
  fields of this structure are ignored.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly created <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>. Free with
 <link linkend="cairo-font-face-destroy"><function>cairo_font_face_destroy()</function></link> when you are done using it.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-win32-font-face-create-for-hfont" role="function">
<title>cairo_win32_font_face_create_for_hfont ()</title>
<indexterm zone="cairo-win32-font-face-create-for-hfont"><primary sortas="cairo_win32_font_face_create_for_hfont">cairo_win32_font_face_create_for_hfont</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link> * cairo_win32_font_face_create_for_hfont
                                                        (<link linkend="HFONT--CAPS">HFONT</link> font);</programlisting>
<para>
Creates a new font for the Win32 font backend based on a
<link linkend="HFONT--CAPS"><type>HFONT</type></link>. This font can then be used with
<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> or <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link>.
The <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
returned from <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link> is also for the Win32 backend
and can be used with functions such as <link linkend="cairo-win32-scaled-font-select-font"><function>cairo_win32_scaled_font_select_font()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>font</parameter>&#160;:</term>
<listitem><simpara> An <link linkend="HFONT--CAPS"><type>HFONT</type></link> structure specifying the font to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly created <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>. Free with
 <link linkend="cairo-font-face-destroy"><function>cairo_font_face_destroy()</function></link> when you are done using it.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-win32-font-face-create-for-logfontw-hfont" role="function">
<title>cairo_win32_font_face_create_for_logfontw_hfont ()</title>
<indexterm zone="cairo-win32-font-face-create-for-logfontw-hfont"><primary sortas="cairo_win32_font_face_create_for_logfontw_hfont">cairo_win32_font_face_create_for_logfontw_hfont</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link> * cairo_win32_font_face_create_for_logfontw_hfont
                                                        (<link linkend="LOGFONTW--CAPS">LOGFONTW</link> *logfont,
                                                         <link linkend="HFONT--CAPS">HFONT</link> font);</programlisting>
<para>
Creates a new font for the Win32 font backend based on a
<link linkend="LOGFONT--CAPS"><type>LOGFONT</type></link>. This font can then be used with
<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> or <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link>.
The <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
returned from <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link> is also for the Win32 backend
and can be used with functions such as <link linkend="cairo-win32-scaled-font-select-font"><function>cairo_win32_scaled_font_select_font()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>logfont</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="LOGFONTW--CAPS"><type>LOGFONTW</type></link> structure specifying the font to use.
  If hfont is null then the lfHeight, lfWidth, lfOrientation and lfEscapement
  fields of this structure are ignored. Otherwise lfWidth, lfOrientation and
  lfEscapement must be zero.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>font</parameter>&#160;:</term>
<listitem><simpara> An <link linkend="HFONT--CAPS"><type>HFONT</type></link> that can be used when the font matrix is a scale by
  -lfHeight and the CTM is identity.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly created <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>. Free with
 <link linkend="cairo-font-face-destroy"><function>cairo_font_face_destroy()</function></link> when you are done using it.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-win32-scaled-font-select-font" role="function">
<title>cairo_win32_scaled_font_select_font ()</title>
<indexterm zone="cairo-win32-scaled-font-select-font"><primary sortas="cairo_win32_scaled_font_select_font">cairo_win32_scaled_font_select_font</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link>      cairo_win32_scaled_font_select_font (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
                                                         <link linkend="HDC--CAPS">HDC</link> hdc);</programlisting>
<para>
Selects the font into the given device context and changes the
map mode and world transformation of the device context to match
that of the font. This function is intended for use when using
layout APIs such as Uniscribe to do text layout with the
cairo font. After finishing using the device context, you must call
<link linkend="cairo-win32-scaled-font-done-font"><function>cairo_win32_scaled_font_done_font()</function></link> to release any resources allocated
by this function.
</para>
<para>
See <link linkend="cairo-win32-scaled-font-get-metrics-factor"><function>cairo_win32_scaled_font_get_metrics_factor()</function></link> for converting logical
coordinates from the device context to font space.
</para>
<para>
Normally, calls to <link linkend="SaveDC"><function>SaveDC()</function></link> and <link linkend="RestoreDC"><function>RestoreDC()</function></link> would be made around
the use of this function to preserve the original graphics state.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>scaled_font</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> from the Win32 font backend. Such an
  object can be created with <link linkend="cairo-win32-scaled-font-create-for-logfontw"><function>cairo_win32_scaled_font_create_for_logfontw()</function></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>hdc</parameter>&#160;:</term>
<listitem><simpara> a device context
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="CAIRO-STATUS-SUCCESS--CAPS"><literal>CAIRO_STATUS_SUCCESS</literal></link> if the operation succeeded.
  otherwise an error such as <link linkend="CAIRO-STATUS-NO-MEMORY--CAPS"><literal>CAIRO_STATUS_NO_MEMORY</literal></link> and
  the device context is unchanged.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-win32-scaled-font-done-font" role="function">
<title>cairo_win32_scaled_font_done_font ()</title>
<indexterm zone="cairo-win32-scaled-font-done-font"><primary sortas="cairo_win32_scaled_font_done_font">cairo_win32_scaled_font_done_font</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_win32_scaled_font_done_font   (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
<para>
Releases any resources allocated by <link linkend="cairo-win32-scaled-font-select-font"><function>cairo_win32_scaled_font_select_font()</function></link></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>scaled_font</parameter>&#160;:</term>
<listitem><simpara> A scaled font from the Win32 font backend.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-win32-scaled-font-get-metrics-factor" role="function">
<title>cairo_win32_scaled_font_get_metrics_factor ()</title>
<indexterm zone="cairo-win32-scaled-font-get-metrics-factor"><primary sortas="cairo_win32_scaled_font_get_metrics_factor">cairo_win32_scaled_font_get_metrics_factor</primary></indexterm><programlisting><link linkend="double">double</link>              cairo_win32_scaled_font_get_metrics_factor
                                                        (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
<para>
Gets a scale factor between logical coordinates in the coordinate
space used by <link linkend="cairo-win32-scaled-font-select-font"><function>cairo_win32_scaled_font_select_font()</function></link> (that is, the
coordinate system used by the Windows functions to return metrics) and
font space coordinates.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>scaled_font</parameter>&#160;:</term>
<listitem><simpara> a scaled font from the Win32 font backend
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> factor to multiply logical units by to get font space
              coordinates.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-win32-scaled-font-get-logical-to-device" role="function" condition="since:1.4">
<title>cairo_win32_scaled_font_get_logical_to_device ()</title>
<indexterm zone="cairo-win32-scaled-font-get-logical-to-device" role="1.4"><primary sortas="cairo_win32_scaled_font_get_logical_to_device">cairo_win32_scaled_font_get_logical_to_device</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_win32_scaled_font_get_logical_to_device
                                                        (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
                                                         <link linkend="cairo-matrix-t">cairo_matrix_t</link> *logical_to_device);</programlisting>
<para>
Gets the transformation mapping the logical space used by <parameter>scaled_font</parameter>
to device space.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>scaled_font</parameter>&#160;:</term>
<listitem><simpara> a scaled font from the Win32 font backend
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>logical_to_device</parameter>&#160;:</term>
<listitem><simpara> matrix to return
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-win32-scaled-font-get-device-to-logical" role="function" condition="since:1.4">
<title>cairo_win32_scaled_font_get_device_to_logical ()</title>
<indexterm zone="cairo-win32-scaled-font-get-device-to-logical" role="1.4"><primary sortas="cairo_win32_scaled_font_get_device_to_logical">cairo_win32_scaled_font_get_device_to_logical</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_win32_scaled_font_get_device_to_logical
                                                        (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
                                                         <link linkend="cairo-matrix-t">cairo_matrix_t</link> *device_to_logical);</programlisting>
<para>
Gets the transformation mapping device space to the logical space
used by <parameter>scaled_font</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>scaled_font</parameter>&#160;:</term>
<listitem><simpara> a scaled font from the Win32 font backend
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>device_to_logical</parameter>&#160;:</term>
<listitem><simpara> matrix to return
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>

</refsect1>



<refsect1 id="cairo-win32-font.see-also">
<title>See Also</title>
<para>
<itemizedlist>
<listitem><link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link></listitem>
</itemizedlist>
</para>
</refsect1>

</refentry>
