Re: Render glyphs in foreground?

Adam Megacz <[email protected]>
Newsgroups gmane.comp.java.xwt.core
Organization XWT
Message-ID <[email protected]>
Adam Megacz <[email protected]> writes:
> One interesting possibility is to do 100ms worth of font-rendering

The key here is that we have to be reasonably sure that we can render
at least one glyph in <100ms on even the slower platforms.  From
Bryan's post it sounds like that is a reasonable assumption.

Actually, here's an ever better idea:

  - Setting box.font=foo is a blocking operation.  It doesn't return
    until the stream is completely downloaded.

  - When you render a box, Ibex *synchronously* acquires the bounding
    box of all the glyphs used.  This should be really super fast.
    The box is then sized correctly.  This avoids the ugliness where a
    background rendering task can trigger a reflow.

  - The bitmaps of glyphs are created *asynchronously*.  For
    simplicity we still probably want to do this in the rendering
    thread, but limit the amount of work we do to 100ms.

This also eliminates the need for ibex.thread.wait.font(), which
seemed somehow wrong to me anyways (but I see why we need it).

BTW, I don't know if we've discussed this recently, but applying
templates should be considered a blocking operation (ie can only
happen in the background thread) even if the template doesn't do
anything that would otherwise block.  This has two advantages:

  - you can set fonts in the background thread under the scheme above

  - template writers can always assume that their (initial) code runs
    in a background thread.  This makes life much easier since often
    "startup" involves a lot of potentially-blocking operations which
    must be performed in sequence.  If two such operations are in
    different templates, they would have to spawn two separate threads
    to "get into the background", which means you have to do ugly
    synchronization hacks to make sure they happen in the right order.

  - a
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.