[cairo-bugs] [Bug 102661] New: Treat color glyph alpha as mask instead of source alpha

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Sep 11 18:04:45 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=102661

            Bug ID: 102661
           Summary: Treat color glyph alpha as mask instead of source
                    alpha
           Product: cairo
           Version: unspecified
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: freetype font backend
          Assignee: david at freetype.org
          Reporter: jan.steffens at gmail.com
        QA Contact: cairo-bugs at cairographics.org

Created attachment 134165
  --> https://bugs.freedesktop.org/attachment.cgi?id=134165&action=edit
[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:

https://github.com/i3/i3/pull/2908

My patch to use OVER instead was reverted as another user uses a fork with
alpha source to "punch holes":

https://github.com/i3/i3/pull/2925

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.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo-bugs/attachments/20170911/50d6c799/attachment.html>


More information about the cairo-bugs mailing list