You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Petar <op...@yahoo.com> on 2003/12/10 01:55:27 UTC

Extra bold font attribute

Hello,

I am trying to get Batik to render the following SVG:

<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="500">
<g font-family="Rockwell" font-size="30" font-weight="bold">
<!-- These elements use inherited fonts from the g element. -->
<text x="0" y="100" font-weight="lighter">Rockwell Normal</text>
<text x="0" y="125">Rockwell Bold</text>
<text x="0" y="150" font-weight="bolder">Rockwell Extra Bold</text>
<text x="0" y="175" font-weight="900">Rockwell Extra Bold</text>
</g>
</svg>

The first text element renders properly in normal font.
The second text element also renders properly in bold font.
The third and fourth text elements do not render properly.  I would expect them
to use Rockwell Extra Bold (which is an installed font).  Instead bold font
gets used.  Why?

I looked through the code a bit and I noticed that TextNode element contains
weight text attribute but it is always set to either 1.0 (NORMAL) or 2.0
(BOLD).  My guess is that this is why I cannot get the "bolder of bold" and
"900" to work.

Am I doing something wrong?  Is there a way to use extra bold font in Batik?

Thanks,
Petar


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Extra bold font attribute

Posted by Thomas DeWeese <Th...@Kodak.com>.
Petar wrote:


> The first text element renders properly in normal font.
> The second text element also renders properly in bold font.
> The third and fourth text elements do not render properly.  I would expect them
> to use Rockwell Extra Bold (which is an installed font).  Instead bold font
> gets used.  Why?

    The "problem" is in bridge.TextUtilities.  This class maps 600 and
above to WEIGHT_BOLD.  The reason is that the JDK (1.3 & 1.4) will
render WEIGHT_HEAVY/EXTRABOLD/ULTRABOLD as 'regular' if there is not a
matching font, instead of dropping back to 'BOLD'.

    It might be possible to do even more of the font matching ourselves
but this is actually quite tricky (we would have to try instantiating
each weight of font and see what the weight attribute actually was -
if that would even work).  If you can put together a patch that
fixes this without breaking anything it would probably be accepted.

> I looked through the code a bit and I noticed that TextNode element contains
> weight text attribute but it is always set to either 1.0 (NORMAL) or 2.0
> (BOLD).  My guess is that this is why I cannot get the "bolder of bold" and
> "900" to work.
> 
> Am I doing something wrong?  Is there a way to use extra bold font in Batik?
> 
> Thanks,
> Petar
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org