Closed Bug 939534 Opened 11 years ago Closed 11 years ago

Convert the SVG textPath code from gfxPath to Moz2D Path

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: jwatt, Assigned: jwatt)

References

(Blocks 1 open bug)

Details

(Whiteboard: [qa-])

Attachments

(1 file, 1 obsolete file)

We need to convert the SVG textPath code from gfxPath to Moz2D Path.
Attached patch patch (obsolete) (deleted) — Splinter Review
I've not bothered spending time on the old SVG text code since I'm hoping that will just be ripped out soon.
Attachment #833463 - Flags: review?(cam)
Attached patch patch (deleted) — Splinter Review
I just noticed the comment in bug 889736 about not wanting to take those patches until after the December uplift. Guess I better fix nsSVGGlyphFrame too then.
Attachment #833463 - Attachment is obsolete: true
Attachment #833463 - Flags: review?(cam)
Attachment #8333561 - Flags: review?(cam)
Blocks: 939589
Comment on attachment 8333561 [details] [diff] [review] patch Review of attachment 8333561 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/svg/nsSVGGlyphFrame.cpp @@ +783,5 @@ > + Point normal(-tangent.y, tangent.x); // Unit vector normal to the point. > + Point offsetFromPath = normal * pos.y; > + cp[i].pos = ThebesPoint(pt + offsetFromPath) - > + ThebesPoint(tangent) * halfAdvance; > + double glyphRotation = atan2(tangent.y, tangent.x); Use atan2f. ::: layout/svg/nsSVGTextFrame2.cpp @@ +4808,5 @@ > > // Position the character on the path at the right angle. > + Point tangent; // Unit vector tangent to the point we find. > + Point pt = path->ComputePointAtLength(Float(midx), &tangent); > + double glyphRotation = atan2(tangent.y, tangent.x); Use atan2f and make the variable a float (or Float). Either leave the variable with its old name, "angle", or use "rotation". All the variables around here are to do with the glyph, so I don't think it needs to be in the name.
Attachment #8333561 - Flags: review?(cam) → review+
Hmmmmmmm....switching to atan2f caused a slight difference in the positioning of textPath text, causing some failures on Mochitest 1: https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=4e64c6bb2732 I _think_ that's probably okay so I marked the tests as fuzzy: https://hg.mozilla.org/integration/mozilla-inbound/rev/67278f262497 However, CC'ing some people so they're aware of this.
The important thing to note being that the switch from double precision float to single precision float can cause us to no longer get nice round integer results when they might be expected.
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: