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 Simon Pepping <sp...@leverkruid.eu> on 2011/01/19 09:35:13 UTC
OpenType font library [was: Re: How much work is needed for FOP to
support OpenType fonts?]
I take this discussion to express my worries that FOP needs to create
its own support for fonts, among which Open Type Fonts. FOP's core
task is the layout and printing of FO files. If FOP could rely on good
font libraries, that would make our code base so much smaller and our
development tasks so much easier.
If I am not mistaken, Firefox does a fairly good job at representing
Indic scripts. Do they use a generally available library?
Are there no such libraries? Or do I see the issue wrong?
Regards, Simon
On Tue, Jan 18, 2011 at 04:11:54PM -0700, Glenn Adams wrote:
> That is a better question, but one I cannot answer, as I have not looked
> into the CFF support issue. Perhaps another DEV would care to respond.
>
> On Tue, Jan 18, 2011 at 4:03 PM, Ivan Ristic <iv...@gmail.com> wrote:
>
> > On Tue, Jan 18, 2011 at 10:51 PM, Glenn Adams <gl...@skynav.com> wrote:
> > >
> > > On Tue, Jan 18, 2011 at 3:41 PM, Ivan Ristic <iv...@gmail.com>
> > wrote:
> > >>
> > >> On Tue, Jan 18, 2011 at 9:27 PM, Glenn Adams <gl...@skynav.com> wrote:
> > >> > What do you mean by "fully"? If you are referring to the OpenType
> > GDEF,
> > >> > GSUB, GPOS support, then work is already underway to add that
> > >> > functionality.
> > >> > See the following for further info:
> > >> > http://people.apache.org/~spepping/
> > >> > http://wiki.apache.org/xmlgraphics-fop/ComplexScripts
Re: OpenType font library [was: Re: How much work is needed for FOP
to support OpenType fonts?]
Posted by Glenn Adams <gl...@skynav.com>.
I think we are taking the only reasonable route available w.r.t. complex
script support, namely reading the OTF font directly to extract and use the
advanced typographic tables. The same mechanisms can be used for the TTF AAT
tables as well.
The inquiry that started this thread seems most interested in CFF support,
and not complex scripts. However, I haven't looked into what is needed to
add CFF support.
G.
On Wed, Jan 19, 2011 at 4:10 AM, Jeremias Maerki <de...@jeremias-maerki.ch>wrote:
> I agree, native libraries would be a pain. BTW, interested parties could
> take a look at Apache FontBox's CFF support. That's part of Apache
> PDFBox. Maybe that could be used or adapted.
>
> On 19.01.2011 11:59:18 Craig Ringer wrote:
> > On 19/01/11 16:35, Simon Pepping wrote:
> > > I take this discussion to express my worries that FOP needs to create
> > > its own support for fonts, among which Open Type Fonts. FOP's core
> > > task is the layout and printing of FO files. If FOP could rely on good
> > > font libraries, that would make our code base so much smaller and our
> > > development tasks so much easier.
> > >
> > > If I am not mistaken, Firefox does a fairly good job at representing
> > > Indic scripts. Do they use a generally available library?
> >
> > There are several libraries for "complex" scripts, including the
> > commonly-used libbidi and pango libraries. All the widely used ones that
> > I know of are C- or C++ libraries.
> >
> > While Java can use C and C++ libraries, a Java Native Interface (JNI)
> > layer must be written. Further, JNI code and the libraries it uses must
> > be compiled separately for each supported platform and architecture,
> > making packaging and deployment of the Java code a ***PAIN*** unless all
> > the native code parts are shipped as part of the JDK/JRE.
> >
> > Even allowing for the issues with complex/bidi libraries, Apache FOP
> > must also handle the OpenType font format its self, including support
> > for font subsetting and embedding. That's way outside the scope of
> > complex script and bidi libraries. While library code exists to help
> > with OpenType handling, I'm not aware of any even C or C++ libraries
> > that provide useful, fairly abstracted facilities for subsetting and
> > embedding without tying them in to related PDF libraries.
> >
> > While Java its self can use OpenType fonts, it doesn't expose the
> > details of its OpenType parser etc to Java applications. In any case, it
> > may use the platform's font support rather than bundling its own. Java
> > apps need to provide their own OpenType format handling if they want to
> > do more than just use the fonts with Graphics2D and the other Java
> > rendering APIs, because there's no way to get to the "guts" of the fonts
> > loaded by the JVM.
> >
> >
> > Ideally, Apache FOP could be built on top of:
> >
> > - A low-level Java font format and parsing library that can identify
> > fonts, enumerate tables and glyphs, detect features, etc.
> >
> > - A low-level Java PDF library that handles the PDF document structure,
> > xref and indirect object management, PDF data structure representation,
> > direct-to-disk streaming of big images into PDF object streams, etc etc.
> >
> > - A Java library that uses both of the above to provide features for PDF
> > embedding of OpenType and TrueType fonts.
> >
> >
> > Unfortunately, AFAIK *NONE* of them exist, or at least are used, at
> > present. Fop seems to have its own PDF output code and own font handling
> > code. I don't see any obviously advantagous 3rd party replacements for
> > the font handling code, and most of the 3rd party PDF engines (like
> > iText) appear to be a bit limited when you want to insert your own
> > low-level PDF content stream data, objects, etc to implement features
> > not supported directly by the PDF library you're using.
> >
> > I was looking into this a little myself while checking to see how hard
> > it'd be to implement /DeviceCMYK and /ICCBased colour in FOP. Because of
> > the way FOP stores and manages colour internally, the answer appears to
> > be "very" at present, especially if you want to support PDF/X
> > requirements and handle CMYK passthrough.
> >
> > --
> > System & Network Administrator
> > POST Newspapers
>
>
>
>
> Jeremias Maerki
>
>
Re: OpenType font library [was: Re: How much work is needed for FOP to support OpenType fonts?]
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
I agree, native libraries would be a pain. BTW, interested parties could
take a look at Apache FontBox's CFF support. That's part of Apache
PDFBox. Maybe that could be used or adapted.
On 19.01.2011 11:59:18 Craig Ringer wrote:
> On 19/01/11 16:35, Simon Pepping wrote:
> > I take this discussion to express my worries that FOP needs to create
> > its own support for fonts, among which Open Type Fonts. FOP's core
> > task is the layout and printing of FO files. If FOP could rely on good
> > font libraries, that would make our code base so much smaller and our
> > development tasks so much easier.
> >
> > If I am not mistaken, Firefox does a fairly good job at representing
> > Indic scripts. Do they use a generally available library?
>
> There are several libraries for "complex" scripts, including the
> commonly-used libbidi and pango libraries. All the widely used ones that
> I know of are C- or C++ libraries.
>
> While Java can use C and C++ libraries, a Java Native Interface (JNI)
> layer must be written. Further, JNI code and the libraries it uses must
> be compiled separately for each supported platform and architecture,
> making packaging and deployment of the Java code a ***PAIN*** unless all
> the native code parts are shipped as part of the JDK/JRE.
>
> Even allowing for the issues with complex/bidi libraries, Apache FOP
> must also handle the OpenType font format its self, including support
> for font subsetting and embedding. That's way outside the scope of
> complex script and bidi libraries. While library code exists to help
> with OpenType handling, I'm not aware of any even C or C++ libraries
> that provide useful, fairly abstracted facilities for subsetting and
> embedding without tying them in to related PDF libraries.
>
> While Java its self can use OpenType fonts, it doesn't expose the
> details of its OpenType parser etc to Java applications. In any case, it
> may use the platform's font support rather than bundling its own. Java
> apps need to provide their own OpenType format handling if they want to
> do more than just use the fonts with Graphics2D and the other Java
> rendering APIs, because there's no way to get to the "guts" of the fonts
> loaded by the JVM.
>
>
> Ideally, Apache FOP could be built on top of:
>
> - A low-level Java font format and parsing library that can identify
> fonts, enumerate tables and glyphs, detect features, etc.
>
> - A low-level Java PDF library that handles the PDF document structure,
> xref and indirect object management, PDF data structure representation,
> direct-to-disk streaming of big images into PDF object streams, etc etc.
>
> - A Java library that uses both of the above to provide features for PDF
> embedding of OpenType and TrueType fonts.
>
>
> Unfortunately, AFAIK *NONE* of them exist, or at least are used, at
> present. Fop seems to have its own PDF output code and own font handling
> code. I don't see any obviously advantagous 3rd party replacements for
> the font handling code, and most of the 3rd party PDF engines (like
> iText) appear to be a bit limited when you want to insert your own
> low-level PDF content stream data, objects, etc to implement features
> not supported directly by the PDF library you're using.
>
> I was looking into this a little myself while checking to see how hard
> it'd be to implement /DeviceCMYK and /ICCBased colour in FOP. Because of
> the way FOP stores and manages colour internally, the answer appears to
> be "very" at present, especially if you want to support PDF/X
> requirements and handle CMYK passthrough.
>
> --
> System & Network Administrator
> POST Newspapers
Jeremias Maerki
Re: color issues [was: OpenType font library]
Posted by Craig Ringer <cr...@postnewspapers.com.au>.
On 19/01/11 19:13, Jeremias Maerki wrote:
> Craig, you might want to try out the color branches for which I've just
> started to vote to merge it into trunk. The color branch adds Named
> Color (separation, spot color) support and CIE Lab support.
>
> However, ICC and device CMYK colors should already work in FOP Trunk/1.0.
> Could you maybe elaborate on your problems there?
Hmm. I seem to have missed the cmyk() function in fop, and less
excusably the rgb-icc() function in XSL-FO proper. Maybe it was CMYK and
ICC tagged images I was having issues with?
I'll look into it again, it's been ages since I was looking at that, and
I was on fop 0.95 when investigating that stuff so it may have changed
since then anyway.
--
System & Network Administrator
POST Newspapers
Re: color issues [was: OpenType font library]
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Craig, you might want to try out the color branches for which I've just
started to vote to merge it into trunk. The color branch adds Named
Color (separation, spot color) support and CIE Lab support.
However, ICC and device CMYK colors should already work in FOP Trunk/1.0.
Could you maybe elaborate on your problems there?
On 19.01.2011 11:59:18 Craig Ringer wrote:
<snip/>
> I was looking into this a little myself while checking to see how hard
> it'd be to implement /DeviceCMYK and /ICCBased colour in FOP. Because of
> the way FOP stores and manages colour internally, the answer appears to
> be "very" at present, especially if you want to support PDF/X
> requirements and handle CMYK passthrough.
>
> --
> System & Network Administrator
> POST Newspapers
Jeremias Maerki
Re: OpenType font library [was: Re: How much work is needed for FOP
to support OpenType fonts?]
Posted by Craig Ringer <cr...@postnewspapers.com.au>.
On 19/01/11 16:35, Simon Pepping wrote:
> I take this discussion to express my worries that FOP needs to create
> its own support for fonts, among which Open Type Fonts. FOP's core
> task is the layout and printing of FO files. If FOP could rely on good
> font libraries, that would make our code base so much smaller and our
> development tasks so much easier.
>
> If I am not mistaken, Firefox does a fairly good job at representing
> Indic scripts. Do they use a generally available library?
There are several libraries for "complex" scripts, including the
commonly-used libbidi and pango libraries. All the widely used ones that
I know of are C- or C++ libraries.
While Java can use C and C++ libraries, a Java Native Interface (JNI)
layer must be written. Further, JNI code and the libraries it uses must
be compiled separately for each supported platform and architecture,
making packaging and deployment of the Java code a ***PAIN*** unless all
the native code parts are shipped as part of the JDK/JRE.
Even allowing for the issues with complex/bidi libraries, Apache FOP
must also handle the OpenType font format its self, including support
for font subsetting and embedding. That's way outside the scope of
complex script and bidi libraries. While library code exists to help
with OpenType handling, I'm not aware of any even C or C++ libraries
that provide useful, fairly abstracted facilities for subsetting and
embedding without tying them in to related PDF libraries.
While Java its self can use OpenType fonts, it doesn't expose the
details of its OpenType parser etc to Java applications. In any case, it
may use the platform's font support rather than bundling its own. Java
apps need to provide their own OpenType format handling if they want to
do more than just use the fonts with Graphics2D and the other Java
rendering APIs, because there's no way to get to the "guts" of the fonts
loaded by the JVM.
Ideally, Apache FOP could be built on top of:
- A low-level Java font format and parsing library that can identify
fonts, enumerate tables and glyphs, detect features, etc.
- A low-level Java PDF library that handles the PDF document structure,
xref and indirect object management, PDF data structure representation,
direct-to-disk streaming of big images into PDF object streams, etc etc.
- A Java library that uses both of the above to provide features for PDF
embedding of OpenType and TrueType fonts.
Unfortunately, AFAIK *NONE* of them exist, or at least are used, at
present. Fop seems to have its own PDF output code and own font handling
code. I don't see any obviously advantagous 3rd party replacements for
the font handling code, and most of the 3rd party PDF engines (like
iText) appear to be a bit limited when you want to insert your own
low-level PDF content stream data, objects, etc to implement features
not supported directly by the PDF library you're using.
I was looking into this a little myself while checking to see how hard
it'd be to implement /DeviceCMYK and /ICCBased colour in FOP. Because of
the way FOP stores and manages colour internally, the answer appears to
be "very" at present, especially if you want to support PDF/X
requirements and handle CMYK passthrough.
--
System & Network Administrator
POST Newspapers
Re: OpenType font library [was: Re: How much work is needed for FOP
to support OpenType fonts?]
Posted by mehdi houshmand <me...@gmail.com>.
Hi Simon,
The FOP font library doesn't actually render or paint any fonts, it
does 1 of 2 things. Either it a) creates a subset of the font, and
streams the subset (as a byte stream) to the PDF/PS document or b) it
streams the whole font to the document (I think this is what is done
for AFP, I don't think FOP supports subset embedding in AFP). This
means the reader of the document has to read the font we embed and
then does all the painting and rendering. Since Firefox is a
viewer/browser and doesn't have a feature to embed fonts when saving
html (or at least I'm pretty sure it doesn't) I'm not sure how we
could take advantage of a graphics library, since that is done in the
reader and not the document. OpenGL and SDL libraries are good
examples of opensource programs that do display fonts, but again, I
dont think subsetting/embedding is in their scope.
I could however be completely mistaken but that's my tuppence worth.
Mehdi
On 19 January 2011 08:35, Simon Pepping <sp...@leverkruid.eu> wrote:
> I take this discussion to express my worries that FOP needs to create
> its own support for fonts, among which Open Type Fonts. FOP's core
> task is the layout and printing of FO files. If FOP could rely on good
> font libraries, that would make our code base so much smaller and our
> development tasks so much easier.
>
> If I am not mistaken, Firefox does a fairly good job at representing
> Indic scripts. Do they use a generally available library?
>
> Are there no such libraries? Or do I see the issue wrong?
>
> Regards, Simon
>
> On Tue, Jan 18, 2011 at 04:11:54PM -0700, Glenn Adams wrote:
>> That is a better question, but one I cannot answer, as I have not looked
>> into the CFF support issue. Perhaps another DEV would care to respond.
>>
>> On Tue, Jan 18, 2011 at 4:03 PM, Ivan Ristic <iv...@gmail.com> wrote:
>>
>> > On Tue, Jan 18, 2011 at 10:51 PM, Glenn Adams <gl...@skynav.com> wrote:
>> > >
>> > > On Tue, Jan 18, 2011 at 3:41 PM, Ivan Ristic <iv...@gmail.com>
>> > wrote:
>> > >>
>> > >> On Tue, Jan 18, 2011 at 9:27 PM, Glenn Adams <gl...@skynav.com> wrote:
>> > >> > What do you mean by "fully"? If you are referring to the OpenType
>> > GDEF,
>> > >> > GSUB, GPOS support, then work is already underway to add that
>> > >> > functionality.
>> > >> > See the following for further info:
>> > >> > http://people.apache.org/~spepping/
>> > >> > http://wiki.apache.org/xmlgraphics-fop/ComplexScripts
>