Re: Wanted: Help centering Text
Robert Longson <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.svg |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
On Sep 2, 5:07 am, "Siegfried Heintze" <[email protected]> wrote: > Woops! sorry. I did not read everything. I don't understand this > alignment-baseline. Athttp://www.w3.org/TR/SVG/text.html#AlignmentBaselinePropertyI read that it > does not appy <text but only <tspan. That does not seem logical. > > So I have a rectangle whose upper right corner is at 0,0 and width=12.5 and > height=12.5. The following code does not center it horizontally or > vertically: > > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="middle" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="central" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="before-edge" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="text-before-edge" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="after-edge" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="text-after-edge" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="ideographic" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="alphabetic" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="hanging" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="central" ></tspan></text> > <text x="6.25" y="6.25" text-anchor="middle" class="common-segoe"><tspan > alignment-baseline="mathematical" ></tspan></text> > > Could it be a problem with custom font I'm using? OK, I tried the default > font and removed the class="common-segoe" and that did not help with the > vertical centering. It looks like the alignment-baseline has no affect! Is > this a bug? But the horizontal alignment looks good. So maybe there is a > problem with the custom font I am using? Uggghh... I'm not sure how to fix > that. > Thanks! > Siegfried My mistake it's dominant-baseline we partially support, not alignment- baseline :-). central and middle do the same thing at the moment which is presumably incorrect but one of those is the one you want. The only others that do anything are hanging (treated as text-before-edge) text-before-edge and text-after-edge. The others you are trying e.g. mathematical, ideographic are not implemented and do nothing. Best regards Robert