Closed
Bug 570915
Opened 14 years ago
Closed 9 years ago
[harfbuzz] need a separate API for passing sanitized font tables to harfbuzz
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: jtd, Unassigned)
References
Details
Within _hb_ot_layout_new, the GDEF, GPOS and GSUB tables are sanitized
an hb_face object is initialized:
hb_ot_layout_t *
_hb_ot_layout_new (hb_face_t *face)
{
/* Remove this object altogether */
hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
layout->gdef_blob = Sanitizer<GDEF>::sanitize (hb_face_get_table (face, HB_OT_TAG_GDEF));
layout->gdef = Sanitizer<GDEF>::lock_instance (layout->gdef_blob);
layout->gsub_blob = Sanitizer<GSUB>::sanitize (hb_face_get_table (face, HB_OT_TAG_GSUB));
layout->gsub = Sanitizer<GSUB>::lock_instance (layout->gsub_blob);
layout->gpos_blob = Sanitizer<GPOS>::sanitize (hb_face_get_table (face, HB_OT_TAG_GPOS));
layout->gpos = Sanitizer<GPOS>::lock_instance (layout->gpos_blob);
return layout;
}
An hb_face object is created for each instance of a gfxFont object,
so once for the lifetime of every <font, style> pair. As a result,
it can be called repeatedly on the same data, it really only needs to
happen once during the lifetime of the app (assuming the font doesn't change).
Some form of harfbuzz API change is needed here, don't know the exact form this should take but validation should only happen once.
Comment 1•11 years ago
|
||
Behdad, do you think this is something you want for 1.0 API?
Comment 2•11 years ago
|
||
This is a non-issue and should be closed. John wrote: "An hb_face object is created for each instance of a gfxFont object, so once for the lifetime of every <font, style> pair." That's wrong. An hb_face should be created once for any piece of font blob and cached. I'm sure it's what gecko does these days.
Comment 3•11 years ago
|
||
Not quite, IIRC. The hb_face is shared between all gfxFont instances that refer to the same gfxFontEntry (which owns the font data, etc), so we don't have a separate hb_face for each size, for example. It persists as long as there's any live <font,style> pair that needs it, but it may be discarded once no instance is left.
So validation happens once when we first begin to use a particular font resource, and is not repeated when the same resource is used with different sizes/styles; but it may be repeated if the font has been unused long enough for all font instances to expire from cache, and subsequently is requested again.
Still, I agree this isn't an issue that we need to do anything about. The cost isn't significant in our use.
OK to resolve as WontFix, John?
Updated•9 years ago
|
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•