You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by kloassie <sp...@hotmail.com> on 2006/05/31 14:22:02 UTC
Font from PFM File
Hi all,
I'm kinda new to Fop, what I do not understand is: How can I get the Font
from a font file in Fop?
One can create TTFFile by using a TTFReader and create a PFMFile by using a
PFMReader. But how does one actualy get the Font from this XYZFile?
For .ttf files I now just use Java's standard
Font.createFont(Font.TTF,InputStream), but the
Font.createFont(Font.Type1,InputStream) works only for .pfb files.
So now I wonder how to get the Font from a PFMFile? I think it should
probably be possible, but I just understand how...
Thanks in advance,
Klaas
--
View this message in context: http://www.nabble.com/Font+from+PFM+File-t1710272.html#a4643301
Sent from the FOP - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Font from PFM File
Posted by Chris Bowditch <bo...@hotmail.com>.
kloassie wrote:
> Hi all,
>
> I'm kinda new to Fop, what I do not understand is: How can I get the Font
> from a font file in Fop?
What do you mean by Font exactly? A java.awt.Font object? Or something
else?
>
> One can create TTFFile by using a TTFReader and create a PFMFile by using a
> PFMReader. But how does one actualy get the Font from this XYZFile?
> For .ttf files I now just use Java's standard
> Font.createFont(Font.TTF,InputStream), but the
> Font.createFont(Font.Type1,InputStream) works only for .pfb files.
> So now I wonder how to get the Font from a PFMFile? I think it should
> probably be possible, but I just understand how...
What is your actual objective? To create a PDF using XSL-FO with a
custom font? If so, the normal procedure starts with a TTF file and you
use the TTFReader to create a font metrics XML file. The XML File is
then used together with the original TTF file by Font to create a PDF
file. This is documented on the website:
http://xmlgraphics.apache.org/fop/0.92/fonts.html#custom
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Font from PFM File
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Klaas,
there's no font stored in the PFM file. Only the font metrics (!) are
stored in a PFM file. The font itself is usually in a PFB or PFA file.
Since JDK 1.5 you can use Type 1 fonts directly in Java2D if you use
java.awt.Font.createFont(Font.TYPE1_FONT, fontFile).
If you need to operate on JDK 1.4 or 1.3 you're out of luck. FOP does
not contain any code to parse and display Type 1 fonts. We only parse
Type 1 font metrics and can embed a Type 1 font in some of FOP's output
formats.
On 01.06.2006 09:57:04 kloassie wrote:
>
> Hi Chris
>
> I need Fop because the sdk cant read .pfm files
>
> if Fop cant help making a java.awt.Font, can it at least help in displaying
> the font stored in the pfm?
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Font from PFM File
Posted by Chris Bowditch <bo...@hotmail.com>.
kloassie wrote:
> Hi Chris,
>
> I mean this:
> 1. A .ttf file contains a font
> -> A java.awt.Font object can be created from a .ttf file
>
> 2. Windows can read a font from a .pfm file
> -> A .pfm file contains a font
> -> I expect in some way a java.awt.Font can be created from a .pfm file
>
> 3. Fop supports .pfm files
> -> I expect in some way Fop can be used to create a java.awt.Font from a
> .pfm file
>
> 4. I do not see how I should use Fop to create a java.awt.Font from a .pfm
> file
>
> So thats my question: how do I get the Font from a .pfm file using Fop?
You don't. FOP uses its own classes for dealing with Fonts because there
are several drawbacks to using Java AWT. Hence the need to create Font
Metrics, FOP uses the metrics and not the java.awt.Font object. There
are some exceptions to this (i.e. the AWT Renderer)
If you want to create a java.awt.Font object then just use Java. Why do
you need FOP or XSL-FO at all?
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Font from PFM File
Posted by kloassie <sp...@hotmail.com>.
Hi Chris
I need Fop because the sdk cant read .pfm files
if Fop cant help making a java.awt.Font, can it at least help in displaying
the font stored in the pfm?
Klaas
--
View this message in context: http://www.nabble.com/Font+from+PFM+File-t1710272.html#a4657993
Sent from the FOP - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Font from PFM File
Posted by kloassie <sp...@hotmail.com>.
Hi Chris,
I mean this:
1. A .ttf file contains a font
-> A java.awt.Font object can be created from a .ttf file
2. Windows can read a font from a .pfm file
-> A .pfm file contains a font
-> I expect in some way a java.awt.Font can be created from a .pfm file
3. Fop supports .pfm files
-> I expect in some way Fop can be used to create a java.awt.Font from a
.pfm file
4. I do not see how I should use Fop to create a java.awt.Font from a .pfm
file
So thats my question: how do I get the Font from a .pfm file using Fop?
Klaas
--
View this message in context: http://www.nabble.com/Font+from+PFM+File-t1710272.html#a4645502
Sent from the FOP - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org