[haiku-appserver] Re: TextLayoutEngine

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Thu, 17 Nov 2005 00:51:45 +0100 CET

Stephan Aßmus <superstippi@xxxxxx> wrote:
> > The basic idea sounds very good, although I am not sure why that
> > method
> > should be called LayoutGlyphs() (oh, naming again).
> Maybe TextLayoutEngine should be GlyphLayoutEngine... :-)

Wouldn't be too bad :-)

> For real, the thing it is supposed to do is to be a single algorithm
> for
> layouting glyphs. Also implementing the different modes like
> B_CHAR_SPACING, B_STRING_SPACING, B_BITMAP_SPACING and whatnot.

That would be indeed pretty cool :-)

> [proposed change in locking]
>
> I also thought if it might be smarter to have the locking at the
> caching
> level. However, to readlock for each single glyph sounds too
> expensive
> IMHO. Or did I get you wrong?

The way I thought it, I would have gone for locking for every single
glyph. But maybe you're right and this is too expensive (or even
probably).
It could be easily changed to this, even though you'd then have to
preflight over the data and generate a list of (missing) glyphs:
        read lock cache
                lookup all glyphs (and increment their reference count)
                make a list of all missing glyphs (or mark them otherwise)
        unlock cache

        lock font style
                read lock cache
                        lookup all missing glyphs and add the new ones if any
                unlock cache
                generate all missing glyphs
                write lock cache
                        insert glyphs into cache
                unlock cache
        unlock font style

        call consumer and decrement reference count of the glyphs as you go

would that be alright with you? :-)

> > That's more or less what I would have done, at least.
> Oh, it was on your TODO as well? :-)

Yes, but I had postponed it a bit, since things worked okay for the
most part :-)
And I had only thought about the caching yet - I didn't imagined
something like the nice LayoutGlyphs() method :)

Bye,
   Axel.


Other related posts: