This is an architectural flaw right now. I broke the ability to flush the cache when porting the code from Obj-C to C++, because I lost the reference counting aspect of the font cache.

You basically want the ability to flush the cache.

My suggested approach would be to re-architect things so that FontData and FontPlatformData are actually reference-counted objects.

Right now font lookup is a 2-step process primarily just for Mac.

You go from:

FontDescription -> FontPlatformData

and then from

FontPlatformData -> FontData

On the Mac, FontPlatformData doesn't need to be reference-counted, since it wraps an NSFont, which is already reference-counted and canonical (so that the same font will yield the same NSFont*). Because it's canonicalized, you can actually easily go from NSFont -> FontData.

In order to flush the cache easily, you need FontData to be reference- counted so that the cache can drop references, and then the individual RenderStyles can drop references as they go away.

FontPlatformData is the sticky bit though. FontPlatformData will have to properly reference-count its internal object on all platforms. The easiest way to guarantee this works on all platforms would probably be to just make FontPlatformData reference-counted too. If this is done, the retains and releases of the NSFont on Mac could be dropped from FontPlatformData's constructors and destructors on Mac.

I don't really have plans to get to this soon, so this would definitely be an area in which you could help out. :)

dave
([EMAIL PROTECTED])

On Jan 11, 2007, at 1:26 PM, Mike Reed wrote:

In the (nearly) latest version, webkit is caching glyph metrics based
on font+pointSize. If my device characteristics change (e.g. screen
res), I think I need to invalidate those widths (or spawn a new set),
so that measuring and drawing reflect the new values.

Any pointers to help me with my port?
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-dev

_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to