[webkit-dev] Design change request for Font

Mike Emmel mike.emmel at gmail.com
Sun Mar 19 06:55:38 PST 2006


On 3/19/06, David Hyatt <hyatt at apple.com> wrote:
> On Mar 18, 2006, at 4:05 PM, Mike Emmel wrote:
>
> > On 3/18/06, David Hyatt <hyatt at apple.com> wrote:
> >> You are not intended to initialize the native binding in the Font
> >> constructor.  The "native" side is created lazily when the properties
> >> of the font are queried.  Font is still in flux though (there are
> >> more changes coming to the Mac side that will make the design a bit
> >> more clear).
> >>
> >> dave
> >>
> > Okay but I'm not sure why not ..  in any case that decision should be
> > left to the implementor I'd think.
>
> Fonts are created for all objects in the RenderTree.  This includes
> objects that do not use the font values for anything.  Here's an
> example:
>
> <img style="font-weight:bold; font-size:36px; display:block">
>
> This image has a Font object that knows it is 36px and bold, but do
> you really want to create and access a native font resource when the
> font is effectively never going to be used?  The answer (for obvious
> performance reasons) is no.
>
> The design is that Font is a promise.  If you start asking it for
> actual metrics or to paint, then at that time the native font data
> should be accessed as needed.
>

Ahhh thanks a million I get it now.

> > I'm happy to wait for the changes  your
> > speaking of  but this is a good example were a bit of design
> > documentation would be useful IMHO.
> >
>
> Yeah.  Keep in mind Font is extremely young and in a state of flux.
> A lot of the design/classes are just now emerging (e.g., FontDataSet,
> etc.) and more of the Mac code is going to move over to this new
> design and become cross-platform.
>
Okay cool I did some work on a font library for cairo called demontic.
Its really primitive but cairo's font handling stinks. I notive your
using the native font
handling for win32 I think in the case of fonts cairos thin wrappers
should not cause
a performance problem and are cross platform.  I'd be intrested in
getting it to work under Win32 if you choose to use the cairo font
api. Right now demontic is a partial rewrite of
 libxft  to work with the cairo freetype backend


> I would advise doing what we did on Win32 (see FontWin.cpp) and (for
> now) just hack an implementation that does very basic text and then
> move on to something else.  If you wait a bit you'll find a lot more
> of the functionality will have become cross-platform, and then you'll
> have to do a lot less work.
>
Okay not a problem I hope you find a way to create a single
initializer when the font is actually bound native. Thats what I was
really intrested in.

> dave
> (hyatt at apple.com)
>
>

Agian thanks for the design notes they help me immensly.

Mike



More information about the webkit-dev mailing list