RE: baseline problem

Hi, Allen-

I'm not sure that is pertinent. Of course, you could make a font with
ascenders twice as high as capital letters (for whatever reson... maybe it's
a funky now-Western font or something, or it has accent marks), but since
'baseline-shift' can take units in percentages, it should be able to cope in
the way that Dario wants 'alignment-baseline="top"' to do. That is, if I
understand what Dario is trying to do... maybe they want to make it so that
all the letters are aligned by their top edge --along the height of the
tallest ascender-- instead of their bottom (sans descenders)? If you wanted
to do that, you could make your own custom font.

I made a simple font to show what I mean... even with an uncommonly tall
ascender, the results are still pretty acceptable when you use
'baseline-shift:-100%;'.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" >
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

<defs >
<font horiz-adv-x="1038" ><font-face
    font-family="TallAscender"
    units-per-em="2048"
    panose-1="2 11 6 3 3 8 4 2 2 4"
    ascent="1956"
    descent="-483"
    alphabetic="0" />
<missing-glyph horiz-adv-x="1229"
d="M102 -362V1444H1126V-362H102ZM217 -248H1012V1329H217V-248Z" />
<glyph unicode=" " glyph-name="space" horiz-adv-x="651" />
<glyph unicode="A" glyph-name="A" horiz-adv-x="1401" d="M700 1294L426
551H975L700 1294ZM586 1493H815L1384 0H1174L1038 383H365L229 0H16L586 1493Z"
/>
<glyph unicode="f" glyph-name="f" horiz-adv-x="721" d="M760 1956 V1803 H584
Q485 1803 447 1763 T408 1519 V1120 H711 V977 H408 V0 H223 V977 H47 V1120
H223 V1598 Q223 1785 310 1870 T586 1956 H760 Z" />
<glyph unicode="t" glyph-name="t" horiz-adv-x="803" d="M375
1438V1120H754V977H375V369Q375 232 412 193T565 154H754V0H565Q352 0 271 79T190
369V977H55V1120H190V1438H375Z" />
</font>
</defs>
   <line x1='5' y1='100' x2='695' y2='100' style='stroke:red;
stroke-width:1; fill:none; '/>
   <line x1='5' y1='120' x2='695' y2='120' style='stroke:red;
stroke-width:1; fill:none; '/>
   <text x='200' y='100' style='fill:black; text-anchor:middle;
font-size:16pt;'>
      <tspan style='baseline-shift:baseline;'>
         Aft
      </tspan>
      <tspan style='baseline-shift:-100%;'>
         Aft
      </tspan>
   </text>
   <text x='300' y='100' style='font-family:TallAscender; fill:black;
text-anchor:middle; font-size:16pt;'>
      <tspan style='baseline-shift:baseline;'>
         Aft
      </tspan>
      <tspan style='baseline-shift:-100%;'>
         Aft
      </tspan>
   </text>
</svg>


-Alan


Allen Razdow wrote:
>
>
> I think it's a question of knowing how much to shift, which may vary by
> font, whether the particular string has ascenders, etc.
>
> -Allen
>
> -----Original Message-----
> From: Doug Schepers [mailto:doug@schepers.cc]
> Sent: Sunday, May 04, 2003 8:53 PM
> To: dario
> Cc: www-svg@w3.org
> Subject: RE: baseline problem
>
>
> Why not just use 'baseline-shift'? Am I missing something here?
>
> <svg>
>    <line x1='5' y1='100' x2='695' y2='100' style='stroke:red;
> stroke-width:1; fill:none; '/>
>    <text x='300' y='100' style='fill:black; text-anchor:middle;
> font-size:16px;'>
>       <tspan style='baseline-shift:baseline;'>
>          baseline
>       </tspan>
>       <tspan style='baseline-shift:sub;'>
>          sub
>       </tspan>
>       <tspan style='baseline-shift:super;'>
>          super
>       </tspan>
>       <tspan style='baseline-shift:-33%;'>
>          percentage (-33%)
>       </tspan>
>       <tspan style='baseline-shift:3px;'>
>          length (3px)
>       </tspan>
>       <tspan style='baseline-shift:-80%;'>
>          Baseline-Shift (-80%)
>       </tspan>
>    </text>
> </svg>
>
>
> Hope that helps-
> -Doug
>
>
> Chris Lilley wrote:
> >
> >
> > On Sunday, May 4, 2003, 10:49:09 PM, dario wrote:
> >
> > d> OK, what can i do to draw text under specified line
> >
> > d> so, there is line at 100 pixels from the top, i'd like text
> > drawn just under
> > d> it. is it possible?
> >
> > I understand the use case and no, not directly. You need to know what
> > the text size is and then offset that much by yourself.
> >
> > <text x="100" y="62" font-size="12" text-anchor="middle">blah</text>
> >
> > --
> >  Chris                            mailto:chris@w3.org
> >

Received on Monday, 5 May 2003 00:45:40 UTC