<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [C++] Embolden doesn't work in a text"
href="https://bugs.freedesktop.org/show_bug.cgi?id=75219">75219</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>david@freetype.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>[C++] Embolden doesn't work in a text
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>cairo-bugs@cairographics.org
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Reporter</th>
<td>guillaume.mercat@cofelyineo-gdfsuez.com
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86 (IA32)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>1.12.14
</td>
</tr>
<tr>
<th>Component</th>
<td>freetype font backend
</td>
</tr>
<tr>
<th>Product</th>
<td>cairo
</td>
</tr></table>
<p>
<div>
<pre>I use Cairo with freetype to write texts in my software.
I have a font without "bold" and i want to use "Synthesize Bold".
But my word isn't Embolden.
When i debug in cairo, i see, in 'cairo_scaled_font_create' (in file
cairo_scaled-font.c), the scaled_font is found in font_map (scaled_font =
font_map->mru_scaled_font) and _cairo_scaled_font_matches return true. So when
i draw text, cairo find scaled_glyph in the 'hash_table->cache' (in function
'_cairo_scaled_glyph_lookup') but this scaled_glyph isn't init with flag
"Synthesize Bold" and so it isn't embolden.
I think the issue is around the 'mru_scaled_font' usage where it matches with
font_face in cairo_scaled_font_create.
I do :
[...]
FT_Face FTFace = GetFreetypeFace ();
cairo_t* pContext = NULL;
cairo_font_face_t* pCairoFontFace = NULL;
cairo_user_data_key_t Key;
cairo_surface_t* pSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1,
1);
if(pSurface)
{
pContext = cairo_create(pSurface);
pCairoFontFace = cairo_ft_font_face_create_for_ft_face (FTFace,0);
cairo_font_face_set_user_data (pCairoFontFace, &Key, FTFace, NULL);
cairo_ft_font_face_set_synthesize(pCairoFontFace, CAIRO_FT_SYNTHESIZE_BOLD);
cairo_set_font_face(pContext, pCairoFontFace);
cairo_text_path (pContext, TextBuffer.GetData());
cairo_fill(pContext);
if(cairo_status(apContext) == CAIRO_STATUS_SUCCESS)
{
cairo_font_face_set_user_data (pCairoFontFace, &Key, NULL, NULL);
cairo_font_face_destroy(pCairoFontFace);
}
if(NULL != pContext)
{
cairo_destroy(pContext);
}
cairo_surface_destroy(pSurface);
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>