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 Ju...@Piater.name on 2008/01/02 11:54:26 UTC

STIX fonts

Hi,

I'm trying to use the STIX fonts with FOP and am running into issues.

Ideally, the OpenType format used by the STIX fonts were supported
directly by FOP, but I understand this is work in progress. (To any
FOP developers out there: When might we have this?)

So I tried converting the fonts to TrueType using fontforge. This
appeared to work, with no significant (I think) error messages in the
process. Fontforge successfully reads and displays converted fonts.

FOP runs without any complaints, and according to pdffonts the STIX
fonts are properly embedded in the PDF. However, the PDF appears to be
invalid: Ghostscript stops rendering the page at the first STIX
character; xpdf continues to render but shows nothing (white space) in
place of the STIX characters. The metrics and encoding seem ok though;
I can copy and paste the invisible characters successfully from xpdf
into emacs.

What might be the problem?

Then I tried converting the fonts to Type1. This works all the way,
except that a Type1 font can apparently only encode 256 characters at
a time, and indeed, some special characters (Euro symbol) are missing
in the otherwise impeccable PDF.

I could split up the STIX fonts and implement XSLT wizardry to help
FOP find all the glyphs, but this would involve some bending over
backwards and jumping through hoops, so I thought I'd ask here if
anybody might have some further insights concerning the TrueType
weirdness.

Thanks,
Justus

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


Re: STIX fonts

Posted by Ju...@Piater.name.
Justus-bulk@Piater.name wrote on Wed, 02 Jan 2008 11:54:26 +0100:

> xpdf continues to render but shows nothing (white space) in
> place of the STIX characters. The metrics and encoding seem ok though;
> I can copy and paste the invisible characters successfully from xpdf
> into emacs.

FWIW, I have the exact same problem with the Debian-supplied
latex-xft-fonts.

Justus

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


Re: TrueType CID fonts

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 27.01.2008 19:18:33 Justus wrote:
> Jeremias,
> 
> Jeremias Maerki <de...@jeremias-maerki.ch> wrote on Fri, 18 Jan 2008
> 18:02:44 +0100:
> 
> > I think except for GhostView all other viewers use Poppler for PDF
> > interpretation, right? Any other ideas?
> 
> As far as I can tell, only evince uses Poppler (which is based on the
> xpdf code), but kpdf doesn't.
> 
> However, all of them use FreeType, including GhostScript. Could it be
> a FreeType issue?

I have no idea. I don't know anything about FreeType and how it's used.

> > If someone from one of the viewers that fail could give us a hint in
> > case we do something wrong, that would really be helpful. I guess
> > either the GhostScript team or the Poppler team would have to be
> > approached. Justus, would you do that?
> 
> Will do, but I'll wait for your response concerning FreeType first.
> 
> Thanks,
> Justus



Jeremias Maerki


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


Re: TrueType CID fonts

Posted by Ju...@Piater.name.
Jeremias,

Jeremias Maerki <de...@jeremias-maerki.ch> wrote on Fri, 18 Jan 2008
18:02:44 +0100:

> I think except for GhostView all other viewers use Poppler for PDF
> interpretation, right? Any other ideas?

As far as I can tell, only evince uses Poppler (which is based on the
xpdf code), but kpdf doesn't.

However, all of them use FreeType, including GhostScript. Could it be
a FreeType issue?

> If someone from one of the viewers that fail could give us a hint in
> case we do something wrong, that would really be helpful. I guess
> either the GhostScript team or the Poppler team would have to be
> approached. Justus, would you do that?

Will do, but I'll wait for your response concerning FreeType first.

Thanks,
Justus

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


Re: TrueType CID fonts

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Ok, that means at least one thing is fixed.

Indeed, I can confirm that even with FOP Trunk, GhostScript/GhostView
cannot process a PDF that contains the FreeSerif font.

I looked into the PDF file generated by OpenOffice. They seem to use a
trick for TrueType subsetting. They declare the font to be symbolic and
basically redefine a completely new encoding. The mapping of the glyph
indexes to the Unicode values is done using a ToUnicode table. The
limitation (AFAIK) is that they cannot embed more than 256 glyphs that
way. Using CID keyed fonts, FOP doesn't have that limitation. I've
checked what OpenOffice does if there are more than 256 glyphs: they
simply generate a new subset font. In Acrobat's font list, you then get
"ArialUnicodeMS" (for example) twice.

I haven't seen anything where I'd have to say that FOP is wrong. FOP
simply has a different approach. If someone from one of the viewers that
fail could give us a hint in case we do something wrong, that would
really be helpful. I guess either the GhostScript team or the Poppler
team would have to be approached. Justus, would you do that? Am I making
sense in the first place? Maybe I'm totally misguided here. Anyway,
given that only some of the fonts don't work could indicate a bug in
either the fonts (maybe all were generated using the same font tool) or
the PDF libraries. I think except for GhostView all other viewers use
Poppler for PDF interpretation, right? Any other ideas?

On 18.01.2008 16:57:24 Justus-bulk wrote:
> Jeremias Maerki <de...@jeremias-maerki.ch> wrote on Fri, 18 Jan 2008
> 13:26:16 +0100:
> 
> > would you mind doing the same test again with FOP Trunk
> 
> This did not change anything, except that this works now:
> 
> > About the subset indicator: That may have been fixed by the changes
> > mentioned above.
> > ...
> > On 18.01.2008 13:09:15 Justus-bulk wrote:
> >> ...
> >> pdffonts on Fop output:
> >> 
> >> name                                 type              emb sub uni object ID
> >> ------------------------------------ ----------------- --- --- --- ---------
> >> Helvetica                            Type 1            no  no  no      13  0
> >> 8E6c57STIXGeneral                    CID TrueType      yes no  yes     17  0
> >> 4E6b8aBitstreamVeraSerif             CID TrueType      yes no  yes     23  0
> >> 3E6b73LinuxLibertine                 CID TrueType      yes no  yes     35  0
> >> 5E6be2DejaVuSerif                    CID TrueType      yes no  yes     29  0
> >> 2E6b2dcmr10                          CID TrueType      yes no  yes     41  0
> >> 6E6bfeLiberationSerif                CID TrueType      yes no  yes     47  0
> >> 1E6ac4FreeSerif                      CID TrueType      yes no  yes     53  0
> >> 7E6c44GentiumBasic                   CID TrueType      yes no  yes     59  0
> 
> name                                 type              emb sub uni object ID
> ------------------------------------ ----------------- --- --- --- ---------
> Helvetica                            Type 1            no  no  no      14  0
> EAAAAH+STIXGeneral                   CID TrueType      yes yes yes     18  0
> EAAAAD+BitstreamVeraSerif-Roman      CID TrueType      yes yes yes     24  0
> EAAAAC+LinLibertine                  CID TrueType      yes yes yes     36  0
> EAAAAE+DejaVuSerif                   CID TrueType      yes yes yes     30  0
> EAAAAB+cmr10                         CID TrueType      yes yes yes     42  0
> EAAAAF+LiberationSerif               CID TrueType      yes yes yes     48  0
> EAAAAA+FreeSerif                     CID TrueType      yes yes yes     54  0
> EAAAAG+GentiumBasic                  CID TrueType      yes yes yes     60  0
> 



Jeremias Maerki


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


Re: TrueType CID fonts

Posted by Ju...@Piater.name.
Jeremias Maerki <de...@jeremias-maerki.ch> wrote on Fri, 18 Jan 2008
13:26:16 +0100:

> would you mind doing the same test again with FOP Trunk

This did not change anything, except that this works now:

> About the subset indicator: That may have been fixed by the changes
> mentioned above.
> ...
> On 18.01.2008 13:09:15 Justus-bulk wrote:
>> ...
>> pdffonts on Fop output:
>> 
>> name                                 type              emb sub uni object ID
>> ------------------------------------ ----------------- --- --- --- ---------
>> Helvetica                            Type 1            no  no  no      13  0
>> 8E6c57STIXGeneral                    CID TrueType      yes no  yes     17  0
>> 4E6b8aBitstreamVeraSerif             CID TrueType      yes no  yes     23  0
>> 3E6b73LinuxLibertine                 CID TrueType      yes no  yes     35  0
>> 5E6be2DejaVuSerif                    CID TrueType      yes no  yes     29  0
>> 2E6b2dcmr10                          CID TrueType      yes no  yes     41  0
>> 6E6bfeLiberationSerif                CID TrueType      yes no  yes     47  0
>> 1E6ac4FreeSerif                      CID TrueType      yes no  yes     53  0
>> 7E6c44GentiumBasic                   CID TrueType      yes no  yes     59  0

name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
Helvetica                            Type 1            no  no  no      14  0
EAAAAH+STIXGeneral                   CID TrueType      yes yes yes     18  0
EAAAAD+BitstreamVeraSerif-Roman      CID TrueType      yes yes yes     24  0
EAAAAC+LinLibertine                  CID TrueType      yes yes yes     36  0
EAAAAE+DejaVuSerif                   CID TrueType      yes yes yes     30  0
EAAAAB+cmr10                         CID TrueType      yes yes yes     42  0
EAAAAF+LiberationSerif               CID TrueType      yes yes yes     48  0
EAAAAA+FreeSerif                     CID TrueType      yes yes yes     54  0
EAAAAG+GentiumBasic                  CID TrueType      yes yes yes     60  0

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


Re: TrueType CID fonts (was Re: STIX fonts)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Justus,

would you mind doing the same test again with FOP Trunk (from the SVN
repo, you have to build yourself)? I've fixed a few things with fonts
support since 0.94. At least, the embedded font names are now as
required by the PDF spec (you can see in the table below the different
naming of the subset fonts). I'm not sure if that was already it but
it's a good thing to check.

About "copy/paste": Shame on us. This is outdated and needs to be
removed as it has been fixed. I'll do that later.

About the subset indicator: That may have been fixed by the changes
mentioned above.

On 18.01.2008 13:09:15 Justus-bulk wrote:
> Jeremias,
> 
> Trying to isolate the culprit, I did some more experiments, with mixed
> results.
> 
> I created a text file containing eight of my installed TrueType fonts
> in both XSL-FO and in OpenOffice, and created PDFs using Fop 0.94 and
> OOo's PDF export, respectively (see
> http://www.intelsig.be/~piater/nobackup/fop/).
> 
> The results in a nutshell:
> 
> - The Fop-generated PDF is displayed only partially by all of my
>   open-source PDF renderers (xpdf, gv, kpdf, evince).
> 
>   Fonts rendered correctly:
>   - BitstreamVeraSerif
>   - DejaVuSerif
>   - LiberationSerif
>   - GentiumBasic (downloaded from SIL's Web site)
> 
>   Fonts rendered invisibly (but copy-and-pastable nevertheless):
>   - FreeSerif
>   - cmr10 (from latex-xft-fonts)
>   - LinuxLibertine
>   - STIXGeneral (OTF from stixfonts.org converted to TTF using fontforge)
> 
> - The Fop-generated PDF is read correctly by Acroread 8.
> 
> - All fonts are correctly read and displayed by both OOo and ftview
>   (the FreeType2 font viewer).
> 
> - The OOo-generated PDF is read correctly by *all* viewers.
> 
> 
> There is no obvious conclusion:
> 
> - It does not seem to be a Fop problem, since Acroread is unaffected.
> 
> - It does not seem to be a FreeType problem, since all my open-source
>   programs link against it, including the unaffected OOo and ftview.
> 
> - And yet, all open-source viewers consistently fail on the
>   Fop-generated output only.
> 
> 
> Two related comments:
> 
> - The remarks on http://xmlgraphics.apache.org/fop/0.94/fonts.html
>   that character encoding is "Never correct" and copy/paste "won't
>   work" seem overly strong; both mostly work for me, including
>   non-ASCII characters (albeit with different gotchas depending
>   whether I paste into, say, Emacs or a terminal).
> 
> - That same page says that TrueType fonts are embedded as subsets, but
>   pdffonts disagrees (see below).
> 
> 
> Not being a font expert, I am stuck for now. Before I file a bug
> against Fop, where could I take this?
> 
> Or perhaps other Fop users can share relevant insight regarding the
> use of TrueType Unicode fonts with Fop?
> 
> Thanks,
> Justus
> 
> 
> pdffonts on Fop output:
> 
> name                                 type              emb sub uni object ID
> ------------------------------------ ----------------- --- --- --- ---------
> Helvetica                            Type 1            no  no  no      13  0
> 8E6c57STIXGeneral                    CID TrueType      yes no  yes     17  0
> 4E6b8aBitstreamVeraSerif             CID TrueType      yes no  yes     23  0
> 3E6b73LinuxLibertine                 CID TrueType      yes no  yes     35  0
> 5E6be2DejaVuSerif                    CID TrueType      yes no  yes     29  0
> 2E6b2dcmr10                          CID TrueType      yes no  yes     41  0
> 6E6bfeLiberationSerif                CID TrueType      yes no  yes     47  0
> 1E6ac4FreeSerif                      CID TrueType      yes no  yes     53  0
> 7E6c44GentiumBasic                   CID TrueType      yes no  yes     59  0
> 
> 
> pdffonts on OOo output:
> 
> name                                 type              emb sub uni object ID
> ------------------------------------ ----------------- --- --- --- ---------
> BAAAAA+FreeSerif                     TrueType          yes yes yes     29  0
> CAAAAA+cmr10                         TrueType          yes yes yes     49  0
> DAAAAA+BitstreamVeraSans-Roman       TrueType          yes yes yes     54  0
> EAAAAA+LinLibertine                  TrueType          yes yes yes     59  0
> FAAAAA+BitstreamVeraSerif-Roman      TrueType          yes yes yes     44  0
> GAAAAA+DejaVuSerif                   TrueType          yes yes yes     34  0
> HAAAAA+LiberationSerif               TrueType          yes yes yes     19  0
> IAAAAA+GentiumBasic                  TrueType          yes yes yes     24  0
> JAAAAA+STIXGeneral                   TrueType          yes yes yes     39  0
> 
> 
> My complete fop.xconf:
> 
> <?xml version="1.0"?>
> <fop version="1.0">
>   <strict-configuration>true</strict-configuration>
>   <renderers>
>     <renderer mime="application/pdf">
>       <fonts>
> 	<directory>/usr/local/share/fonts/truetype/STIXBeta</directory>
> 	<directory>/usr/local/share/fonts/truetype/GentiumBasic</directory>
> 	<auto-detect/>
>       </fonts>
>     </renderer>
>   </renderers>
> </fop>
> 
> Fop outputs the following, none of which I think is relevant to the
> above problems:
> 
> Jan 18, 2008 10:14:22 AM org.apache.fop.fonts.truetype.TTFFile readKerning
> WARNING: Unicode index (1) not found for glyph 2870
> Jan 18, 2008 10:14:22 AM org.apache.fop.fonts.truetype.TTFFile readKerning
> WARNING: Unicode index (1) not found for glyph 2870
> Jan 18, 2008 10:14:22 AM org.apache.fop.fonts.truetype.TTFFile determineAscDesc
> WARNING: Ascender and descender together are larger than the em box. This could lead to a wrong baseline placement in Apache FOP.
> 



Jeremias Maerki


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


TrueType CID fonts (was Re: STIX fonts)

Posted by Ju...@Piater.name.
Jeremias,

Trying to isolate the culprit, I did some more experiments, with mixed
results.

I created a text file containing eight of my installed TrueType fonts
in both XSL-FO and in OpenOffice, and created PDFs using Fop 0.94 and
OOo's PDF export, respectively (see
http://www.intelsig.be/~piater/nobackup/fop/).

The results in a nutshell:

- The Fop-generated PDF is displayed only partially by all of my
  open-source PDF renderers (xpdf, gv, kpdf, evince).

  Fonts rendered correctly:
  - BitstreamVeraSerif
  - DejaVuSerif
  - LiberationSerif
  - GentiumBasic (downloaded from SIL's Web site)

  Fonts rendered invisibly (but copy-and-pastable nevertheless):
  - FreeSerif
  - cmr10 (from latex-xft-fonts)
  - LinuxLibertine
  - STIXGeneral (OTF from stixfonts.org converted to TTF using fontforge)

- The Fop-generated PDF is read correctly by Acroread 8.

- All fonts are correctly read and displayed by both OOo and ftview
  (the FreeType2 font viewer).

- The OOo-generated PDF is read correctly by *all* viewers.


There is no obvious conclusion:

- It does not seem to be a Fop problem, since Acroread is unaffected.

- It does not seem to be a FreeType problem, since all my open-source
  programs link against it, including the unaffected OOo and ftview.

- And yet, all open-source viewers consistently fail on the
  Fop-generated output only.


Two related comments:

- The remarks on http://xmlgraphics.apache.org/fop/0.94/fonts.html
  that character encoding is "Never correct" and copy/paste "won't
  work" seem overly strong; both mostly work for me, including
  non-ASCII characters (albeit with different gotchas depending
  whether I paste into, say, Emacs or a terminal).

- That same page says that TrueType fonts are embedded as subsets, but
  pdffonts disagrees (see below).


Not being a font expert, I am stuck for now. Before I file a bug
against Fop, where could I take this?

Or perhaps other Fop users can share relevant insight regarding the
use of TrueType Unicode fonts with Fop?

Thanks,
Justus


pdffonts on Fop output:

name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
Helvetica                            Type 1            no  no  no      13  0
8E6c57STIXGeneral                    CID TrueType      yes no  yes     17  0
4E6b8aBitstreamVeraSerif             CID TrueType      yes no  yes     23  0
3E6b73LinuxLibertine                 CID TrueType      yes no  yes     35  0
5E6be2DejaVuSerif                    CID TrueType      yes no  yes     29  0
2E6b2dcmr10                          CID TrueType      yes no  yes     41  0
6E6bfeLiberationSerif                CID TrueType      yes no  yes     47  0
1E6ac4FreeSerif                      CID TrueType      yes no  yes     53  0
7E6c44GentiumBasic                   CID TrueType      yes no  yes     59  0


pdffonts on OOo output:

name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
BAAAAA+FreeSerif                     TrueType          yes yes yes     29  0
CAAAAA+cmr10                         TrueType          yes yes yes     49  0
DAAAAA+BitstreamVeraSans-Roman       TrueType          yes yes yes     54  0
EAAAAA+LinLibertine                  TrueType          yes yes yes     59  0
FAAAAA+BitstreamVeraSerif-Roman      TrueType          yes yes yes     44  0
GAAAAA+DejaVuSerif                   TrueType          yes yes yes     34  0
HAAAAA+LiberationSerif               TrueType          yes yes yes     19  0
IAAAAA+GentiumBasic                  TrueType          yes yes yes     24  0
JAAAAA+STIXGeneral                   TrueType          yes yes yes     39  0


My complete fop.xconf:

<?xml version="1.0"?>
<fop version="1.0">
  <strict-configuration>true</strict-configuration>
  <renderers>
    <renderer mime="application/pdf">
      <fonts>
	<directory>/usr/local/share/fonts/truetype/STIXBeta</directory>
	<directory>/usr/local/share/fonts/truetype/GentiumBasic</directory>
	<auto-detect/>
      </fonts>
    </renderer>
  </renderers>
</fop>

Fop outputs the following, none of which I think is relevant to the
above problems:

Jan 18, 2008 10:14:22 AM org.apache.fop.fonts.truetype.TTFFile readKerning
WARNING: Unicode index (1) not found for glyph 2870
Jan 18, 2008 10:14:22 AM org.apache.fop.fonts.truetype.TTFFile readKerning
WARNING: Unicode index (1) not found for glyph 2870
Jan 18, 2008 10:14:22 AM org.apache.fop.fonts.truetype.TTFFile determineAscDesc
WARNING: Ascender and descender together are larger than the em box. This could lead to a wrong baseline placement in Apache FOP.

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


Re: STIX fonts

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 02.01.2008 11:54:26 Justus-bulk wrote:
> Hi,
> 
> I'm trying to use the STIX fonts with FOP and am running into issues.
> 
> Ideally, the OpenType format used by the STIX fonts were supported
> directly by FOP, but I understand this is work in progress.

It's not really "work in progress" as nobody's currently working on it,
AFAIK. OpenType fonts with CFF glyphs simply haven't been implemented,
yet. Patches are always welcome.

> (To any FOP developers out there: When might we have this?)

Whenever someone has a bad enough itch and free time to implement the
missing functionality.

> So I tried converting the fonts to TrueType using fontforge. This
> appeared to work, with no significant (I think) error messages in the
> process. Fontforge successfully reads and displays converted fonts.
> 
> FOP runs without any complaints, and according to pdffonts the STIX
> fonts are properly embedded in the PDF. However, the PDF appears to be
> invalid: Ghostscript stops rendering the page at the first STIX
> character; xpdf continues to render but shows nothing (white space) in
> place of the STIX characters. The metrics and encoding seem ok though;
> I can copy and paste the invisible characters successfully from xpdf
> into emacs.
> 
> What might be the problem?

No idea. I've never played with font converters. FontForge may simply
have messed up the font.

> Then I tried converting the fonts to Type1. This works all the way,
> except that a Type1 font can apparently only encode 256 characters at
> a time, and indeed, some special characters (Euro symbol) are missing
> in the otherwise impeccable PDF.
> 
> I could split up the STIX fonts and implement XSLT wizardry to help
> FOP find all the glyphs, but this would involve some bending over
> backwards and jumping through hoops, so I thought I'd ask here if
> anybody might have some further insights concerning the TrueType
> weirdness.

You could also find out if there's another similar looking font that
fulfills your requirements.



Jeremias Maerki


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