[cairo] Color fonts
Behdad Esfahbod
behdad at behdad.org
Wed Aug 9 22:43:51 UTC 2017
On Sun, Jul 30, 2017 at 12:20 AM, Adrian Johnson <ajohnson at redneon.com>
wrote:
> Does it work with user fonts?
>
Not yet. There's a comment in cairo-user-font.c:
/* TODO
* extend the glyph cache to support argb glyphs.
* need to figure out the semantics and interaction with subpixel
* rendering first.
*/
We now have the argb glyph cache. We have to do some tricks to identify
color glyphs. Still, interaction with subpixel rendering remains ambiguous.
When we do fix the above, I like to make cairo-surface.c wrap OpenType
color glyphs into a user-font before drawing. This way we can still get
original text to be embedded in PDF whereas current implementation just
draws them as images and loses text.
> On 30/07/17 01:00, Behdad Esfahbod wrote:
> > On Sat, Jul 29, 2017 at 11:58 AM, Uli Schlachter <psychon at znc.in
> > <mailto:psychon at znc.in>> wrote:
> >
> > Hi Behdad
> >
> > I don't think that is my decision to make. When thinking about
> "fonts in
> > cairo", I'm thinking "Behdad". I'm just asking weird questions from
> the
> > sideline. :-)
> >
> >
> > Thanks. :-) Pushed!!!! At least ten people already asked me "what's up
> > with emoji" at GUADEC...
> >
> >
> > Uli
> >
> > P.S.: How relevant and up to date is the CC list here? I always get a
> > "your message to gtk-devel-list awaits moderator approval"-mail when
> > replying to this thread...
> >
> >
> > My messages go through, yours probably don't because you are not a
> > member. It's valuable still.
> >
> > Cheers,
> > b
> >
> >
> > On 28.07.2017 16:38, Behdad Esfahbod wrote:
> > > Uli,
> > >
> > > Can we commit this? I don't think waiting another few years will
> > result in
> > > a superior patchset. :)
> > >
> > > Cheers,
> > >
> > > behdad
> > >
> > > On Wed, Jul 19, 2017 at 1:53 AM, Behdad Esfahbod
> > <behdad at behdad.org <mailto:behdad at behdad.org>> wrote:
> > >
> > >> Right. In the future we would want to make it show glyphs in the
> > input
> > >> order, ie. not separate color vs non-color. That's the order
> > required by
> > >> CSS for example. In a show-text-glyphs call with
> > CAIRO_TEXT_CLUSTER_FLAG_BACKWARD,
> > >> it might be desirable to show back-to-front.
> > >>
> > >> On Tue, Jul 18, 2017 at 1:59 PM, Matthias Clasen <
> > >> matthias.clasen at gmail.com <mailto:matthias.clasen at gmail.com>>
> wrote:
> > >>
> > >>> On Sat, Jul 15, 2017 at 4:05 AM, Uli Schlachter <psychon at znc.in
> > <mailto:psychon at znc.in>> wrote:
> > >>>
> > >>>> On 07.07.2017 15:23, Matthias Clasen wrote:
> > >>>>> On Sat, Jul 1, 2017 at 2:25 AM, Uli Schlachter <psychon at znc.in
> > <mailto:psychon at znc.in>> wrote:
> > >>>>>> On 30.06.2017 17:29, Behdad Esfahbod wrote:
> > >>>>>>> On Jun 30, 2017 7:51 PM, "Matthias Clasen"
> > <mclasen at redhat.com <mailto:mclasen at redhat.com>>
> > >>>> wrote:
> > >>>>>>> On Fri, 2017-06-30 at 17:02 +0200, Uli Schlachter wrote:
> > >>>>>>>> On 28.06.2017 14:23, Behdad Esfahbod wrote:
> > >>>>>>>>> All of you have asked me about the status of color fonts in
> > >>>>>>>>> cairo. There's
> > >>>>>>>>> some discussion here:
> > >>>>>>>>
> > >>>>>>>> what was the solution to make this fit into cairo's drawing
> > model?
> > >>>>>>>> Text
> > >>>>>>>> / glyphs are used as a mask and a mask does not have colors.
> > >>>>>>>>
> > >>>>>>>
> > >>>>>>> There is no solution to that. The assumption in cairo's
> > drawing model
> > >>>>>>> about glyphs/fonts has simply been invalidated by reality.
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> Correct.
> > >>>>>>
> > >>>>>> Okay... so what is the new model? What happens when I draw a
> > color
> > >>>> glyph
> > >>>>>> with operator XOR and a red source?
> > >>>>>
> > >>>>>
> > >>>>> The red source is ignored for color glyphs because they are
> > used as the
> > >>>>> source.
> > >>>>
> > >>>> Hi again,
> > >>>>
> > >>>> I just came up with another question: How are overlapping
> > glyphs handled?
> > >>>>
> > >>>> Let's say I have a red glyph and a blue glyph and I draw them
> > in such a
> > >>>> way that they overlap. Let's say this additionally overlaps
> with a
> > >>>> non-colored glyph in the same position and I use a green source
> > with 50%
> > >>>> alpha (cairo_set_source_rgba(cr, 0, 1, 0, 0.5)).
> > >>>>
> > >>>> What's the visible result?
> > >>>>
> > >>>>
> > >>> Here is what my implementation does: It renders the color
> glyphs, in
> > >>> order, followed by the non-color glyphs.
> > >>>
> > >>> In practice, I don't think the case of mixed color and non-color
> > glyphs
> > >>> in the same call will be all that common.
> > >>> Most apps will explicitly set a color font just for the emoji
> > and they
> > >>> won't render regular text with an emoji font,
> > >>> with the result that runs of color glyphs and non-color glyphs
> will
> > >>> typically be in separate calls.
> > >>>
> > >>
> > >>
> > >>
> > >> --
> > >> behdad
> > >> http://behdad.org/
> > >>
> > >
> > >
> > >
> >
> >
> > --
> > "Why make things difficult, when it is possible to make them cryptic
> > and totally illogical, with just a little bit more effort?" -- A. P.
> J.
> >
> >
> >
> >
> > --
> > behdad
> > http://behdad.org/
> >
> >
>
>
--
behdad
http://behdad.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20170809/28d248b5/attachment.html>
More information about the cairo
mailing list