<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Treat color glyph alpha as mask instead of source alpha"
href="https://bugs.freedesktop.org/show_bug.cgi?id=102661">102661</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Treat color glyph alpha as mask instead of source alpha
</td>
</tr>
<tr>
<th>Product</th>
<td>cairo
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>freetype font backend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>david@freetype.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jan.steffens@gmail.com
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>cairo-bugs@cairographics.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=134165" name="attach_134165" title="[PATCH] Hacky hack: Use color glyph alpha as mask">attachment 134165</a> <a href="attachment.cgi?id=134165&action=edit" title="[PATCH] Hacky hack: Use color glyph alpha as mask">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=102661&attachment=134165'>[review]</a>
[PATCH] Hacky hack: Use color glyph alpha as mask
Context:
After upgrading to cairo 1.15.8, i3 suddenly cleared its surfaces before
drawing color glyphs, because it uses the SOURCE operator for text drawing:
<a href="https://github.com/i3/i3/pull/2908">https://github.com/i3/i3/pull/2908</a>
My patch to use OVER instead was reverted as another user uses a fork with
alpha source to "punch holes":
<a href="https://github.com/i3/i3/pull/2925">https://github.com/i3/i3/pull/2925</a>
Looking for an alternative solution, the attached (very hacky) patch alters
cairo's handling of color glyphs:
- When loading a color glyph, separate the alpha channel and save it as
the non-color surface.
- Use the non-color surface as the mask when compositing color glyphs.
- Plug a leak of patterns in composite_one_color_glyph
=> Drawing glyphs with CAIRO_OPERATOR_SOURCE no longer clears dest. In
general the handling of color glyphs should match the handling of
normal glyphs now, except for the source color.
=> Possible extension: Let the user deactivate color glyph handling (in
the context? in the pattern?) in order to draw with the chosen source
instead, for things like text shadows. Since the normal surface is the
alpha mask now, this handles color glyphs nicely.
To do that, just have it override the check of
_cairo_scaled_font_has_color_glyphs to be false.
My ignorance of cairo and pixman internals means this is probably
terrible code.</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>