xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerry Barber <jbar...@photoaccess.com>
Subject Re: Problems Using Fonts in SVG
Date Fri, 18 Oct 2002 18:21:43 GMT
Ok,
Here is what I found out, hopefully, since I would think this is fairly 
common, it will help someone else.

If you render text using Graphics2D.setFont and Graphics2D.drawString Java 
apparently uses the underlying X window system to access the font.

However, if you need to get to the glyph outline (which is what Batik uses) 
apparently Java needs access to the font file directly.  You need to add 
the font file to <java_home>/jre/lib/fonts and update 
<java_home>/jre/lib/fonts/fonts.dir.

At 04:25 PM 10/16/2002 -0700, you wrote:
>Hi,
>I'm having trouble using fonts in SVG under Linux (Mandrake 8.1), Batik 
>version 1.5beta4.
>
>When I use the browser or the renderer very few of the fonts I have 
>installed on the system are recognized (~ 4 or 5).
>
>I wrote a little java program to lists the available fonts and display 
>them on the screen, it is able to recognize all the fonts (about 70 or 
>so).  It seems to have 2 failure modes, in one case nothing is displayed, 
>in the other the wrong font is displayed.
>
>On windows as well, all seems to work well.
>
>They svg file is below, the first string displays the second one 
>doesn't.  Thanks for any help.
>Jerry
>
><?xml version="1.0" encoding="utf-8"?>
><!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="800" height="400" viewBox="0 0 800 400"
>         overflow="visible" enable-background="new 0 0 800 400" 
> xml:space="preserve">
>                         <g>
>                                 <text transform="matrix(1 0 0 1 200 50)" 
> enable-background="new    ">
>                                   <tspan x="0" y="0" fill="#99A399" 
> font-family="lucidabright" font-size="48">A Test String</tspan>
>                                 </text>
>                                 <text transform="matrix(1 0 0 1 200 
> 300.584)"  fill="#99A399" font-family="Actionis" font-size="48">A Second 
> Test String</text>
>                         </g>
></svg>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org


Jerry Barber
President and CEO
PhotoAccess Corporation
206 902-1401
jbarber@photoaccess.com
www.photoaccess.com



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


Mime
View raw message