SVG text positioned incorrectly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mozilla Firefox |
Fix Released
|
Wishlist
|
|||
firefox (Ubuntu) |
Fix Released
|
Low
|
Unassigned |
Bug Description
Binary package hint: firefox
Description:
In Firefox versions below 3.7, SVG text is not displayed properly due to restrictions in ways that Firefox supports text placement. If you go to http://
Status:
This has been fixed upstream in Firefox 3.7 as of 03/30/10 (https:/
Description: Ubuntu 10.04 LTS
Release: 10.04
firefox:
Installiert: 3.6.3+nobinonly
Kandidat: 3.6.3+nobinonly
Versions-Tabelle:
*** 3.6.3+nobinonly
500 http://
100 /var/lib/
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: firefox 3.6.3+nobinonly
ProcVersionSign
Uname: Linux 2.6.32-21-generic i686
Architecture: i386
Date: Sun May 2 01:18:09 2010
FirefoxPackages:
firefox 3.6.3+nobinonly
firefox-
firefox-branding 3.6.3+nobinonly
abroswer N/A
abrowser-branding N/A
ProcEnviron:
LANG=de_DE.UTF-8
SHELL=/bin/bash
SourcePackage: firefox
In Mozilla Bugzilla #388547, Mike-svgmaker (mike-svgmaker) wrote : | #1 |
In Mozilla Bugzilla #388547, Mike-svgmaker (mike-svgmaker) wrote : | #2 |
patch was implemented by Ken Stacey (<email address hidden>)
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #3 |
This is a duplicate of bug 311986.
If you are looking for reviews you need to select a reviewer.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #4 |
(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.
In Mozilla Bugzilla #388547, Mike-svgmaker (mike-svgmaker) wrote : | #5 |
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
In Mozilla Bugzilla #388547, Tor-acm (tor-acm) wrote : | #6 |
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?
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #7 |
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.
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #8 |
(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:
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #9 |
(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 ?
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #10 |
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.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #11 |
(In reply to comment #8)
> Not sure what you mean. Which allocations ?
+ mCharPositions = new gfxPoint[
for instance
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #12 |
Created an attachment (id=275600)
testcase
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #13 |
Created an attachment (id=275601)
expected rendering for testcase
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #14 |
*** Bug 311986 has been marked as a duplicate of this bug. ***
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #15 |
(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
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #16 |
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-
?
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #17 |
Created an attachment (id=276088)
Enhancement that implements x.y.dx.dy lists for SVG tspan and text elements
Updated patch addressing recent comments
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #18 |
Created an attachment (id=276089)
layout examples of x,y,dx,dy positioning + textPath
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #19 |
Created an attachment (id=276090)
rendering for layout example
screen capture of layout example (id=276089) using patch (id=276088)
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #20 |
(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...
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #21 |
(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).
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #22 |
(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:
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #23 |
(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?
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #24 |
(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
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #25 |
See also bug 282579 comment 9 which suggested caching positions for textPath and Tor's reply bug 282579 comment 10
In Mozilla Bugzilla #388547, Tor-acm (tor-acm) wrote : | #26 |
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.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #27 |
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.
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #28 |
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.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #29 |
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
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #30 |
(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?
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #31 |
(In reply to comment #29)
Thanks, Robert. Wasn't sure what to do there.
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #32 |
(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.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #33 |
(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.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #34 |
(From update of attachment 277664)
clear invalid flag
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #35 |
(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.
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #36 |
Created an attachment (id=278721)
x.y.dx.dy lists for SVG tspan and text elements
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #37 |
(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
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #38 |
(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.
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #39 |
Created an attachment (id=280428)
x.y.dx.dy lists for SVG tspan and text elements
Fixes for Comment #37
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #40 |
(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
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #41 |
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
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #42 |
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.
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #43 |
Created an attachment (id=282058)
x.y.dx.dy lists for SVG tspan and text elements
Fixed "||" nit
In Mozilla Bugzilla #388547, Tor-acm (tor-acm) wrote : | #44 |
(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.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #45 |
(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.
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #46 |
(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
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #47 |
Created an attachment (id=284402)
x.y.dx.dy lists for SVG tspan and text elements
New header file in seperate attachment
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #48 |
Created an attachment (id=284403)
New file - nsSVGTextPathEl
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #49 |
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 ?
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #50 |
(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://
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #51 |
(In reply to comment #49)
> - $(wildcard $(addsuffix confvars.
> + $(wildcard $(addsuffix confvars.
My client.mk looks like the - line and bonsai agrees. http://
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #52 |
Created an attachment (id=284581)
x.y.dx.dy lists for SVG tspan and text elements
Includes new file nsSVGTextPathEl
In Mozilla Bugzilla #388547, Ken-svgmaker (ken-svgmaker) wrote : | #53 |
(In reply to comment #52)
Meant to set superreview for tor but hit enter at wrong time.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #54 |
I've used part of this bug to fix bug 406312
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #55 |
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
In Mozilla Bugzilla #388547, Rafał Miłecki (zajec5) wrote : | #56 |
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.
In Mozilla Bugzilla #388547, Rafał Miłecki (zajec5) wrote : | #57 |
I meant Ken Stacey of course, sorry.
In Mozilla Bugzilla #388547, Roc-ocallahan (roc-ocallahan) wrote : | #58 |
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/
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #59 |
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.
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #60 |
Created an attachment (id=389307)
update to tip and add support for rotate
In Mozilla Bugzilla #388547, Kurosawa Takeshi (takenspc) wrote : | #61 |
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://
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #62 |
Created an attachment (id=389392)
updated patch with reftest
Fixes reported issue.
In Mozilla Bugzilla #388547, Roc-ocallahan (roc-ocallahan) wrote : | #63 |
+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/
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #64 |
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.
In Mozilla Bugzilla #388547, Roc-ocallahan (roc-ocallahan) wrote : | #65 |
(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.
In Mozilla Bugzilla #388547, Kurosawa Takeshi (takenspc) wrote : | #66 |
*** Bug 463990 has been marked as a duplicate of this bug. ***
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #67 |
Created an attachment (id=405745)
update to tip and add rotate test
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #68 |
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.
In Mozilla Bugzilla #388547, Jonathan Watt (jwatt) wrote : | #69 |
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://
In Mozilla Bugzilla #388547, Jonathan Watt (jwatt) wrote : | #70 |
*** Bug 537062 has been marked as a duplicate of this bug. ***
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #71 |
Created an attachment (id=435849)
update to tip and fix typo
In Mozilla Bugzilla #388547, longsonr (longsonr) wrote : | #72 |
The tests in comment 69 partially work. Some require SVG fonts and one is affected by a cairo bug causing rotation of characters not to work (already known to bugzilla).
pushed http://
pushed http://
Also http://
Rico Zienke (zonken) wrote : SVG fonts rendered wrong | #73 |
Binary package hint: firefox
Hi,
If you go to site http://
If you have a deeper look at the words, you see that the words are overlapping here.
I have the impression that the position of letters will not be consiedered, like described in SVG.
If you open the page in opera 10.10, you see how I would expect it also in firefox (without the special character issue).
Inkscape also displays that file like I expected.
Is this a bug or am I wrong?
Regards Rico
Description: Ubuntu 10.04 LTS
Release: 10.04
firefox:
Installiert: 3.6.3+nobinonly
Kandidat: 3.6.3+nobinonly
Versions-Tabelle:
*** 3.6.3+nobinonly
500 http://
100 /var/lib/
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: firefox 3.6.3+nobinonly
ProcVersionSign
Uname: Linux 2.6.32-21-generic i686
Architecture: i386
Date: Sun May 2 01:18:09 2010
FirefoxPackages:
firefox 3.6.3+nobinonly
firefox-
firefox-branding 3.6.3+nobinonly
abroswer N/A
abrowser-branding N/A
ProcEnviron:
LANG=de_DE.UTF-8
SHELL=/bin/bash
SourcePackage: firefox
Rico Zienke (zonken) wrote : | #74 |
- Dependencies.txt Edit (3.4 KiB, text/plain; charset="utf-8")
- ExtensionSummary.txt Edit (637 bytes, text/plain; charset="utf-8")
- profile_default_pluginreg.dat.txt Edit (525 bytes, text/plain; charset="utf-8")
- profiles.ini.txt Edit (94 bytes, text/plain; charset="utf-8")
Draycen DeCator (ddecator) wrote : | #75 |
It appears fine on my system. Could you please attach a screenshot of the issue for us?
Changed in firefox (Ubuntu): | |
status: | New → Incomplete |
Rico Zienke (zonken) wrote : | #76 |
Rico Zienke (zonken) wrote : | #77 |
Rico Zienke (zonken) wrote : | #78 |
Changed in firefox (Ubuntu): | |
status: | Incomplete → New |
Draycen DeCator (ddecator) wrote : | #79 |
Confirmed on my system that this happens with Firefox 3.6.x, but it does not appear to happen with the current build of Firefox 3.7. Setting to Confirmed and I will look upstream to see if there are any reports about this.
Changed in firefox (Ubuntu): | |
status: | New → Confirmed |
summary: |
- SVG fonts rendered wrong + SVG text positioned incorrectly |
description: | updated |
Draycen DeCator (ddecator) wrote : | #80 |
After discussing this with some of the upstream developers, we determined that this bug describes the Mozilla bug that is now linked to this report. The fix has indeed been implemented into Firefox 3.7 as of 03/30/10. Since we know what the bug is, and since it has already been fixed upstream, I am marking this bug as Triaged with a Low importance. Once a build of Firefox with the fix for this bug has been released for Ubuntu, we will change the status accordingly. Thanks again for reporting this, and please continue to let us know about any other bugs that you encounter!
Changed in firefox (Ubuntu): | |
importance: | Undecided → Low |
status: | Confirmed → Triaged |
Changed in firefox: | |
status: | Unknown → Fix Released |
Changed in firefox: | |
importance: | Unknown → Wishlist |
In Mozilla Bugzilla #388547, Eshepherd (eshepherd) wrote : | #81 |
There's a note about this change now here:
https:/
Given that our SVG documentation is currently a work in progress, the text and tspan elements aren't yet documented at all, but when they are this will be included there.
Micah Gersten (micahg) wrote : | #82 |
This should be in natty in later (currently Firefox 6). Please report any other issues you may find.
Changed in firefox (Ubuntu): | |
status: | Triaged → Fix Released |
Created an attachment (id=272746)
Enhancement that implements x.y.dx.dy lists for SVG tspan and text elements