<br><br>
<div><span class="gmail_quote">On 2/23/07, <b class="gmail_sendername">David Turner</b> <<a href="mailto:david@freetype.org">david@freetype.org</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hello everyone,<br><br>I'm reaching completion of my changes to Cairo's FreeType/FontConfig backend; The code
<br>runs well but there is a notable difference from the current implementation that I don't<br>know how to interpret correctly.<br><br>In the current implementation, if I use cairo_ft_font_face_create_for_pattern() with a
<br>source pattern that has FC_ANTIALIAS set to FALSE, this setting is recorded internally,<br>and cannot be overriden later in scaled fonts. What I mean is this:<br><br> // create FcPattern without anti-aliasing and the corresponding font face
<br><br> .. create 'pattern'<br> FcPatternDel (pattern, FC_ANTIALIAS)<br> FcPatternAdd (pattern, FC_ANTIALIAS, FC_FALSE);<br><br> font_face = cairo_ft_font_face_create_for_pattern (pattern);<br><br> // create a scaled font using CAIRO_ANTIALIAS_GRAY as an option
<br> font_options = cairo_font_options_create ();<br> cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);<br><br> scaled_font = cairo_scaled_font_create (font_face, &some_matrix, &some_ctm, font_options);
<br><br> // rendering will NOT be ANTIALIASED !!<br><br>I find it very strange since none of the other font backends seem to ignore the<br>used-provided font options when creating a scaled font.<br><br>Is this a bug, or even desirable. I find it extremely confusing, and an un-needed special-case.
<br><br>It seems the only alternative is to explicitely alter the pattern depending on your<br>desired font options, *before* creating the font_face itself. This is exactly what the<br>test "ft-text-antialias-none" does, with something that looks like:
<br><br> FcConfigSubstitute (NULL, pattern, FcMatchPattern);<br><br> cairo_ft_font_options_substitute (font_options, pattern);<br><br> FcDefaultSubstitute (pattern);<br> resolved = FcFontMatch (NULL, pattern, &result);
<br><br>it also seems that cairo_ft_font_options_substitute's raison-d'être is only to support<br>this weird special-case.<br><br>So, should we keep this behaviour as is, or should we fix it ?</blockquote>
<div> </div>
<div>This behaviour is intented. The font options comes from FcPattern are recorded internally and some of them can't be overriden later.</div>
<div>The font options from scale font are awlays a hint for font backend, font backend may choose to respect them or even completely ignore them. FcPattern contains all options from user configurations, if we ignore them or overide them then we can't disable anitialiasing, set subpixel order etc by tuning
fonts.conf..., this is obviously not what we want.<br> </div><br> </div>