Hi Jeremias,
Thanks, that was the missing bit of information I needed! It works
beautifully now, you can't imagine how happy you have made me :)
How did you figure out what name to use (and what the PS name is)? Is
there some nifty program that shows .ttf meta-data or something?
Gr,
Koen
On Thu, Oct 22, 2009 at 09:54:20AM +0200, Jeremias Maerki wrote:
> Yes, that's tricky business. You have to use the font name under which
> it is provided by the operating system because Batik uses AWT/Java2D for
> font handling. If your font is the one I found, then you need to
> use "Abduction II" (notice the space). "AbductionII" works because FOP
> als registers the font internally using the PostScript name, but the
> same is not true in AWT/Java2D.
>
> You can find out the family names of your fonts using the following
> code:
>
> GraphicsEnvironment env =
> GraphicsEnvironment.getLocalGraphicsEnvironment();
> String[] fontFamilies = env.getAvailableFontFamilyNames();
> for (int i = 0, c = fontFamilies.length; i < c; i++) {
> System.out.println(fontFamilies[i]);
> }
>
> In FOP Trunk, there's also a little command-line tool that helps with
> problems like this. See:
> http://xmlgraphics.apache.org/fop/trunk/fonts.html#font-list
>
> HTH
>
> On 21.10.2009 17:20:56 Koen Martens wrote:
> > Hi list,
> >
> > I'm having some problems with fonts in SVG and PDF output. The weird thing
> > is, it
> > works correctly on one machine, but fails on all my other machines.
> >
> > What am I trying to accomplish? I have an svg file, that I want to convert
> > to PDF. We
> > used batik before, but ended up with rasterized text (ie. you could not
> > copy+paste the
> > text out of the pdf). A quick test run with FOP showed that it did make the
> > text
> > selectable, instead of rendering the text as graphics. The fo file i'm
> > using is below
> > for reference.
> >
> > As you can see, i'm first writing out 'test (10) abductii' in font-family
> > AbductionII
> > (some weird font i used because it looks totally different from any
> > standard font and
> > even i as a non designer can pick that out from the standard fonts :). Then
> > i'm
> > embedding the svg. Inside the svg we find some text nodes that also use the
> > AbducionII
> > font-family.
> >
> > Now, I've configured the ttf file that contains AbductII in X, as well as
> > in a custom
> > config for FOP. I then run the fo file through FOP and check the result.
> >
> > In all cases, the test text 'test (10) abductii' is rendered correctly.
> > However, the
> > text in the svg is only rendered correctly on my desktop. I've tried on 4
> > different
> > systems, in all cases using the exact same fop-0.95 binary download.
> >
> > desktop:
> > IcedTea Runtime Environment (build 1.7.0-Mandriva-19.202.56.2mdv2008.0)
> > IcedTea 64-Bit Server VM (build 11.0-b05, mixed mode)
> > Mandriva linux
> >
> > laptop:
> > java version "1.6.0_0"
> > OpenJDK Runtime Environment (build 1.6.0_0-b11)
> > OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)
> > debian
> >
> > server:
> > java version "1.4.2-p7"
> > Java(TM) 2 Runtime Environment, Standard Edition (build
> > 1.4.2-p7-root_25_dec_2005_15_17)
> > Java HotSpot(TM) Client VM (build 1.4.2-p7-root_25_dec_2005_15_17, mixed
> > mode)
> > FreeBSD 7.x
> >
> > server:
> > java version "1.6.0_07"
> > Diablo Java(TM) SE Runtime Environment (build 1.6.0_07-b02)
> > Diablo Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)
> > FreeBSD 7.x
> >
> > So only on the desktop do i get the result i'm after, in all other cases,
> > only the test
> > text put directly in the fo file renders ok, the svg text renders with a
> > standard font
> > (although spaced as if it was rendered in the wider AbductionII font).
> >
> > Now, i'm aware that to render svg, fop uses batik as well. And that there
> > is some step
> > in between batik and fop's pdf output, that maps fonts used in batik output
> > to something
> > configured in FOP. Perhaps this mapping is failing for some reason on all
> > machines except
> > the desktop machine? Would the java version (and thus presumably the awt
> > implementation)
> > be a relevant thing? What can I do to further debug this problem??
> >
> > Btw, using batik-1.7's rasterizer, i can render the svg to pdf with the
> > right font, however
> > then i'm back to my original problem that the text is not selectable.
> >
> > Any hints would be greatly appreciated!!
> >
> > Thanks,
> >
> > Koen
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
> > xmlns:xlink="http://www.w3.org/1999/xlink">
> > <fo:layout-master-set>
> > <fo:simple-page-master master-name="first"
> > margin-right="1.5cm"
> > margin-left="1.5cm"
> > margin-bottom="2cm"
> > margin-top="1cm"
> > page-height="21cm"
> > page-width="29.7cm">
> > <fo:region-body margin-top="1cm"/>
> > <fo:region-before extent="1cm"/>
> > <fo:region-after extent="1.5cm"/>
> > </fo:simple-page-master>
> > </fo:layout-master-set>
> >
> > <fo:page-sequence master-reference="first">
> > <fo:flow flow-name="xsl-region-body">
> > <fo:block font-family="AbductionII">test (10) abductii</fo:block>
> > <fo:block>
> > <fo:external-graphic src="file:test.svg"
> > content-width="scale-to-fit" content-height="scale-to-fit" width="26.7cm"
> > scaling="un
> > iform"/>
> > </fo:block>
> > </fo:flow>
> > </fo:page-sequence>
> > </fo:root>
> >
>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]