Bug 44531

Summary: [PATCH] underline-position in font-face has wrong sign
Product: Batik - Now in Jira Reporter: mg <markus+asf>
Component: GVT TextAssignee: Batik Developer's Mailing list <batik-dev>
Status: NEW ---    
Severity: minor Keywords: PatchAvailable
Priority: P3    
Version: 1.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 45598    
Attachments: SVG font with underline and overline text example
Patch from proposal

Description mg 2008-03-04 09:51:42 UTC
Created attachment 21625 [details]
SVG font with underline and overline text example

Attribute underline-position of element <font-face> seems to get negatived (-). Compared to attributes overline-position and strikethrough-position, this appears as unexpected. Apparently none of the SVG test fonts use underline-position and the default value looks fine. See getLineMetrics(int,int) in SVGGVTFont.java for the assignment to ulOffset without - in front of variable scale.

It might also be nice if stroke-width of underline would scale with font-size.
Comment 1 Helder Magalhães 2009-07-19 15:57:36 UTC
Created attachment 24006 [details]
Patch from proposal

(In reply to comment #0)
> Attribute underline-position of element <font-face> seems to get negatived (-).
> Compared to attributes overline-position and strikethrough-position, this
> appears as unexpected. Apparently none of the SVG test fonts use
> underline-position and the default value looks fine.

After investigating a bit, I've found that "samples/tests/spec/fonts/fontDecorations.svg" does use underline in a SVG font and, although no specific value is given to the "underline-position" property, just using underline seems to be enough (so I'd argue on the default value looking fine statement). ;-)


> See getLineMetrics(int,int) in SVGGVTFont.java for the assignment to ulOffset
> without - in front of variable scale.

The attached patch does exactly that. :-)  Fixes the attached test case and also improves look in "fontDecorations.svg". ;-)


> It might also be nice if stroke-width of underline would scale with font-size.

By taking a look at the source code and performing a quick test, it seems that it's already being done. Thing is the test case attached to this bug report uses a zero-width stroke, which intuitively would not scale (but I haven't double checked the specification regarding this; I'm not even sure if zero-width strokes should render...).
Comment 2 Helder Magalhães 2009-07-19 16:00:20 UTC
(Updating metadata to reflect a patch being available; Also, taking the opportunity to update a few bug properties.)
Comment 3 mg 2009-07-22 07:32:22 UTC
Thanks!