Bug 126242 - CFF glyphs with fractional coordinates gets distorted when embedded in PDF
Summary: CFF glyphs with fractional coordinates gets distorted when embedded in PDF
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: ⁨خالد حسني⁩
URL:
Whiteboard: target:7.5.0 target:7.4.3 inReleaseNo...
Keywords:
: 99114 105979 (view as bug list)
Depends on:
Blocks: Font-Rendering PDF-Export
  Show dependency treegraph
 
Reported: 2019-07-05 11:14 UTC by medmedin2014
Modified: 2023-03-18 18:31 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:


Attachments
OTF Wrong drawings in exported pdf (104.70 KB, application/x-xz)
2019-07-05 11:21 UTC, medmedin2014
Details
source odt + pdf output + version + fonts (230.58 KB, application/x-xz)
2019-07-06 11:44 UTC, medmedin2014
Details
Scribus sample (40.74 KB, application/pdf)
2019-07-06 11:59 UTC, medmedin2014
Details
Font distortion (1.47 MB, application/zip)
2023-03-14 14:41 UTC, medmedin2014
Details
letter "v" (230.96 KB, image/png)
2023-03-18 15:17 UTC, medmedin2014
Details
PDF exported from 7.5 (3.75 KB, application/pdf)
2023-03-18 16:38 UTC, ⁨خالد حسني⁩
Details
Letter "v" (102.30 KB, image/png)
2023-03-18 17:57 UTC, medmedin2014
Details
Letter v in Chrome, Acrobat Reader, Firefox, Master PDF Editor, Inkscape, and FontForge (1.70 MB, image/png)
2023-03-18 18:19 UTC, ⁨خالد حسني⁩
Details

Note You need to log in before you can comment on or make changes to this bug.
Description medmedin2014 2019-07-05 11:14:33 UTC
Description:
I tried to use EBGaramond otf fonts in writer, but when I export to pdf, some letters have error in shapes, I tried the same font with Scribus and Microsoft word but the exported pdf look perfect without errors.

Steps to Reproduce:
1- Open writer
2- Write some text with ebgramond font, and type some capital letters like N, M, T, F, Z
3- export to pdf
4- open pdf with some viewer and zoom letters to maximum

Actual Results:
some letters have wrong shapes and are corrupted

Expected Results:
All letters should look fine


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Comment 1 medmedin2014 2019-07-05 11:21:18 UTC
Created attachment 152576 [details]
OTF Wrong drawings in exported pdf
Comment 2 Roman Kuznetsov 2019-07-06 07:55:59 UTC
Please:
1. Attach your EBGaramond font here
2. Attach sample document in ODT format
3. Add info from Help->About dialog
Comment 3 medmedin2014 2019-07-06 11:44:47 UTC
Created attachment 152597 [details]
source odt + pdf output + version + fonts

Here's the font and the odt file plus the output pdf with screenshot of writer version.
Comment 4 medmedin2014 2019-07-06 11:59:26 UTC
Created attachment 152598 [details]
Scribus sample

And here's a sample of scribus pdf output using the same font, another remark is that writer deforms the output shape of font letters, they are not like scripus output.
Comment 5 QA Administrators 2019-07-07 03:41:04 UTC Comment hidden (noise)
Comment 6 Dieter 2019-10-19 09:51:52 UTC
I confirm it with

Version: 6.3.3.1 (x64)
Build-ID: f41f4c7f9507aeca13cb9df51f34d80e8ba30a99
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: threaded
Comment 7 V Stuart Foote 2019-10-19 13:38:19 UTC
This is a dupe of bug 99114 or bug 105979 where in https://bugs.documentfoundation.org/show_bug.cgi?id=105979#c12 Khaled notes "our subsetter does not support producing CFF fonts" and we get difference between PDF generated by gs printing (embedding CFF font) and our PDF export (embedding PS Type1 font).

Per 105979 this is inherited from OOo where Herbert Dürr (who implmented the CFF -> PS Type1 subsetting) comments in https://bz.apache.org/ooo/show_bug.cgi?id=43029#c88 

Caolán's https://gerrit.libreoffice.org/#/c/47607/ for bug 114704 looks to not have fully resolved issue of bug 105979 but maybe on the right track

Guess the question might be if now, 10 years on, we can fully move to CFF and drop the Type1 subsetting altogether?
Comment 8 V Stuart Foote 2019-10-19 13:39:02 UTC
*** Bug 99114 has been marked as a duplicate of this bug. ***
Comment 9 V Stuart Foote 2019-10-19 13:39:26 UTC
*** Bug 105979 has been marked as a duplicate of this bug. ***
Comment 10 QA Administrators 2022-04-22 04:01:49 UTC Comment hidden (noise)
Comment 11 sommerluk 2022-04-22 09:35:42 UTC
This bug is still present in

Version: 7.2.6.2 / LibreOffice Community
Build ID: 20(Build:2)
CPU threads: 8; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Ubuntu package version: 1:7.2.6-0ubuntu0.21.10.1
Calc: threaded
Comment 12 medmedin2014 2022-04-23 00:38:10 UTC
Repro on:

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: e4243a140345a4bcd800217115b42667e277c6a3
CPU threads: 2; OS: Linux 5.17; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 13 Commit Notification 2022-09-13 15:37:23 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a387f39de8e59d7542b74962242504b798af1362

tdf#126242: Handle fractional values when subsetting CFF

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2022-10-15 20:39:43 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/81fe821cc30a6746636350d78b4fdd88839dc21c

tdf#126242: Handle fractional values when subsetting CFF

It will be available in 7.4.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Stéphane Guillou (stragu) 2022-12-08 14:28:35 UTC
Fix verified in:

Version: 7.5.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: ad085990b8073a122ac5222e5220f8f1d6826dcf
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Thanks Khaled!
Comment 16 medmedin2014 2023-03-14 14:40:33 UTC
Many characters were fixed, but some are still having minor issues in the output PDF. See attached new file.

Version: 7.5.0.3 (X86_64) / LibreOffice Community
Build ID: 50(Build:3)
CPU threads: 2; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
7.5.0-1
Calc: threaded

Operating System: Manjaro Linux
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.12-1-MANJARO (64-bit)
Graphics Platform: X11
Comment 17 medmedin2014 2023-03-14 14:41:51 UTC
Created attachment 185953 [details]
Font distortion
Comment 18 ⁨خالد حسني⁩ 2023-03-14 18:06:19 UTC
This is a different font and a different issue than the original report (specifically, these glyphs do not use fractional coordinates). Please open a new issue.
Comment 19 medmedin2014 2023-03-18 15:16:03 UTC
I tried to verify the basic 26 letters, only the letter "v" still have a problem.
Comment 20 medmedin2014 2023-03-18 15:17:07 UTC
Created attachment 186050 [details]
letter "v"
Comment 21 ⁨خالد حسني⁩ 2023-03-18 16:38:03 UTC
Created attachment 186051 [details]
PDF exported from 7.5

(In reply to medmedin2014 from comment #20)
> Created attachment 186050 [details]
> letter "v"

I can reproduce this. Lower case v looks fine in PDF and the font extracted from PDF looks fine in FontForge.
Comment 22 ⁨خالد حسني⁩ 2023-03-18 17:03:49 UTC
(In reply to خالد حسني from comment #21)
> Created attachment 186051 [details]
> PDF exported from 7.5
> 
> (In reply to medmedin2014 from comment #20)
> > Created attachment 186050 [details]
> > letter "v"
> 
> I can reproduce this. Lower case v looks fine in PDF and the font extracted
> from PDF looks fine in FontForge.

I *can’t* reproduce.
Comment 23 medmedin2014 2023-03-18 17:57:53 UTC
Created attachment 186052 [details]
Letter "v"

I opened your attached pdf with Firefox and Chromium built-in PDF readers, and with Okular (poppler based) and all show a distortion in letter "v", only MuPDF reader shows correctly the letter.
Comment 24 ⁨خالد حسني⁩ 2023-03-18 18:19:30 UTC
Created attachment 186054 [details]
Letter v in Chrome, Acrobat Reader, Firefox, Master PDF Editor, Inkscape, and FontForge

I tested with Letter v in Chrome, Acrobat Reader, Firefox, Master PDF Editor, Inkscape, and extracted the font from PDF and opened it on FontForge. I can only reproduce with Inkscape and another tool (not shown here) that uses FreeType, so my guess would be a bug in FreeType and I suggest you report the issue there (you can extract the font from the PDF with “mutool extract”).
Comment 25 ⁨خالد حسني⁩ 2023-03-18 18:20:52 UTC
If you get any evidence from FreeType developers that this is a LibreOffice bug, please re-open.
Comment 26 ⁨خالد حسني⁩ 2023-03-18 18:31:12 UTC
You can also test the extracted font with ftview. The issue is reproducible when hinting is off (press h to toggle hinting on/off).