Bug 17541 - SVG font support gets wrong metrics by querying 'font' instead of 'font-face' element
Summary: SVG font support gets wrong metrics by querying 'font' instead of 'font-face'...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2008-02-25 15:37 PST by Mark Ambachtsheer
Modified: 2012-05-19 17:15 PDT (History)
2 users (show)

See Also:


Attachments
test file that reproduces bugs # 17541 and 17608 visually. (18.04 KB, text/html)
2008-02-29 08:52 PST, Mark Ambachtsheer
no flags Details
Screenshot of 17541_17608.html being rendered by WebKit (61.74 KB, image/png)
2008-02-29 08:53 PST, Mark Ambachtsheer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Ambachtsheer 2008-02-25 15:37:18 PST
WebKit isn't getting the right metrics for SVG fonts because it is falling back on default metrics when reading correct SVG font definitions with those metrics supplied.

Looking at SVGFontFaceElement::ascent() and SVGFontFaceElement::descent(), the code is attempting to query the 'font' element, when according to the specs here:
http://www.w3.org/TR/SVG/fonts.html#FontElement
http://www.w3.org/TR/SVG/fonts.html#FontFaceElement
the 'ascent' and 'descent' attributes should be defined on the font-face element.

This is using code checked out from SVN 2008/02/25.
Comment 1 Mark Ambachtsheer 2008-02-29 08:52:23 PST
Created attachment 19450 [details]
test file that reproduces bugs # 17541 and 17608 visually.
Comment 2 Mark Ambachtsheer 2008-02-29 08:53:21 PST
Created attachment 19451 [details]
Screenshot of 17541_17608.html being rendered by WebKit
Comment 3 Nikolas Zimmermann 2012-05-19 17:15:47 PDT
int SVGFontFaceElement::ascent() const
{
    // Spec: Same syntax and semantics as the 'ascent' descriptor within an @font-face rule. The maximum
    // unaccented height of the font within the font coordinate system. If the attribute is not specified,
    // the effect is as if the attribute were set to the difference between the units-per-em value and the
    // vert-origin-y value for the corresponding font.
    const AtomicString& ascentValue = fastGetAttribute(ascentAttr);
    if (!ascentValue.isEmpty())
        return static_cast<int>(ceilf(ascentValue.toFloat()));

..

This is long resolved in trunk, this bug was forgotten.