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 Ulrich Mayring <ul...@denic.de> on 2009/01/09 10:52:53 UTC

PFMReader question

In FOP 0.94 there is documentation with respect to Dingbats fonts, that the 
PFMReader writes "UnknownEncoding" to the metrics file. This has to be 
replaced with SymbolEncoding or ZapfdingbatsEncoding.

The PFMReader from FOP 0.95 now writes WinAnsiEncoding for the URWDingbats 
font to the metrics file. Is this ok or do I also need to replace that with 
ZapfdingbatsEncoding?

Ulrich


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


Re: PFMReader question

Posted by Ulrich Mayring <ul...@denic.de>.
Jeremias Maerki wrote:
>>
>> SEVERE: Failed to read font metrics file null

> But I'm not convinced that this is a bug. Without the PFM in my hands, I
> can't tell.

What I meant is that the error output is buggy. It gives "null" as the 
unreadable font metrics file, which makes no sense. It should give the actual 
PFM file it was trying to read.

By looking at LazyFont.java I surmise that there are two ways to find the 
metrics file: first by looking at the FontInfo passed into the constructor 
and, as a fallback, by swapping the extension of the PFB file. However, the 
error output is only taking the first case into account. Thus, whenever the 
fallback case happens, the output is null.

The problem is one of the PFMs that are supplied in the ghostscript-fonts 
package. I have no idea which one, but will find out and report :)

cheers,

Ulrich


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


Re: PFMReader question

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 12.01.2009 13:46:05 Ulrich Mayring wrote:
> Jeremias Maerki wrote:
> > Executive summary: the AFM alone is usually sufficient.
> >
> > Both AFM and PFM contain a different set of font metrics. For
> > well-behaved Type1 fonts, the AFM alone is sufficient. When testing I
> > found at least one font where the PFM provided some information that
> > wasn't contained in the AFM. The Type1FontLoader class (responsible for
> > loading a Type 1 font) usually prefers information from the AFM if both
> > are available.
> 
> Thanks for the explanation, I gave it a go and got this:
> 
> SEVERE: Failed to read font metrics file null
> java.io.EOFException 
> 
>        at java.io.DataInputStream.readShort(DataInputStream.java:377) 
> 
>        at 
> org.apache.fop.fonts.type1.PFMInputStream.readShort(PFMInputStream.java:66) 
> 
>        at org.apache.fop.fonts.type1.PFMFile.loadKernPairs(PFMFile.java:188) 
> 
>        at org.apache.fop.fonts.type1.PFMFile.loadExtension(PFMFile.java:162) 

Looks like an malformed PFM file. I've had malformed PFMs before.

> Looking at the source code it appears there is a bug. Clearly, the font 
> metrics file is null in the exception output, but looking at LazyFont.java I 
> think that the actual metrics file to use is not determined from this 
> variable. As far as I can tell it is calculated from the embed-url filename 
> by swapping the extension.

Yes, the "metrics-url" attribute in the configuration refers to an XML
font metrics file. PFM and AFM files are found by changing the file
extension of the main font file (PFB in the case of Type1).

But I'm not convinced that this is a bug. Without the PFM in my hands, I
can't tell.

> The error itself seems to be an unexpected EOF. It would of course be helpful 
> to know which metrics file FOP was trying to process :)

If your PFB is myfont.pfb, FOP reads myfont.pfm in the same directory as
the PFB here.



Jeremias Maerki


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


Re: PFMReader question

Posted by Ulrich Mayring <ul...@denic.de>.
Jeremias Maerki wrote:
> Executive summary: the AFM alone is usually sufficient.
>
> Both AFM and PFM contain a different set of font metrics. For
> well-behaved Type1 fonts, the AFM alone is sufficient. When testing I
> found at least one font where the PFM provided some information that
> wasn't contained in the AFM. The Type1FontLoader class (responsible for
> loading a Type 1 font) usually prefers information from the AFM if both
> are available.

Thanks for the explanation, I gave it a go and got this:

SEVERE: Failed to read font metrics file null
java.io.EOFException 

       at java.io.DataInputStream.readShort(DataInputStream.java:377) 

       at 
org.apache.fop.fonts.type1.PFMInputStream.readShort(PFMInputStream.java:66) 

       at org.apache.fop.fonts.type1.PFMFile.loadKernPairs(PFMFile.java:188) 

       at org.apache.fop.fonts.type1.PFMFile.loadExtension(PFMFile.java:162) 


Looking at the source code it appears there is a bug. Clearly, the font 
metrics file is null in the exception output, but looking at LazyFont.java I 
think that the actual metrics file to use is not determined from this 
variable. As far as I can tell it is calculated from the embed-url filename 
by swapping the extension.

The error itself seems to be an unexpected EOF. It would of course be helpful 
to know which metrics file FOP was trying to process :)

Ulrich


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


Re: PFMReader question

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Executive summary: the AFM alone is usually sufficient.

Both AFM and PFM contain a different set of font metrics. For
well-behaved Type1 fonts, the AFM alone is sufficient. When testing I
found at least one font where the PFM provided some information that
wasn't contained in the AFM. The Type1FontLoader class (responsible for
loading a Type 1 font) usually prefers information from the AFM if both
are available.

On 12.01.2009 10:33:30 Ulrich Mayring wrote:
> Jeremias Maerki wrote:
> > No, you need the AFM and PFM but you don't need the XML file generated
> > by PFMReader. Actually PFMReader, as the name says, can only read the
> > PFM file, but without the XML font metrics file, FOP can actually read
> > the AFM, too, and use the more complete metrics information contained in
> > it.
> 
> Ok, so I take it that the PFM *and* the AFM are needed. But if FOP uses the 
> AFM for metrics, then why is the PFM needed at all?
> 
> Ulrich
> 



Jeremias Maerki


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


Re: PFMReader question

Posted by Ulrich Mayring <ul...@denic.de>.
Jeremias Maerki wrote:
> No, you need the AFM and PFM but you don't need the XML file generated
> by PFMReader. Actually PFMReader, as the name says, can only read the
> PFM file, but without the XML font metrics file, FOP can actually read
> the AFM, too, and use the more complete metrics information contained in
> it.

Ok, so I take it that the PFM *and* the AFM are needed. But if FOP uses the 
AFM for metrics, then why is the PFM needed at all?

Ulrich


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


Re: PFMReader question

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
No, you need the AFM and PFM but you don't need the XML file generated
by PFMReader. Actually PFMReader, as the name says, can only read the
PFM file, but without the XML font metrics file, FOP can actually read
the AFM, too, and use the more complete metrics information contained in
it.

On 09.01.2009 17:43:22 Ulrich Mayring wrote:
> Does that mean that PFM/AFM files are not necessary anymore? Do I just need 
> the PFB, when working with type 1 fonts?
> 
> Ulrich
> 
> Jeremias Maerki wrote:
> > Don't bother with XML font metrics files in 0.95 if you don't absolutely
> > need to. FOP 0.95 should handle Symbol and ZapfDingbats reasonably well
> > without a separate font metrics file if you configure them explicitely.
> >
> > In the unlikely case, that it doesn't work without XML font metrics
> > files: yes, you'd have to replace it with "ZapfDingbatsEncoding".
> > Otherwise, FOP will work off the wrong encoding.
> >
> >
> >
> > Off topic: I wonder how many more times we're going to mention that XML
> > font metrics are more and more unnecessary. When we started with those
> > it was a necessary evil to make custom fonts work. And now, everybody is
> > so used to do this tedious and annoying step that it's difficult to get
> > everyone back to a more intuitive approach, i.e. a simpler life. I can't
> > help but be amused about this. ;-) I guess we should consider adding a
> > big disclaimer to PFM/TTFReader stating that these tools will soon be
> > obsolete. Any other ideas?
> >
> > On 09.01.2009 10:52:53 Ulrich Mayring wrote:
> >> In FOP 0.94 there is documentation with respect to Dingbats fonts, that the
> >> PFMReader writes "UnknownEncoding" to the metrics file. This has to be
> >> replaced with SymbolEncoding or ZapfdingbatsEncoding.
> >>
> >> The PFMReader from FOP 0.95 now writes WinAnsiEncoding for the URWDingbats
> >> font to the metrics file. Is this ok or do I also need to replace that with
> >> ZapfdingbatsEncoding?
> >>
> >> Ulrich
> >
> >
> >
> > Jeremias Maerki
> 



Jeremias Maerki


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


Re: PFMReader question

Posted by Ulrich Mayring <ul...@denic.de>.
Does that mean that PFM/AFM files are not necessary anymore? Do I just need 
the PFB, when working with type 1 fonts?

Ulrich

Jeremias Maerki wrote:
> Don't bother with XML font metrics files in 0.95 if you don't absolutely
> need to. FOP 0.95 should handle Symbol and ZapfDingbats reasonably well
> without a separate font metrics file if you configure them explicitely.
>
> In the unlikely case, that it doesn't work without XML font metrics
> files: yes, you'd have to replace it with "ZapfDingbatsEncoding".
> Otherwise, FOP will work off the wrong encoding.
>
>
>
> Off topic: I wonder how many more times we're going to mention that XML
> font metrics are more and more unnecessary. When we started with those
> it was a necessary evil to make custom fonts work. And now, everybody is
> so used to do this tedious and annoying step that it's difficult to get
> everyone back to a more intuitive approach, i.e. a simpler life. I can't
> help but be amused about this. ;-) I guess we should consider adding a
> big disclaimer to PFM/TTFReader stating that these tools will soon be
> obsolete. Any other ideas?
>
> On 09.01.2009 10:52:53 Ulrich Mayring wrote:
>> In FOP 0.94 there is documentation with respect to Dingbats fonts, that the
>> PFMReader writes "UnknownEncoding" to the metrics file. This has to be
>> replaced with SymbolEncoding or ZapfdingbatsEncoding.
>>
>> The PFMReader from FOP 0.95 now writes WinAnsiEncoding for the URWDingbats
>> font to the metrics file. Is this ok or do I also need to replace that with
>> ZapfdingbatsEncoding?
>>
>> Ulrich
>
>
>
> Jeremias Maerki



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


Re: PFMReader question

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Don't bother with XML font metrics files in 0.95 if you don't absolutely
need to. FOP 0.95 should handle Symbol and ZapfDingbats reasonably well
without a separate font metrics file if you configure them explicitely.

In the unlikely case, that it doesn't work without XML font metrics
files: yes, you'd have to replace it with "ZapfDingbatsEncoding".
Otherwise, FOP will work off the wrong encoding.



Off topic: I wonder how many more times we're going to mention that XML
font metrics are more and more unnecessary. When we started with those
it was a necessary evil to make custom fonts work. And now, everybody is
so used to do this tedious and annoying step that it's difficult to get
everyone back to a more intuitive approach, i.e. a simpler life. I can't
help but be amused about this. ;-) I guess we should consider adding a
big disclaimer to PFM/TTFReader stating that these tools will soon be
obsolete. Any other ideas?

On 09.01.2009 10:52:53 Ulrich Mayring wrote:
> In FOP 0.94 there is documentation with respect to Dingbats fonts, that the 
> PFMReader writes "UnknownEncoding" to the metrics file. This has to be 
> replaced with SymbolEncoding or ZapfdingbatsEncoding.
> 
> The PFMReader from FOP 0.95 now writes WinAnsiEncoding for the URWDingbats 
> font to the metrics file. Is this ok or do I also need to replace that with 
> ZapfdingbatsEncoding?
> 
> Ulrich



Jeremias Maerki


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