<?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-DWrite-Fonts">
<refmeta>
<refentrytitle role="top_of_page" id="cairo-DWrite-Fonts.top_of_page">DWrite Fonts</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAIRO Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>DWrite Fonts</refname>
<refpurpose>Font support for Microsoft DWrite</refpurpose>
</refnamediv>

<refsect1 id="cairo-DWrite-Fonts.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="cairo-font-face-t"><returnvalue>cairo_font_face_t</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="cairo-dwrite-font-face-create-for-dwrite-fontface">cairo_dwrite_font_face_create_for_dwrite_fontface</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>


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

</refsect1>
<refsect1 id="cairo-DWrite-Fonts.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="cairo-dwrite-font-face-create-for-dwrite-fontface" role="function" condition="since:1.18">
<title>cairo_dwrite_font_face_create_for_dwrite_fontface&#160;()</title>
<indexterm zone="cairo-dwrite-font-face-create-for-dwrite-fontface" role="1.18"><primary sortas="dwrite_font_face_create_for_dwrite_fontface">cairo_dwrite_font_face_create_for_dwrite_fontface</primary></indexterm>
<programlisting language="C"><link linkend="cairo-font-face-t"><returnvalue>cairo_font_face_t</returnvalue></link>&#160;*
cairo_dwrite_font_face_create_for_dwrite_fontface
                               (<parameter><link linkend="void"><type>void</type></link> *dwrite_font_face</parameter>);</programlisting>
<para>Creates a new font for the DWrite font backend based on a
DWrite font face. 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>.</para>
<para>Here is an example of how this function might be used:</para>
<informalexample><programlisting><![CDATA[
#include <cairo-win32.h>
#include <dwrite.h>

IDWriteFactory* dWriteFactory = NULL;
HRESULT hr = DWriteCreateFactory(
    DWRITE_FACTORY_TYPE_SHARED,
    __uuidof(IDWriteFactory),
   reinterpret_cast<IUnknown**>(&dWriteFactory));

IDWriteFontCollection *systemCollection;
hr = dWriteFactory->GetSystemFontCollection(&systemCollection);

UINT32 idx;
BOOL found;
systemCollection->FindFamilyName(L"Segoe UI Emoji", &idx, &found);

IDWriteFontFamily *family;
systemCollection->GetFontFamily(idx, &family);

IDWriteFont *dwritefont;
DWRITE_FONT_WEIGHT weight = DWRITE_FONT_WEIGHT_NORMAL;
DWRITE_FONT_STYLE style = DWRITE_FONT_STYLE_NORMAL;
hr = family->GetFirstMatchingFont(weight, DWRITE_FONT_STRETCH_NORMAL, style, &dwritefont);

IDWriteFontFace *dwriteface;
hr = dwritefont->CreateFontFace(&dwriteface);

cairo_font_face_t *face;
face = cairo_dwrite_font_face_create_for_dwrite_fontface(dwriteface);
cairo_set_font_face(cr, face);
cairo_set_font_size(cr, 70);
cairo_move_to(cr, 100, 100);
cairo_show_text(cr, "😃");
]]></programlisting></informalexample>
<refsect3 id="cairo-dwrite-font-face-create-for-dwrite-fontface.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dwrite_font_face</para></entry>
<entry role="parameter_description"><para>A pointer to an <link linkend="IDWriteFontFace"><type>IDWriteFontFace</type></link> specifying the
DWrite font to use.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="cairo-dwrite-font-face-create-for-dwrite-fontface.returns" role="returns">
<title>Returns</title>
<para> 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.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.18">1.18</link></para></refsect2>

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

</refsect1>

</refentry>
