<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dominic Lachowicz wrote:
<blockquote
cite="mid:2672cf4d0909080444y38e6661mcca8716cef95abed@mail.gmail.com"
type="cite">
<pre wrap="">On Tue, Sep 8, 2009 at 6:22 AM, ecir hana<a class="moz-txt-link-rfc2396E" href="mailto:ecir.hana@gmail.com"><ecir.hana@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Mon, Sep 7, 2009 at 5:45 PM, Dominic Lachowicz<a class="moz-txt-link-rfc2396E" href="mailto:domlachowicz@gmail.com"><domlachowicz@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">You should be able to use Cairo with FreeType loading fonts from
files. See the documentation for
cairo_ft_font_face_create_for_ft_face().
</pre>
</blockquote>
<pre wrap="">Ok, now that I look at this I'm not sure I understood. That function
accepts "pre-opened FreeType face" - what does it mean? I thought I
could somehow pass a path to a file font, do I need to first somehow
open the font via FreeType and then it can be used in Cairo? Perhaps
are there some examples somewhere?
</pre>
</blockquote>
<pre wrap=""><!---->
You need to first open the font via freetype. Check the following URL
for examples.
<a class="moz-txt-link-freetext" href="http://www.freetype.org/freetype2/docs/tutorial/step1.html">http://www.freetype.org/freetype2/docs/tutorial/step1.html</a>
</pre>
</blockquote>
Kinda like this:<br>
<br>
------------------------------------------<tt><br>
FT_Init_FreeType(&ft_library);<br>
<br>
fopt = cairo_font_options_create();<br>
cairo_matrix_init_identity(&cmt);<br>
<br>
FT_New_Face(ft_library, PATH_TO_FONT, INDEX_OF_FONT_IN_FILE,
&ft_face);<br>
utf = cairo_ft_font_face_create_for_ft_face(ft_face, 0);<br>
cairo_matrix_init_scale(&mt, DESIRED_SIZE, DESIRED_SIZE);<br>
tf = cairo_scaled_font_create(utf, &mt, &cmt, fopt);<br>
cairo_font_face_destroy(utf);<br>
</tt><br>
------------------------------------------<br>
<br>
utf is an unscaled font. tf is your scaled font (i.e. font + size) for
use in any Cairo surface (it's size can still be changed later)<br>
<br>
</body>
</html>