Text with manual kerning displays "unkerned" in browsers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I'm using Inkscape 0.46+devel r20840, built Mar 6 2009 on Windows XP
After manual kerning of a text object, if you render the file in browsers (I tried Opera, Seamonkey and Firefox recent versions), the text appears as not kerned.
See the attachment, where the text on top has no manual kerning, and the bottom text has, in Inkscape.
See also the screenshot I'll attach of the rendering.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#2 |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9a1) Gecko/20060413 Firefox/3.0a1 - Build ID: 0000000000
Confirmed.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#3 |
Created an attachment (id=236237)
Initial patch attempt
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#4 |
Created an attachment (id=236424)
Test Case
This is a test for doubly nested tspan elements and the text-anchor property. The text:
Isn't
SVG
Just
The Best
Should appear twice on the left side of the test. The top version uses doubly nested tspan elements, while the bottom version uses no nesting at all.
On the right side of the test, several lines using different text-anchor and dx attributes are displayed.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#5 |
Created an attachment (id=236426)
Text Path Anchor Testcase
This test case tests the use of the text-anchor attribute with the textPath element. The last test checks to see dx and dy attributes inside a textPath are appropriately scaled according to the pathLength attribute.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#6 |
Created an attachment (id=236436)
Test current text position on textPath
This test case explores the various ways a textPath can be affected when one if its children or a parent declares x, y, dx, or dy attributes.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#7 |
Check out bug 319345 . I think it is related.
Are you looking for comments on your initial patch attempt?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#8 |
(In reply to comment #7)
What I am looking for at the moment are some comments on the overall structure of my patch. I have already found a few corner cases that I missed in my initial patch, so it's probably best to hold off on any detailed analysis until I post a new version with the necessary modifications. Thanks!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#9 |
Created an attachment (id=236867)
Updated Text Position on textPath Test Case
Old version had a test with a textPath element inside a tspan which is invalid according to the script. This version also has some additional text on a path tests.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#10 |
Created an attachment (id=236868)
patch - first revision
Updated patch handles text on a path correctly and passes all of the attached test cases.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#11 |
(From update of attachment 236868)
My 2c, for what its worth.
I think my fundamental structural concern is that this does not really use either the GetNextGlyphFra
> *val = data->GetLength
>- } else if (pathFrame-
>+ } else if (pathFrame-
> nsGkAtoms:
>- nsCOMPtr<
>+ nsCOMPtr<
> do_QueryInterfa
These are the same to my eye. Could you have inserted DOS style LF/CR into these lines?
> pathLength-
>- if (pl)
>+ if (pl)
> *val *= data->GetLength() / pl;
>- else
>+ else
> *val = 0;
As above.
>+PRBool
>+IsAbsolutelyP
I'm not sure why you implemented this here rather than using the implementation in nsSVGGlyphFrame
>- {
>- nsCOMPtr<
>- GetSingleValue(
>+/*
>+ * Performs a pre-order traversal on the subtree rooted at “node” until an
>+ * absolutely positioned node is found or until the entire subtree has been
>+ * explored. Sum is increased by the total advance of all the nodes visited.
>+ * Returns PR_TRUE if the subtree contained an absolutely positioned node.
>+ */
>+PRBool
>+GetSubTreeGly
>+ nsSVGTextPathFr
>+ float *sum)
>+{
>+ if (!node)
>+ return PR_FALSE;
>+
>+ if (node->GetType() == nsLayoutAtoms:
>+ *textPath = NS_STATIC_
>+ } else if (node->GetType() == nsLayoutAtoms:
>+ nsSVGTextContai
>+
>+ float dx = 0;
>+ nsCOMPtr<
>+ GetSingleValue(
>+ *sum += dx;
>+
>+ } else if (node->GetType() == nsLayoutAtoms:
>+ nsCOMPtr<
>+ *sum += fragment-
> }
>- {
>- nsCOMPtr<
>- GetSingleValue(
>+
>+ nsIFrame* nextNode = node->GetFirstC
Could you work with GetFirstGlyphFr
>+ while (nextNode) {
>+ if (IsA...
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#12 |
A couple of other things...
There are strange characters in the patch that appear as diamonds with a question mark in them (also visible in my previous comment post).
+ PRUint32 numChars = (*fragment)
+ for (PRUint32 i = numChars - 1; i >= 0; --i) {
+ (*fragment)
+ if (pt) {
+ pt->GetX(x);
+ pt->GetY(y);
+ break;
Actually you don't need to return all the position data do you, just write a new method that returns the end position of the last valid character.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#13 |
Thank you very much for your insightful feedback. I have been successful in implementing many of the changes you recommended but have run into problems with the ones mentioned below.
>I think my fundamental structural concern is that this does not really use
>either the GetNextGlyphFra
>the fragment trees...
I agree that it would be nice to use the pre-existing GlyphFragment code to traverse the tree, but I have had some difficulty in making this approach work. The major problem I have run into is that calling GetDx/GetDy on a nsISVGGlyphFrag
Take the following svg snippet for example
<tspan dy="18"
Calling GetDy on the “T” fragment will return the dy of its parent, which is 0. Similarly, calling GetDy on “ext” will return 18. For this reason, my patch avoids calling GetDx/GetDy on fragments by traversing over the frames. Another possible solution would be to have each fragment walk up the tree, summing the offsets of its parent frames, until a node that is not the first child of its parent is reached. Unfortunately, we still need to be able determine if we are inside a textPath in order to scale the offsets by pathLength if necessary, so for the average case we will have to walk the tree all the way to the root for each fragment we process. This would result in more tree walking but might fit more neatly into the existing code.
>These are the same to my eye. Could you have inserted DOS style LF/CR into
> these lines?
>>- if (pl)
>>+ if (pl)
The (subtle) difference here is that trailing white space has been removed.
>>+PRBool
>>+IsAbsolutely
>I'm not sure why you implemented this here rather than using the
>implementation in nsSVGGlyphFrame
>lives, I would have thought it made more sense to make this a member function
>of nsSVGTextContai
I reimplemented IsAbsolutelyPos
>Can GetSubTreeGlyph
>I think this will work if we iterate over the fragments.
>There are strange characters in the patch that appear as diamonds with a
>question mark in them (also visible in my previous comment post).
I'm afraid I haven't been able to find the bizarre characters you describe, could you give me a line on which they appear?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#14 |
(In reply to comment #13)
> I agree that it would be nice to use the pre-existing GlyphFragment code to
> traverse the tree, but I have had some difficulty in making this approach work.
> The major problem I have run into is that calling GetDx/GetDy on a
> nsISVGGlyphFrag
> fragment.
>
> Take the following svg snippet for example
> <tspan dy="18"
>
> Calling GetDy on the �T� fragment will return the dy of its parent, which is 0.
> Similarly, calling GetDy on �ext� will return 18. For this reason, my patch
Around the T and the ext I see strange diamond characters.
> avoids calling GetDx/GetDy on fragments by traversing over the frames. Another
> possible solution would be to have each fragment walk up the tree, summing the
> offsets of its parent frames, until a node that is not the first child of its
> parent is reached. Unfortunately, we still need to be able determine if we are
> inside a textPath in order to scale the offsets by pathLength if necessary, so
> for the average case we will have to walk the tree all the way to the root for
> each fragment we process. This would result in more tree walking but might fit
> more neatly into the existing code.
I think that's the way I'd go, we've got FindTextPathParent. We could always optimise it later by putting in some boolean member variable to hold whether we're the child of a text path although we'd have to track that against DOM changes. We don't need to go back to the root though, just to the first parent text element we find. If we haven't found a text path by then we're not going to.
>
> >These are the same to my eye. Could you have inserted DOS style LF/CR into
> > these lines?
> >>- if (pl)
> >>+ if (pl)
>
> The (subtle) difference here is that trailing white space has been removed.
OK.
> I reimplemented IsAbsolutelyPos
> if a given frame defined a new absolute position. I have not been able to find
> a clean way of using nsSVGGlyphFrame
> decide to iterate over the fragments then I can use the original version,
> otherwise I can move my version into nsSVGTextContai
> remove the old version depending on what else needs it.
I think that just the code you are rewriting uses it :)
> >There are strange characters in the patch that appear as diamonds with a
> >question mark in them (also visible in my previous comment post).
>
> I'm afraid I haven't been able to find the bizarre characters you describe,
> could you give me a line on which they appear?
>
See above.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#15 |
(In reply to comment #13)
> I agree that it would be nice to use the pre-existing GlyphFragment code to
> traverse the tree, but I have had some difficulty in making this approach work.
> The major problem I have run into is that calling GetDx/GetDy on a
> nsISVGGlyphFrag
> fragment.
>
> Take the following svg snippet for example
> <tspan dy="18"
>
> Calling GetDy on the �T� fragment will return the dy of its parent, which is 0.
> Similarly, calling GetDy on �ext� will return 18. For this reason, my patch
> avoids calling GetDx/GetDy on fragments by traversing over the frames. Another
> possible solution would be to have each fragment walk up the tree, summing the
> offsets of its parent frames, until a node that is not the first child of its
> parent is reached. Unfortunately, we still need to be able determine if we are
> inside a textPath in order to scale the offsets by pathLength if necessary, so
> for the average case we will have to walk the tree all the way to the root for
> each fragment we process. This would result in more tree walking but might fit
> more neatly into the existing code.
Or perhaps you could extend the fragment (or node) interface to pass along whether the node is a child of a text path in the getNext... arguments?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#16 |
I am reworking the code so that it iterates over glyph fragments, but have run into a problem that might occur given the following svg code:
<text> Hello <tspan dx="50"/> World </text>
Here we see a tspan element with no glyph fragments as children. It is unclear to me what the correct behavior is under these conditions, but logic would seem to dictate that the current text position should be advanced by 50 after the word hello. ASV renders the above code with the offset while Batik and Opera ignore it. The problem I am having with iterating over the fragments is that since the tspan is childless, I have no way of knowing that it exists so I cannot apply to offset. Any suggestions for a work around? Perhaps a frame based approach might end up being cleaner?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#17 |
It would be nice to stay away from frames where possible I think, so that the user can use JavaScript to obtain measurements of the text when there are no frames for the content.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#18 |
(In reply to comment #16)
> I am reworking the code so that it iterates over glyph fragments, but have run
> into a problem that might occur given the following svg code:
>
> <text> Hello <tspan dx="50"/> World </text>
>
> Here we see a tspan element with no glyph fragments as children. It is unclear
> to me what the correct behavior is under these conditions, but logic would seem
> to dictate that the current text position should be advanced by 50 after the
> word hello. ASV renders the above code with the offset while Batik and Opera
> ignore it. The problem I am having with iterating over the fragments is that
> since the tspan is childless, I have no way of knowing that it exists so I
> cannot apply to offset. Any suggestions for a work around? Perhaps a frame
> based approach might end up being cleaner?
>
Perhaps you should iterate using GetNextGlyphFra
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#19 |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
SVG text and tspan elements in FF 2.0 support only an initial XY position.
The enhancement adds support for x,y,dx,dy lists on text and tspan elements, so that each character may be individually positioned.
Reproducible: Always
Steps to Reproduce:
1. View the example http://
Actual Results:
The first character is positioned at the initial XY. Subsequent characters are positioned using the default character advance.
Expected Results:
The first character should be positioned at the initial XY. Subsequent characters should be positioned using the XY values specified in the X and Y attributes of the tpans.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#20 |
Created an attachment (id=272746)
Enhancement that implements x.y.dx.dy lists for SVG tspan and text elements
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#21 |
patch was implemented by Ken Stacey (<email address hidden>)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#22 |
This is a duplicate of bug 311986.
If you are looking for reviews you need to select a reviewer.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#23 |
(From update of attachment 272746)
One general comment.
I think it would be better all round if you tried to adapt the existing character placement mechanism used for textPath elements rather than having two separate implementations. i.e. use nsSVGCharacterP
>Index: layout/
>======
...
>- NS_IMETHOD_(void) SetGlyphPositio
>+ NS_IMETHOD_(void) SetGlyphPositio
>+ NS_IMETHOD_(void) GetNextGlyphPos
If you change an interface you must update its ID i.e.
// {2C466AED-
#define NS_ISVGGLYPHFRA
{ 0x2c466aed, 0xcf7b, 0x4479, { 0xa8, 0x7, 0x98, 0x15, 0x12, 0x15, 0xa6, 0x45 } }
> nsSVGGlyphFrame
> : nsSVGGlyphFrame
> mWhitespaceHand
> {
>+ mDoCharPlacement = PR_FALSE;
>+ mStrLength = 0;
Initialise member variables in the initialiser bit rather than the constructor body c.f. mWhitespaceHandling above. However see below.
>Index: layout/
>======
>RCS file: /cvsroot/
>retrieving revision 1.25
>diff -u -8 -p -r1.25 nsSVGGlyphFrame.h
>--- layout/
>+++ layout/
>@@ -114,29 +114,30 @@ public:
> nsRefPtr<
> nsAutoPtr<
> gfxPoint mPosition;
> PRUint8 mWhitespaceHand
>+ nsAutoArrayPtr<
>+ PRBool mDoCharPlacement; // do per character placement
This bloats the class size. Reuse the textPath mechanism and calculate this when you need it.
Also don't use PRBool as a class member, use PRPackedBool.
And finally order any member variables in sizeof order to ensure minimal sizeof of the class as a whole.
>+ gfxPoint mNextGlyphPosition;
>+ float mBaselineOffset;
>+ PRUint32 mStrLength;
mStrLength just bloats the class size.
How many of these new members are absolutely mandatory? Most text will not have multiple x and y positions so we don't want to pay for that all the time. Neither do we want to store anything we can easily calculate.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#24 |
Created an attachment (id=275429)
Enhancement 2 that implements x.y.dx.dy lists for SVG tspan and text elements
Reworked after Robert Longson's comments of 2007-07-18 02:21:56 PDT
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#25 |
A few comments:
* you have some unchecked memory allocations that should be handled.
* there a few unprotected printfs - wrap with DEBUG_* or remove.
* since you're treating startOffset differently, nsSVGTextPathFr
can be modified to remove the startOffset chunk and just request it from
the content in GetStartOffset iff that attribute is set.
* looks like GetStartOffset could use GetPathScale.
* maybe modify the signature of SetGlyphPosition to take a gfxPoint&
instead of moving data in and out of that structure?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#26 |
Could you update your tree to the trunk head before you submit your next patch please? The constructor for nsSVGGlyphFrame is now inline in nsSVGGlyphFrame.h for instance.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#27 |
(In reply to comment #6)
> * you have some unchecked memory allocations that should be handled.
Not sure what you mean. Which allocations ?
> * there a few unprotected printfs - wrap with DEBUG_* or remove.
Thanks, I thought I got all of them.
> * since you're treating startOffset differently, nsSVGTextPathFr
> can be modified to remove the startOffset chunk and just request it from
> the content in GetStartOffset iff that attribute is set.
ok.
> * looks like GetStartOffset could use GetPathScale.
GetStartOffset does scale the value if needed.
> * maybe modify the signature of SetGlyphPosition to take a gfxPoint&
> instead of moving data in and out of that structure?
ok. But will have to move (float) x,y in and out of a gfxPoint in an outer loop of nsSVGTextFrame:
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#28 |
(In reply to comment #7)
Thanks Robert.
I can generate a new patch. But I can't test now because the build fails in a macro in extensions/
Is this a common problem: update the source tree and then have the build fail ?
Is there a "safe" source I should update from ?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#29 |
That's minefield for you. You are suffering from bug 391147. I'll post a patch for that later today unless someone else beats me to it.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#30 |
(In reply to comment #8)
> Not sure what you mean. Which allocations ?
+ mCharPositions = new gfxPoint[
for instance
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#31 |
Created an attachment (id=275600)
testcase
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#32 |
Created an attachment (id=275601)
expected rendering for testcase
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#33 |
*** Bug 311986 has been marked as a duplicate of this bug. ***
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#34 |
(In reply to comment #11)
> + mCharPositions = new gfxPoint[
>
> for instance
ok.
So, this one should be checked too ?
nsSVGCharacte
It is unchecked in latest source (nsSVGGlyphFram
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#35 |
Created an attachment (id=275926)
startOffset in textPath lost when title element
I was creating some textPath test cases and ran across this strange problem. Using a current build, the startOffset should be 50% but ends up 0. If you remove the title element from the document, then it works ok.
This file works as expected with Firefox 2.0.0.6 with or without the title.
The extent to which I tracked it was
nsSVGTextPathFr
nsSVGTextPath
nsSVGUtils:
*aRefFrame = aPresShell-
?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#36 |
Created an attachment (id=276088)
Enhancement that implements x.y.dx.dy lists for SVG tspan and text elements
Updated patch addressing recent comments
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#37 |
Created an attachment (id=276089)
layout examples of x,y,dx,dy positioning + textPath
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#38 |
Created an attachment (id=276090)
rendering for layout example
screen capture of layout example (id=276089) using patch (id=276088)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#39 |
(From update of attachment 276088)
General points:
If you are working with gfxFloat then literal assignment should not use f as gfxFloat is a double. If you are working with float then you should use an f suffix on literals.
Does inheritance of tspan values work? Have you tested that? Something like this contrived example...
<text x="1 2 3 4 5" y="4 5 6 7">h<tspan dx="5 6">e<tspan>
The first l in hello has no dx in its tspan so it should pick up the parent tspan dx, presumably the 6.
Neither of the tspans have x or y values so they should pick up the text values where they exist.
>+float
>+nsSVGGlyphFra
>+{
>+ if (fragmentChars == 0) // do the whole run
>+ fragmentChars = text.Length();
Fix the caller to pass in the right value rather than having a magic number.
>+ for (PRUint32 i = charnum; i < dxcount; i++) {
>+ float dx = 0.0;
0.0f
>+void
>+nsSVGGlyphFra
>+ gfxPoint &ctp)
>+{
>+ gfxFloat pathScale = 1.0f; //only applied to dx,dy lists since x,y lists nsnull for nsSVGTextPathFrame
Put the comment on the previous line to avoid a long line.
>+ x -= advance/2.0f;
2.0
> NS_IMETHODIMP
> nsSVGGlyphFrame
> {
>+ if (angle != 0.0f) {
0.0
> NS_IMETHODIMP
> nsSVGGlyphFrame
>@@ -834,23 +1013,30 @@ nsSVGGlyphFrame
> return NS_ERROR_
>
>+ gfxFloat angle = cp[charnum].angle;
>+ if (angle != 0.0f) {
0.0
>Index: layout/
>======
>RCS file: /cvsroot/
>retrieving revision 1.26
>diff -u -8 -p -r1.26 nsSVGGlyphFrame.h
>--- layout/
>+++ layout/
>- gfxPoint mPosition;
>+ gfxPoint mPosition; // character position of first glyph, includes baseline offset
>+ nsAutoArrayPtr<
>+ // valid if not a simple textrun and/or textPath
Put the comments above the variables so we don't have long lines.
How about storing mCharPositions in a property. It would not be a member variable here then so the memory used by nsSVGGlyphFrame would be that bit smaller in most cases.
You would have
gfxPoint * charPositions = new gfxPoint[
SetProperty(
positionDtorFunc would delete[] the charPositions data.
I picked d as there is no xy atom and d goes with paths.
Then if you needed individual character positions you could call
charPositions = static_
There are various examples of Set/GetProperty: nsBlockFrame shows some usage as does nsSVGUtils (although that uses pointers to classes rather than poin...
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#40 |
(In reply to comment #20)
> >- gfxPoint mPosition;
> >+ gfxPoint mPosition; // character position of first glyph, includes baseline offset
> >+ nsAutoArrayPtr<
> >+ // valid if not a simple textrun and/or textPath
>
Even better than a property would be not storing the values at all and simply calculating them on the fly. All you really need is the starting point of the first glyph (mPosition) as that may depend on where the previous frame left you and so would be O(N2). Everything else you should be able to calculate using GetParent where necessary. If we find it is unacceptably slow we can always add caching of the positions in later.
This article explains where we were and what we're trying to avoid :-)
http://
I think it should be possible to get rid of everything except the mPosition member variable (although getting rid of the whitespacehandling member belongs in another bug).
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#41 |
(In reply to comment #20)
Thanks for the comments Robert.
> Does inheritance of tspan values work? Have you tested that? Something like
> this contrived example...
>
> <text x="1 2 3 4 5" y="4 5 6 7">h<tspan dx="5
> 6">e<tspan>
Inherited positioning values still don't work. I wanted to support "simple" or direct lists first then address the implications of inheritance with another bug.
As I see it, the inheritance needs to be done in nsSVGTextFrame:
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#42 |
(In reply to comment #21)
> Even better than a property would be not storing the values at all and simply
> calculating them on the fly. All you really need is the starting point of the
> first glyph (mPosition) as that may depend on where the previous frame left you
> and so would be O(N2). Everything else you should be able to calculate using
> GetParent where necessary. If we find it is unacceptably slow we can always add
> caching of the positions in later.
The code is already slow.
mPosition only stores the first glyph position. No problem if everything is a
simple text run and no inherited x,y,dx,dy lists.
To support your contrived example in Comment #20,
> <text x="1 2 3 4 5" y="4 5 6 7">h<tspan dx="5
> 6">e<tspan>
even having mPosition for each fragment, you still have to determine if layout
calculations are required. That means going out to the current text element,
checking for inherited lists and then re-layout (calculate) each GlyphFragment
until you get back to the one you want the positioning for. In the example
above, determining the position of 'o' requires this action.
There would be a significant performance hit for painting the contents of a
text element using nsSVGGlyphFrame
fragment in a text element you would have to go back and check/recalculate all
the previous fragments. Resizing the browser window with a lot of text in the
document will become slower than it is. I can't see how SMIL animation of text
could ever be acceptable.
> This article explains where we were and what we're trying to avoid :-)
> http://
The article seems to point the finger mostly at XPCOM objects.
>
> I think it should be possible to get rid of everything except the mPosition
> member variable (although getting rid of the whitespacehandling member belongs
> in another bug).
>
Why even keep mPosition? or do UpdateGlyphPosi
mPositioningDirty ? Just recalculate everything on demand.
Seriously, it would be helpful to understand how decisions are made regarding
bloat vs performance. Are there general guidelines I can use or is it hit or
miss at every patch?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#43 |
(In reply to comment #23)
> even having mPosition for each fragment, you still have to determine if layout
> calculations are required. That means going out to the current text element,
> checking for inherited lists and then re-layout (calculate) each GlyphFragment
> until you get back to the one you want the positioning for. In the example
> above, determining the position of 'o' requires this action.
>
> There would be a significant performance hit for painting the contents of a
> text element using nsSVGGlyphFrame
> fragment in a text element you would have to go back and check/recalculate all
> the previous fragments. Resizing the browser window with a lot of text in the
> document will become slower than it is. I can't see how SMIL animation of text
> could ever be acceptable.
It's performance vs memory. We can always put in caching afterwards.
> The article seems to point the finger mostly at XPCOM objects.
But also partly at frames storing things that content has.
>
> Why even keep mPosition? or do UpdateGlyphPosi
> mPositioningDirty ? Just recalculate everything on demand.
Because you can only calculate mPosition if you know where the previous fragment ended and as frames are connected via a singly linked list there is no GetPreviousFrame function. All you could do is call GetParent then iterate through its children which would be order N^2.
>
> Seriously, it would be helpful to understand how decisions are made regarding
> bloat vs performance. Are there general guidelines I can use or is it hit or
> miss at every patch?
>
What I've picked over the patches I've submitted and review comments I've received is this...
Go for lack of bloat first and then add performance later if necessary in a separate patch. Order N performance is acceptable, order N^2 generally not.
It's easier to have a discussion on speeding up performance of a feature once that feature exists rather than as that feature is being developed.
In the FX3 timeframe we've removed most of the caching that happened in glyph frames. We used to cache all the characters for instance after we'd whitespace compressed them.
One additional argument is that when Tor implemented textPath, he didn't cache the glyph positions and he's in charge ;-)
You've chosen something that is quite complicated for a first patch. I'm glad you are persevering.
Best regards
Robert
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#44 |
See also bug 282579 comment 9 which suggested caching positions for textPath and Tor's reply bug 282579 comment 10
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#45 |
My general feeling is to go for the simplest implementation first, and revisit if needed for performance or footprint reasons. At least to my interpretation, "simplest" should be within reason - avoiding gratuitous performance bottlenecks or data bloat.
A pointer for storing an array which is only allocated when needed (multiple x/y/dx/dy) seems under this threshold and could go in if it simplifies the code, which from Ken's description it seems to do. Individual character positions would seem to be the exceptional case for most SVG content, so it storing cached values won't affect most users.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#46 |
Ken, can you fix the other issues in comment 20 i.e. those other than inheritance support and caching removal? Then set the review flag on the attachment for me as a reviewer.
Please raise another mozilla bug for inheritance of x, y, dx, dy so we can track that we still need to do that.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#47 |
Created an attachment (id=277664)
x.y.dx.dy lists for SVG tspan and text elements
(In reply to comment #27)
Robert,
Fixed all the other issues and removed mBaselineOffset from nsSVGGlyphFrame and calculate it on demand. This has a side effect of fixing a bug relating to dominant-baseline.
<text dominant-
<tspan>
<tspan dominant-
</text>
the old code ignores the nested (hanging) baseline.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#48 |
Ken, you need to select ? from the review dropdown and put my email address in as the requestee.
There is good information here http://
Once you get a review + you would repeat the process for super-review, for which I would suggest you chose Tor.
Best regards
Robert
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#49 |
(From update of attachment 277664)
>+static void
>+GetListValue(
Make this return the value you want rather than taking a gfxFloat *val argument. It will make the calling code simpler.
> static void
>-GetSingleValu
>- nsIDOMSVGLengthList *list, float *val)
>+GetSingleValu
Again I think it would be simpler just to return the result you want rather than passing a pointer argument, even though that's what the current code does ;-)
> already_
> nsSVGTextPathFr
> {
>- nsIFrame *path = GetPathFrame();
>- if (!path)
>- return nsnull;
>+ return GetFlattenedPat
I think this should be implemented as:
nsIFrame *path = path = GetPathFrame();
if (!path)
return nsnull;
return GetFlattenedPat
>+}
>+
>+already_
>+nsSVGTextPath
>+{
>+ if (!path) {
>+ path = GetPathFrame();
>+ if (!path)
>+ return nsnull;
>+ }
This change is then not necessary and can be removed.
>+gfxFloat
>+nsSVGTextPath
Nit: Could you put the { on a new line please?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#50 |
(In reply to comment #29)
Thanks, Robert. Wasn't sure what to do there.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#51 |
(In reply to comment #30)
> (From update of attachment 277664 [details])
> >+static void
> >+GetListValue(
>
> Make this return the value you want rather than taking a gfxFloat *val
> argument. It will make the calling code simpler.
>
Should be ok since the calling code checks the list length (as a shortcut) before calling the function.
> > static void
> >-GetSingleValu
> >- nsIDOMSVGLengthList *list, float *val)
> >+GetSingleValu
>
> Again I think it would be simpler just to return the result you want rather
> than passing a pointer argument, even though that's what the current code does
> ;-)
In this case the calling code takes advantage of the fact that *val is not changed if there is no list or an empty list.
What value should the function return in these cases? How will the calling code know that the return value should be ignored? Either the calling code has to check before making the call (like above) or pass in a default value and return that.
>
> > already_
> > nsSVGTextPathFr
> > {
> >- nsIFrame *path = GetPathFrame();
> >- if (!path)
> >- return nsnull;
> >+ return GetFlattenedPat
>
> I think this should be implemented as:
>
> nsIFrame *path = path = GetPathFrame();
> if (!path)
> return nsnull;
> return GetFlattenedPat
>
> >+}
> >+
> >+already_
> >+nsSVGTextPath
> >+{
> >+ if (!path) {
> >+ path = GetPathFrame();
> >+ if (!path)
> >+ return nsnull;
> >+ }
>
> This change is then not necessary and can be removed.
Shouldn't there at least be
if (!path)
return nsnull;
In case the private method is called with path == nsnull ?
At present, GetFlattenedPath is called in 3 places
1. nsSVGGlyphFrame
textPath-
2. nsSVGTextPathFr
GetFlatten
3. nsSVGTextPathFr
GetFlatten
If the "(!path) etc" is removed, then case#2 needs to change to call the public method or do GetPathFrame() and check before calling.
Case#3 would be ok since that code would not be called if pathFrame == nsnull anyway.
>
> >+gfxFloat
> >+nsSVGTextPath
>
> Nit: Could you put the { on a new line please?
>
No problem.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#52 |
(In reply to comment #32)
> (In reply to comment #30)
> > (From update of attachment 277664 [details] [details])
> > >+static void
> > >+GetListValue(
> >
> > Make this return the value you want rather than taking a gfxFloat *val
> > argument. It will make the calling code simpler.
> >
>
> Should be ok since the calling code checks the list length (as a shortcut)
> before calling the function.
I wouldn't bother with the shortcut check. This code is only called when things change; either once on load or if you do something in DOM so I think simplicity is better.
nsSVGGlyphFrame
+ gfxFloat dx = 0.0, dy = 0.0;
+ if (dxcount)
+ GetListValue(
+ x += dx;
would become
+ x += GetListValue(
for instance
>
> > > static void
> > >-GetSingleValu
> > >- nsIDOMSVGLengthList *list, float *val)
> > >+GetSingleValu
> >
> > Again I think it would be simpler just to return the result you want rather
> > than passing a pointer argument, even though that's what the current code does
> > ;-)
>
> In this case the calling code takes advantage of the fact that *val is not
> changed if there is no list or an empty list.
OK, leave it as you have it then.
> > >+already_
> > >+nsSVGTextPath
> > >+{
> > >+ if (!path) {
> > >+ path = GetPathFrame();
> > >+ if (!path)
> > >+ return nsnull;
> > >+ }
> >
> > This change is then not necessary and can be removed.
>
> Shouldn't there at least be
>
> if (!path)
> return nsnull;
How about
NS_
instead? Since this is a private function, it's reasonable for it to assume its callers know not to call it with nsnull.
>
> In case the private method is called with path == nsnull ?
>
>
> At present, GetFlattenedPath is called in 3 places
>
> 1. nsSVGGlyphFrame
> textPath-
>
> 2. nsSVGTextPathFr
> GetFlattenedPat
>
> 3. nsSVGTextPathFr
> GetFlattenedPat
>
> If the "(!path) etc" is removed, then case#2 needs to change to call the public
> method or do GetPathFrame() and check before calling.
>
Calling the public method seems best.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#53 |
(From update of attachment 277664)
clear invalid flag
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#54 |
(In reply to comment #33)
> > Should be ok since the calling code checks the list length (as a shortcut)
> > before calling the function.
>
> I wouldn't bother with the shortcut check. This code is only called when things
> change; either once on load or if you do something in DOM so I think simplicity
> is better.
Without the shortcut check there is no way to know if the return value is valid or not (similar to discussion for GetSingleValue() in nsSVGTextFrame.cpp)
I take your point about making it simpler. I made an SVGLengthListHelper class to hide the list length checking etc.
> > > >+already_
> > > >+nsSVGTextPath
> > > >+{
> > > >+ if (!path) {
> > > >+ path = GetPathFrame();
> > > >+ if (!path)
> > > >+ return nsnull;
> > > >+ }
> > >
> > > This change is then not necessary and can be removed.
> >
> > Shouldn't there at least be
> >
> > if (!path)
> > return nsnull;
>
> How about
>
> NS_ASSERTION(path, NS_ERROR_
>
> instead? Since this is a private function, it's reasonable for it to assume its
> callers know not to call it with nsnull.
Sounds good.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#55 |
Created an attachment (id=278721)
x.y.dx.dy lists for SVG tspan and text elements
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#56 |
(From update of attachment 278721)
Apologies for the delay. Somehow I got it into my head that I'd already commented on this.
> nsSVGGlyphFrame
> const nsString &aText,
>
>+ nsSVGTextPathFrame *textPath = FindTextPathPar
>+ if (!textPath) { // normal x,y,dx,dy placement
Get rid of the ! in the if and reverse the order of the following parts to suit. The fewer !s the better.
>+class SVGLengthListHelper
>+{
>+ nsCOMPtr<
>+ PRUint32 mCount;
>+public:
>+ SVGLengthListHe
I don't think you can use already_AddRefed as a function argument. AFAIK that construct is only for return values. You want to make the argument a raw pointer and probably use already_AddRefed when you call it.
>+SVGLengthList
>+{
>+ mList = list;
>+ mCount = 0;
Use constructor style initialisation for member variables.
: mList(list), mCount(0)
>+void
>+nsSVGGlyphFra
>+ gfxPoint &ctp)
>+{
>+ if (!textPath) {
Again, please get rid of the ! and swap the order of the clauses below so the logic still works.
>
>+gfxFloat
>+nsSVGTextPath
Please put the { on a new line
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#57 |
(In reply to comment #37)
> >+class SVGLengthListHelper
> >+{
> >+ nsCOMPtr<
> >+ PRUint32 mCount;
> >+public:
> >+ SVGLengthListHe
>
> I don't think you can use already_AddRefed as a function argument. AFAIK that
> construct is only for return values. You want to make the argument a raw
> pointer and probably use already_AddRefed when you call it.
Yes, on further research (bug #172030), |already_
Also (bug #178187), using the raw pointer result of already_
I struggled with this for a while because I wanted the ownership to be inside the helper class. Rather than extract and pass the raw pointer it might be clearer to keep the ownership outside of the class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#58 |
Created an attachment (id=280428)
x.y.dx.dy lists for SVG tspan and text elements
Fixes for Comment #37
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#59 |
(From update of attachment 280428)
>+ if (((xlist.count() <= 1) && (ylist.count() <= 1) &&
>+ (dxlist.count() <= 1) && (dylist.count() <= 1))
>+ || (strLength == 1)) {
Nit: Usual convention is to have || at the end of the previous line.
r=longsonr
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#60 |
Robert,
Thanks for the +. I'm not sure what to do next. Do I need to submit another patch and request Tor for a super review ? Or do I request Tor on the existing patch ?
Thanks,
Ken
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#61 |
up to you really. you could just ask tor for sr with this and if he wants any changes fix it as part of that or if not just go with this patch for check in.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#62 |
Created an attachment (id=282058)
x.y.dx.dy lists for SVG tspan and text elements
Fixed "||" nit
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#63 |
(From update of attachment 282058)
It seems that SetCharPosition is only called from SetGlyphPosition. If that is the case and you don't have future plans for other things to call it, it seems that the code should be in the latter.
SetCharPosition allocates the mCharPositions array for a textPath even if there aren't adjustments needed.
GetBaselineOffset - do you mean to only use the dominant-baseline from the outer <text> container, and not any nested text content elements?
GetStartOffset - you can get the start offset more directly, ie: static_
GetPathScale likewise could be simplified if nsSVGTextPathFrame was also made a friend of nsSVGPathElement.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#64 |
(In reply to comment #44)
> GetStartOffset - you can get the start offset more directly, ie:
> static_
> You will need to split the class definition of nsSVGTextPathEl
> seperate file for that.
That should be GetAnimValue rather than GetBaseValue as startOffset is animatable.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#65 |
(In reply to comment #44)
> It seems that SetCharPosition is only called from SetGlyphPosition. If that is
> the case and you don't have future plans for other things to call it, it seems
> that the code should be in the latter.
OK
> SetCharPosition allocates the mCharPositions array for a textPath even if there
> aren't adjustments needed.
OK, mCharPosions only allocated when adjustments are needed.
> GetBaselineOffset - do you mean to only use the dominant-baseline from the
> outer <text> container, and not any nested text content elements?
It is meant to work like the latter - use the nearest parent text content element's dominant-baseline.
The loop at the beginning searches back up towards the text parent only while
dominant-
> GetStartOffset - you can get the start offset more directly, ie:
> static_
> You will need to split the class definition of nsSVGTextPathEl
> seperate file for that.
OK
> GetPathScale likewise could be simplified if nsSVGTextPathFrame was also made a
> friend of nsSVGPathElement.
>
OK
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#66 |
Created an attachment (id=284402)
x.y.dx.dy lists for SVG tspan and text elements
New header file in seperate attachment
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#67 |
Created an attachment (id=284403)
New file - nsSVGTextPathEl
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#68 |
A comment on attachment (id=284402)
Lately, I have been unable to update my source tree. I tracked it down to a line in client.mk. (included in patch (id=284402))
CONFIG_STATUS_DEPS := \
$(TOPSRCDIR)
$(TOPSRCDIR)
$(wildcard $(TOPSRCDIR)
$(wildcard $(TOPSRCDIR)
$(wildcard $(TOPSRCDIR)
$(wildcard $(TOPSRCDIR)
- $(wildcard $(addsuffix confvars.
+ $(wildcard $(addsuffix confvars.
$(NULL)
Note that $(wildcard */) depends on the current directory.
This variable is ifdefed out for the first checkout.
When updating the source tree, this variable is expanded from $(TOPSRCDIR), then
the following line is executed in checkout:
@cd $(ROOTDIR) && $(MAKE) -f mozilla/client.mk real_checkout
When making real_checkout it is evaluated from $(ROOTDIR). On my computer, make failed while trying to open a hidden system directory in the rootdir when evaluating $(wildcard */). The only confvars.h files I could find are in subdirs of $(TOPSRCDIR) so I changed the line to get it to not fail. No apparrent problems with build.
A bug ?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#69 |
(In reply to comment #48)
> Created an attachment (id=284403) [details]
> New file - nsSVGTextPathEl
>
While you don't have write access to cvs you should use the cvsdo perl script to add new files to your local repository. You can then submit a single patch which will include the new file. See http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#70 |
(In reply to comment #49)
> - $(wildcard $(addsuffix confvars.
> + $(wildcard $(addsuffix confvars.
My client.mk looks like the - line and bonsai agrees. http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#71 |
Created an attachment (id=284581)
x.y.dx.dy lists for SVG tspan and text elements
Includes new file nsSVGTextPathEl
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#72 |
(In reply to comment #52)
Meant to set superreview for tor but hit enter at wrong time.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#73 |
I've used part of this bug to fix bug 406312
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#74 |
I've checked in the fix for bug 406312 so perhaps 25% of this patch is no longer required.
Also the changes to nsSVGTextContai
Just to let you know what's going on, this is new functionality and I'm afraid it missed the cutoff time to land for firefox 3.0. An updated patch could still make firefox 3.1
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#75 |
Visiting to report/confirm - see Wikimedia bug report
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
worms_x (wormsxulla) wrote : | #76 |
I'm using Inkscape 0.46+devel r20840, built Mar 6 2009 on Windows XP
After manual kerning of a text object, if you render the file in browsers (I tried Opera, Seamonkey and Firefox recent versions), the text appears as not kerned.
See the attachment, where the text on top has no manual kerning, and the bottom text has, in Inkscape.
See also the screenshot I'll attach of the rendering.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
worms_x (wormsxulla) wrote : | #77 |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
worms_x (wormsxulla) wrote : | #78 |
- Comparison of Inkscape rendering / browser rendering Edit (92.7 KiB, image/jpeg)
Attaching the screenshot of the rendering (I didn't bother to convert to path)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
jazzynico (jazzynico) wrote : | #79 |
Confirmed on Ubuntu 8.10, build 20941, with Firefox 3.0.7 and Eye of Gnome.
But it may be due to a bad browser support (none is 100% SVG compliant). dx attribute, in the tspan element, is not supported by most svg readers and browsers.
We should test on beta (alpha?) releases of opera and firefox. Or another reliable SVG reader?
Changed in inkscape: | |
status: | New → Confirmed |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
worms_x (wormsxulla) wrote : | #80 |
I have tested in a recent "Minefield" aka Firefox development trunk build, and it renders both "Text" with the same length.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090225 Minefield/3.2a1pre
I'll ask in the mozilla SVG channel to test with an even more recent build.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
worms_x (wormsxulla) wrote : | #81 |
It appears to be a browser bug indeed:
Opera 10a1 shows the kerning correctly (I tested on 9.6x earlier, it was incorrect)
Safari 4b1 shows the kerning correctly
Minefield (Firefox trunk) does not, this is bug:
https:/
and people on Mozilla now know about it (more).
So it's not an Inkscape bug, after all :-)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
jazzynico (jazzynico) wrote : | #82 |
Thanks for your tests!
Good to see new browsers are improving (uhh, except one...)!
Closed invalid (not an Inkscape bug).
Changed in inkscape: | |
status: | Confirmed → Invalid |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#83 |
Robert Longson: could you find some time for rewriting your patch againts current trunk? Would be nice to see your patch in Gecko 1.9.2 together will all other SVG improvements.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#84 |
I meant Ken Stacey of course, sorry.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#85 |
Robert, just so you know, we're planning some changes to the SVG text code that would impact this quite heavily ... to be precise, rewriting it to use hidden nsBlockFrame/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#86 |
I'm hoping to reuse the existing textpath positioning code so hopefully I won't make that rewrite any worse. I'll be doing this one small step at a time too.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#87 |
Created an attachment (id=389307)
update to tip and add support for rotate
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#88 |
Created an attachment (id=389356)
Screenshot (with attachment 389307)
(In reply to comment #60)
> Created an attachment (id=389307) [details]
> update to tip and add support for rotate
This patch regresses the <tspan dy> in a <textPath> testcase :-(.
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#89 |
Created an attachment (id=389392)
updated patch with reftest
Fixes reported issue.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#90 |
+GetNumberOfNum
+GetLengthListV
+GetNumberListV
Use a* for parameters
+ NS_IMETHOD_(void) SetGlyphPositio
Prefer gfxPoint* here for the in-out parameter.
+ // have we run off the end of the path?
+ if (pos.x + halfAdvance > length)
+ break;
Is it possible for us to go past the end of the path but then negative dx pulls us back into the path?
You're not handling 'rotate' for text on a path?
Can't GetDx/GetDy/
We really need some love for nsIDOMSVGLength
Why are you checking for the presence of the attributes in GetDx/GetDy/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#91 |
Created an attachment (id=390669)
address review comments
(In reply to comment #63)
> +GetNumberOfNum
> +GetLengthListV
> +GetNumberListV
>
> Use a* for parameters
Done.
>
> + NS_IMETHOD_(void) SetGlyphPositio
> aForceGlobalTra
>
> Prefer gfxPoint* here for the in-out parameter.
Done.
>
> + // have we run off the end of the path?
> + if (pos.x + halfAdvance > length)
> + break;
>
> Is it possible for us to go past the end of the path but then negative dx pulls
> us back into the path?
Fixed.
>
> You're not handling 'rotate' for text on a path?
Fixed.
>
> Can't GetDx/GetDy/
I'm going to punt that to whatever fix addresses nsIDOMSVGLength
>
> We really need some love for nsIDOMSVGLength
> have optimized storage and a COM-less internal interface, but I guess that can
> wait.
Indeed.
>
> Why are you checking for the presence of the attributes in
> GetDx/GetDy/
> that even if there's no attribute, there's still an animated value?
Fixed.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#92 |
(From update of attachment 390669)
(In reply to comment #64)
> (In reply to comment #63)
> > + // have we run off the end of the path?
> > + if (pos.x + halfAdvance > length)
> > + break;
> >
> > Is it possible for us to go past the end of the path but then negative dx
> > pulls us back into the path?
>
> Fixed.
Can you add a test for this? Generally I think it's good to create regression tests even for the bugs you find during development before checking in.
> > You're not handling 'rotate' for text on a path?
>
> Fixed.
You don't seem to have any tests for rotate? We need tests with and without a path.
> > Can't GetDx/GetDy/
>
> I'm going to punt that to whatever fix addresses
> nsIDOMSVGLength
OK
r+ assuming those tests are added.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#93 |
*** Bug 463990 has been marked as a duplicate of this bug. ***
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#94 |
*** Bug 517421 has been marked as a duplicate of this bug. ***
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#95 |
Created an attachment (id=405745)
update to tip and add rotate test
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#96 |
landed then backed out due to mac test orange. The test looks the same as the reference to me so I don't know what's wrong at the moment.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#97 |
*** Bug 521637 has been marked as a duplicate of this bug. ***
tags: | removed: bounding box kerning size |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#98 |
These tests are from the SVG 1.2 Tiny test suite, but they should also work in a 1.1 Full implementation after this bug is fixed, I think:
http://
http://
http://
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
|
#99 |
*** Bug 537062 has been marked as a duplicate of this bug. ***
Created an attachment (id=218161)
Test case demonstration of the bug
Shows the problem and the correct behaviour.