Bug 458476

Summary: [RFE] Support OpenType CFF fonts
Product: [Fedora] Fedora Reporter: Vasile Gaburici <gaburici>
Component: openoffice.orgAssignee: Caolan McNamara <caolanm>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dtardon, fonts-bugs, jnavrati
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-19 11:53:08 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
half assed patch to get started
none
upstreams version, targeted for 3.2 none

Description Vasile Gaburici 2008-08-08 14:15:42 EDT
Since it impacts a lot of Fedora users, I decided to open this bug to keep track of the upstream progress (or lack thereof) w.r.t. OpenType CFF font support. Note that OpenType fonts of the TrueType flavor are supported in OOo, only the PostScript Type 2 (CFF) variety are not. This pretty baffling, since PostScript Type 1 fonts are supported, and the conversion between the two formats is pretty straightforward.

I'm not sure what's the technical reason why OOo doesn't show CFF fonts in its menu. XeTeX, which also uses ICU, has no problem with them. It's true that Jonathan Kew modified ICU 4.0 to a certain extent for XeTeX's purposes. Perhaps someone that knows who to ping at Sun about this can take action...
Comment 1 Caolan McNamara 2008-08-08 19:43:56 EDT
You seem to suggest that there's an open upstream OOo bug for this, do you know the id for it ? And what fonts do we have in Fedora that can be used to test this ?
Comment 2 Vasile Gaburici 2008-08-08 20:31:21 EDT
(In reply to comment #1)
> You seem to suggest that there's an open upstream OOo bug for this, do you
> the id for it ? 

No CFF support:
http://qa.openoffice.org/issues/show_bug.cgi?id=78858
http://qa.openoffice.org/issues/show_bug.cgi?id=43029

Poor OpenType TT support:
http://qa.openoffice.org/issues/show_bug.cgi?id=78749
http://qa.openoffice.org/issues/show_bug.cgi?id=16032
http://qa.openoffice.org/issues/show_bug.cgi?id=79878

The cairo hack:
http://qa.openoffice.org/issues/show_bug.cgi?id=88613

> And what fonts do we have in Fedora that can be used to test this ?

All the CFF fonts that come with TeXLive: the Latin Modern family, the Gyre family and Antykwa ToruĊ„ska. They're packaged in texlive-texmf-fonts, but by some incredible oversight, they're not added to fontconfig's database, so most people outside the TeX world ignore their existence; see bug 456580. TeXLive 2008 has a few more, but due to a radical change in its installer the chances of seeing it in F10 are slim.

Also, all free fonts done in fontforge can be instantly exported to CFF since fontforge sfd natively stores cubic curves. We had pleas from font designers to quit preferring the TT format becuause it causes a lot more work for them; generating a usable TT font from sfd is a 10-step process; I can forward you the email with the steps...

Btw, you should probably add yourself to fedora-fonts-list. A decision has been made there to prefer OpenType CFF fonts in Fedora:
http://fedoraproject.org/wiki/Choosing_the_right_font_format_to_package
Comment 3 Caolan McNamara 2008-08-09 07:44:33 EDT
For http://qa.openoffice.org/issues/show_bug.cgi?id=79878, Condensed, Expanded, etc fonts are covered by bug #436520 which dtardon is working on.

OOo discovers fonts through fontconfig, so if fontconfig doesn't know about them then we don't have a chance to even get started on using them. But I'll have a look at what we could do to use them assuming that they would get found
Comment 4 Caolan McNamara 2008-08-09 08:37:55 EDT
Created attachment 313871 [details]
half assed patch to get started
Comment 5 Caolan McNamara 2008-08-09 09:32:59 EDT
Created attachment 313875 [details]
upstreams version, targeted for 3.2

so upstream already has that much for layout the font displaying it, what's missing is the printing and pdf export portion apparently
Comment 6 Vasile Gaburici 2008-08-09 13:01:02 EDT
(In reply to comment #3)
> For http://qa.openoffice.org/issues/show_bug.cgi?id=79878, Condensed, Expanded,
> etc fonts are covered by bug #436520 which dtardon is working on.
> 
> OOo discovers fonts through fontconfig, so if fontconfig doesn't know about
> them then we don't have a chance to even get started on using them. But I'll
> have a look at what we could do to use them assuming that they would get found

XeTeX, which uses fontconfig and ICU too, but has no problem finding them. There are two ways to name an OpenType fonts, a legacy name/style and a "preferred" (read new) name/style, which supports a lot of weights (ExtraLight etc.). XeTeX actually recognizes only the (new) preferred names, but this is by design [https://sourceforge.net/tracker/?func=detail&atid=951385&aid=2035832&group_id=194926]. So, you can't blame this on fontconfig; fc-list shows both the preferred and legacy names; the data structure has separate entries. XeTeX did have to patch ICU in some places (it uses a modified version), but I don't know if this has anything to do with font names. You can ask Jonathan Kew...
Comment 7 Caolan McNamara 2008-08-09 13:16:12 EDT
"if fontconfig doesn't know about them then we don't have a chance to even get started on using them." refers to there not being any .otf fonts in the default font dirs. Once they are added, then Patch #5 takes care of finding and using them for documents and on screen, with only font embedding for printing and pdf export then missing.
Comment 8 Vasile Gaburici 2008-08-09 13:34:47 EDT
(In reply to comment #5)
> Created an attachment (id=313875) [details]
> upstreams version, targeted for 3.2
> 
> so upstream already has that much for layout the font displaying it, what's
> missing is the printing and pdf export portion apparently

A problem solved a couple of year back in XeTeX. The solution is not ideal, but works ok in practice: CFF fonts get converted on the fly to CID-keyed Type 1 fonts (/CIDFontType0); the embedding does not use a /FontFile3 Subtype key, which is the direct way to embed a CFF font in a PDF.
Comment 9 Vasile Gaburici 2008-08-09 14:06:49 EDT
(In reply to comment #8)
> (In reply to comment #5)
> > Created an attachment (id=313875) [details] [details]
> > upstreams version, targeted for 3.2
> > 
> > so upstream already has that much for layout the font displaying it, what's
> > missing is the printing and pdf export portion apparently
> 
> A problem solved a couple of year back in XeTeX. The solution is not ideal, but
> works ok in practice: CFF fonts get converted on the fly to CID-keyed Type 1
> fonts (/CIDFontType0); the embedding does not use a /FontFile3 Subtype key,
> which is the direct way to embed a CFF font in a PDF.

Correction: XeTeX does embed CFF fonts without conversion. I was confused because the /Subtype key comes after the (long) /CIDSet business, and it uses /Subtype/CIDFontType0C for /FontFile3, not /Subtype/OpenType. The reason why XeTeX uses /CIDFontType0C is that the /OpenType subtype requires PDF-1.6, while
/CIDFontType0C works in PDF-1.3, which is what XeTeX (xdvipdfmx actually) outupts.

To further add to the confusion, evince displays CFF fonts embedded with /CIDFontType0C as "Type 1C (CID)" in the font info box, while pdffonts lists them as "CID Type 0C".
Comment 10 Vasile Gaburici 2008-08-09 14:13:11 EDT
(In reply to comment #9)
> 
> Correction: XeTeX does embed CFF fonts without conversion. I was confused
> because the /Subtype key comes after the (long) /CIDSet business, and it uses
> /Subtype/CIDFontType0C for /FontFile3, not /Subtype/OpenType. The reason why
> XeTeX uses /CIDFontType0C is that the /OpenType subtype requires PDF-1.6, while
> /CIDFontType0C works in PDF-1.3, which is what XeTeX (xdvipdfmx actually)
> outupts.
> 
> To further add to the confusion, evince displays CFF fonts embedded with
> /CIDFontType0C as "Type 1C (CID)" in the font info box, while pdffonts lists
> them as "CID Type 0C".

Addendum: if one actually wants to include a CFF font *without* a CID table, then PDF-1.6 is a must because /Subtype/OpenType is the only correct description for it. The PDF spec is mess when in comes to fonts...
Comment 11 Caolan McNamara 2008-08-30 11:59:35 EDT
hdu tells me that he has this working, and scheduled for 3.1
Comment 12 Caolan McNamara 2009-08-19 11:53:08 EDT
ok, fixed upstream for 3.2. Tricky to backport, so setting as closed->upstream and we'll pick it up when we move to 3.2