Bug 145061 - Font::identifyFont should also detect Type1C font
Summary: Font::identifyFont should also detect Type1C font
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Depends on:
Blocks: Font-Rendering PDF-Import-Draw
  Show dependency treegraph
Reported: 2021-10-11 08:00 UTC by Kevin Suo
Modified: 2023-06-06 13:17 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

CairoFont-1-0-italic.data (986 bytes, application/octet-stream)
2021-10-14 05:17 UTC, Kevin Suo
CairoFont-3-0-bold-italic.data (1.36 KB, application/octet-stream)
2021-10-14 05:18 UTC, Kevin Suo

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2021-10-11 08:00:09 UTC
This is a split bug from bug 78427:

To correctly parse attachment 98668 [details] during sdext.pdfimport, we need to be able to detect Type 1C font.

My understanding is that currently LibreOffice can only detect TrueType font and Type 1 font, but can not detect Type 1C (i.e. Type 1 Compacted) font.
See: vcl/source/font/font.cxx, where in line 616 it is identifyTrueTypeFont, and in line 720 it is identifyType1Font. These two member functions are used in identifyFont in line 806. The proposal is to add an identifyType1CompactedFont there to detect the attributes such as font name, weight, italic for Type 1C font.

Steps to Reproduce:
1. Open attachment 98668 [details] with Draw.

"Bold text" should be bold, while "Bold italic text" should be bold+italic.

Specifications of Compact Font Format can be found in:

As a comparison the specifications of Type 1 Font Format can be found in:
Comment 1 Kevin Suo 2021-10-14 05:17:45 UTC
Created attachment 175726 [details]

The CairoFont-1-0 (italic) font extracted from the pdf file in attachment 98668 [details].
Comment 2 Kevin Suo 2021-10-14 05:18:50 UTC
Created attachment 175727 [details]

The CairoFont-3-0 (bold italic) font extracted from the pdf file in attachment 98668 [details].
Comment 3 Roman Kuznetsov 2022-05-20 20:34:53 UTC
Kevin, LO has dropped Type1 font support in 2016 year


Below is some excerpt:

* Bitmap fonts on Windows (Michael)
    + no good physical font API on Windows
       + DirectWrite provides one.
       + doesn't work with Bitmap Fonts.
    + Office 2013 dropped bitmap / Type1 fonts and more long ago.
    + Biting us with Harfbuzz in some cases.
    + https://bugs.documentfoundation.org/show_bug.cgi?id=103514
    + an issue for the WinXP support (Cloph)
       + Harfbuzz doesn't support that.
         (and will not support Type1 fonts)
       + 5.3 will be the last with current rendering
       + see no point in also support bitmap fonts in 5.4
       + thought Khaled pushed a patch to make it work on WinXP (Caolan)
           + but happy to loose bitmap fonts.
       + we get a fallback font anyway (Michael)
    => abandoning bitmap / Type 1 fonts etc. if not DirectWrite supported in future.

So I'm not sure about your suggestion...
Comment 4 ⁨خالد حسني⁩ 2023-06-06 13:17:33 UTC
Type 1C is CFF fonts, there are not plain text so code handling Type 1 fonts will not be of any use. Not going to happen, I’m afraid.