You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Alexander Kiel <al...@gmx.net> on 2009/09/21 11:55:27 UTC

PDFFontDescriptor Ascent Descent and FontBBox

Hi,

as I'm currently on the way to redesign the TrueType/OpenType file
reading, from time to time I stumble over some odd things.

But instead of blindly refactoring, I think its better to ask you
before.

Fonts have among other things the properties ascent, descent and
fontBBox which are defined in the PDF spec chapter 5.7 Font Descriptors.

If I look into PDFFactory rev. 800217 line 1445 - 1483 method
makeFontDescriptor, I see two constructor calls, one for CID fonts and
one for the other fonts. For CID fonts the constructor of
PDFCIDFontDescriptor is called and for the others the constructor of
PDFFontDescriptor is called. PDFCIDFontDescriptor is a subclass of
PDFFontDescriptor.

The odd thing here is, that the call of PDFCIDFontDescriptor doesn't use
the ascent nor the descent of the font descriptor. Instead it uses some
quantities out of the fontBBox to feed the PDFFontDescriptor. This can
be seen inside PDFCIDFontDescriptor rev. 679326.

So as fontBBox, ascent and descent don't be the same thing, I would
recommend to change this. But this would properly break some things,
because we would get other values for ascent and descent in CID fonts.


Best Regards
Alex

-  
e-mail: alexanderkiel@gmx.net
web:    www.alexanderkiel.net


Re: PDFFontDescriptor Ascent Descent and FontBBox

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Alexander,

Alexander Kiel wrote:
> Hi Max,
> 
> thanks for pointing me to fontbox. As I did not find a repository with a
> trunk, I had a look into fontbox-0.8.0-incubating. They have quite clean
> code to parse TrueType files. But they are also not able to read any
> OpenType data. They are even not able to read kerning data as FOP can
> already. 
> 
> So I think, I will continue my OpenType effort inside FOP for now, but
> we should consider to merge the font parsing into fontbox.

It all depends on which code has the most potential. If FontBox offers
a cleaner basis then it makes sense to implement missing features there,
then use it as a replacement of FOP’s own font code. I think it would be
unfortunate to duplicate efforts on that area. I’m not sure we can
afford it given our limited resources.

OTOH, you seem to have made quite some progress on the FOP code already,
so it’s up to you. Just make sure the font library is totally
independent of any FOP specificity.


> Lets see what I can do in FOP right now. Currently I have all the
> current features refactured and written some tests against real fonts.
> I'm on the way to get kerning info out of the OpenType GPOS table. I
> have already written 19 test classes and added/modified 129 production
> classes.

Sounds like non-trivial changes, so an ICLA will probably be necessary
to integrate your work in the code base. Since the process takes a bit
of time, I’d suggest you to submit one as soon as possible:
http://www.apache.org/licenses/#clas

Thanks and good luck,
Vincent


> Best Regards
> Alex
> 
> -  
> e-mail: alexanderkiel@gmx.net
> web:    www.alexanderkiel.net
> 
> 
> On Tue, 2009-09-22 at 11:22 +0200, Max Berger wrote:
>> Alexandar,
>>
>> on a completely different note:
>>
>> It may be interesting to also look into fontbox (part of pdfbox),
>> which is now also an apache project, and therefore we could use source
>> synergy.
>>
>> http://incubator.apache.org/pdfbox/
>>
>> For the issue you've mentioned: This may be due so some issues with
>> CID fonts not properly defining ascent and descent, but I don't have a
>> reference for it. We would probably need some fonts to test and check.
>>
>> Max

Re: PDFFontDescriptor Ascent Descent and FontBBox

Posted by Alexander Kiel <al...@gmx.net>.
Hi Max,

thanks for pointing me to fontbox. As I did not find a repository with a
trunk, I had a look into fontbox-0.8.0-incubating. They have quite clean
code to parse TrueType files. But they are also not able to read any
OpenType data. They are even not able to read kerning data as FOP can
already. 

So I think, I will continue my OpenType effort inside FOP for now, but
we should consider to merge the font parsing into fontbox.

Lets see what I can do in FOP right now. Currently I have all the
current features refactured and written some tests against real fonts.
I'm on the way to get kerning info out of the OpenType GPOS table. I
have already written 19 test classes and added/modified 129 production
classes.


Best Regards
Alex

-  
e-mail: alexanderkiel@gmx.net
web:    www.alexanderkiel.net


On Tue, 2009-09-22 at 11:22 +0200, Max Berger wrote:
> Alexandar,
> 
> on a completely different note:
> 
> It may be interesting to also look into fontbox (part of pdfbox),
> which is now also an apache project, and therefore we could use source
> synergy.
> 
> http://incubator.apache.org/pdfbox/
> 
> For the issue you've mentioned: This may be due so some issues with
> CID fonts not properly defining ascent and descent, but I don't have a
> reference for it. We would probably need some fonts to test and check.
> 
> Max
> 
> 2009/9/21 Alexander Kiel <al...@gmx.net>:
> > Hi,
> >
> > as I'm currently on the way to redesign the TrueType/OpenType file
> > reading, from time to time I stumble over some odd things.
> >
> > But instead of blindly refactoring, I think its better to ask you
> > before.
> >
> > Fonts have among other things the properties ascent, descent and
> > fontBBox which are defined in the PDF spec chapter 5.7 Font Descriptors.
> >
> > If I look into PDFFactory rev. 800217 line 1445 - 1483 method
> > makeFontDescriptor, I see two constructor calls, one for CID fonts and
> > one for the other fonts. For CID fonts the constructor of
> > PDFCIDFontDescriptor is called and for the others the constructor of
> > PDFFontDescriptor is called. PDFCIDFontDescriptor is a subclass of
> > PDFFontDescriptor.
> >
> > The odd thing here is, that the call of PDFCIDFontDescriptor doesn't use
> > the ascent nor the descent of the font descriptor. Instead it uses some
> > quantities out of the fontBBox to feed the PDFFontDescriptor. This can
> > be seen inside PDFCIDFontDescriptor rev. 679326.
> >
> > So as fontBBox, ascent and descent don't be the same thing, I would
> > recommend to change this. But this would properly break some things,
> > because we would get other values for ascent and descent in CID fonts.
> >
> >
> > Best Regards
> > Alex
> >
> > -
> > e-mail: alexanderkiel@gmx.net
> > web:    www.alexanderkiel.net
> >
> >
> 
> 

Re: PDFFontDescriptor Ascent Descent and FontBBox

Posted by Max Berger <ma...@berger.name>.
Alexandar,

on a completely different note:

It may be interesting to also look into fontbox (part of pdfbox),
which is now also an apache project, and therefore we could use source
synergy.

http://incubator.apache.org/pdfbox/

For the issue you've mentioned: This may be due so some issues with
CID fonts not properly defining ascent and descent, but I don't have a
reference for it. We would probably need some fonts to test and check.

Max

2009/9/21 Alexander Kiel <al...@gmx.net>:
> Hi,
>
> as I'm currently on the way to redesign the TrueType/OpenType file
> reading, from time to time I stumble over some odd things.
>
> But instead of blindly refactoring, I think its better to ask you
> before.
>
> Fonts have among other things the properties ascent, descent and
> fontBBox which are defined in the PDF spec chapter 5.7 Font Descriptors.
>
> If I look into PDFFactory rev. 800217 line 1445 - 1483 method
> makeFontDescriptor, I see two constructor calls, one for CID fonts and
> one for the other fonts. For CID fonts the constructor of
> PDFCIDFontDescriptor is called and for the others the constructor of
> PDFFontDescriptor is called. PDFCIDFontDescriptor is a subclass of
> PDFFontDescriptor.
>
> The odd thing here is, that the call of PDFCIDFontDescriptor doesn't use
> the ascent nor the descent of the font descriptor. Instead it uses some
> quantities out of the fontBBox to feed the PDFFontDescriptor. This can
> be seen inside PDFCIDFontDescriptor rev. 679326.
>
> So as fontBBox, ascent and descent don't be the same thing, I would
> recommend to change this. But this would properly break some things,
> because we would get other values for ascent and descent in CID fonts.
>
>
> Best Regards
> Alex
>
> -
> e-mail: alexanderkiel@gmx.net
> web:    www.alexanderkiel.net
>
>