Bug 143959 - PDF import do not take embedded fonts
Summary: PDF import do not take embedded fonts
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.2.0.4 release
Hardware: All All
: low minor
Assignee: Kevin Suo
URL:
Whiteboard: target:7.3.0 target:7.2.1
Keywords: bibisected, bisected, regression
Depends on:
Blocks: PDF-Import-Draw
  Show dependency treegraph
 
Reported: 2021-08-19 20:27 UTC by Gabriel Dorante
Modified: 2021-10-11 07:09 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
PDF file generated with Crystal Reports (62.50 KB, application/pdf)
2021-08-19 20:28 UTC, Gabriel Dorante
Details
PDF file displayed in Adobe Reader (96.81 KB, image/png)
2021-08-19 20:28 UTC, Gabriel Dorante
Details
PDF file displayed in LibreOffice 7.1 (76.35 KB, image/png)
2021-08-19 20:30 UTC, Gabriel Dorante
Details
PDF file displayed in LibreOfficeDev 7.3 and also in 7.2 release (73.63 KB, image/png)
2021-08-19 20:31 UTC, Gabriel Dorante
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel Dorante 2021-08-19 20:27:04 UTC
Description:
A PDF file generated with Crystal Reports with embedded fonts, is displayed with different fonts when imported by LO Draw 7.2 ++

Steps to Reproduce:
1.Find a PDF file generated with Crystal Reports (attached)
2.Open it with LibreOffice 7.2 or recent build
3.File is displayed with different fonts

Actual Results:
File is displayed with different fonts, fonts combo box shows wrong font name

Expected Results:
File must be displayed with same fonts like in any PDF Viewer, Adobe Reader or earlier versions of LibreOffice (7.1 and earlier)


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: f58f35b2c8ca1efbacec642a8f3de5b0c499bc6b
CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: es-MX (es_MX); UI: es-ES
Calc: CL
Comment 1 Gabriel Dorante 2021-08-19 20:28:11 UTC
Created attachment 174429 [details]
PDF file generated with Crystal Reports
Comment 2 Gabriel Dorante 2021-08-19 20:28:58 UTC
Created attachment 174430 [details]
PDF file displayed in Adobe Reader
Comment 3 Gabriel Dorante 2021-08-19 20:30:55 UTC
Created attachment 174431 [details]
PDF file displayed in LibreOffice 7.1
Comment 4 Gabriel Dorante 2021-08-19 20:31:54 UTC
Created attachment 174432 [details]
PDF file displayed in LibreOfficeDev 7.3 and also in 7.2 release
Comment 5 Timur 2021-08-20 07:12:58 UTC
Seems duplicate. Please search before reporting.

*** This bug has been marked as a duplicate of bug 82163 ***
Comment 6 Gabriel Dorante 2021-08-20 13:01:27 UTC
(In reply to Timur from comment #5)
> Seems duplicate. Please search before reporting.
> 
> *** This bug has been marked as a duplicate of bug 82163 ***

I do not consider this bug as a duplicated of bug 82163, the older bug was present in earlier versions of LibreOffice and was previously fixed as you can see in my LO 7.1 screenshot attachment, so my bug seems as a regresion
Comment 7 Timur 2021-08-20 14:45:13 UTC
"TimesNewRoman" italic is also not a good font. 

But let's go for a change in 7.2:
commit 78d231e25e0984a98622cfc5da7ec26677cd75c2
Date:   Fri Jul 23 15:34:36 2021 +0200
    source sha:0ebe806d011b7084b49dd038f3521a03bc935f8c
    pre sha:4b5dd477bbe1647c6c60374da2e4cabcf5b6b58b

commit 0ebe806d011b7084b49dd038f3521a03bc935f8c	[log]
author	Kevin Suo <suokunlong@126.com>	Sat Jul 17 14:25:45 2021 +0800
committer	Adolfo Jayme Barrientos <fitojb@ubuntu.com>	Fri Jul 23 14:53:03 2021 +0200
tree e6c0e7aaf2507607709759464b3f991b6679b6c0
parent 4b5dd477bbe1647c6c60374da2e4cabcf5b6b58b [diff]

sdext.pdfimport: Restore to read font file for the determination...

of font attributes, as suggested by Mike Kaganski in
https://gerrit.libreoffice.org/c/core/+/118977

This partially reverts da59686672fd2bc98f8cb28d5f04dc978b50ac13
but did some modification of the previous code with some
explanationary comments.

HI Kevin, please see this.
Comment 8 Kevin Suo 2021-08-21 00:59:05 UTC
(In reply to Timur from comment #7)
Timur and Gabriel Dorante, if I am understanding correct, this now works correct on master builds (i.e., fonts are shown as "TimesNewRoman" and thus is correctly applied as Times New Roman font by the system), but is broken in 7.2 build (i.e., fonts are shown as "AAAAAA+TimesNewRoman")?
Comment 9 Timur 2021-08-21 07:04:43 UTC
I'm not by computer, but I think not correct in 7.3, fonts shown as  as "AAAAAA+TimesNewRoman". 
This was never Ok, even when fonts were previously shown as  as "TimesNewRoman" they were italic, indicating that font was missing and replaced.
Comment 10 Kevin Suo 2021-08-21 10:19:44 UTC
I've submitted a patch in
https://gerrit.libreoffice.org/c/core/+/120815

Please build and review if it works ok with this patch.
Comment 11 Kevin Suo 2021-08-21 10:49:41 UTC
(In reply to Timur from comment #9)
> even when fonts were previously shown as  as "TimesNewRoman" they were italic, indicating that font was missing and replaced.

The font name showning as "TimesNewRoman" rather than "Times New Roman" is a separate issue as explained in bug 143095. However, currently if the font is "TimesNewRoman" in most systems it can be correctly rendered (i.e., substituted) as "Times New Roman", thus this is not a big deal.
Comment 12 Commit Notification 2021-08-22 08:30:25 UTC
Kevin Suo committed a patch related to this issue.
It has been pushed to "master":

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

tdf#143959 sdext.pdfimport: fix font name with subtag

It will be available in 7.3.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 13 Kevin Suo 2021-08-22 14:53:17 UTC
Fixed on master, backport to 7.2 branch pending review:
https://gerrit.libreoffice.org/c/core/+/120848

Please do help to test to make sure it works without any side effects. If you encounter any issue related to this fix, please comment here.
Comment 14 Gabriel Dorante 2021-08-23 18:11:20 UTC
(In reply to Kevin Suo from comment #8)
> (In reply to Timur from comment #7)
> Timur and Gabriel Dorante, if I am understanding correct, this now works
> correct on master builds (i.e., fonts are shown as "TimesNewRoman" and thus
> is correctly applied as Times New Roman font by the system), but is broken
> in 7.2 build (i.e., fonts are shown as "AAAAAA+TimesNewRoman")?

No, It works correct in 7.1.x builds but is broken in 7.2.x and 7.3.x bulds
Comment 15 Timur 2021-08-24 06:53:37 UTC
Gabriel, it's already fixed, the font name showing as "TimesNewRoman" . It's still italic, meaning replaced, which is another issue.
You may test with master from https://dev-builds.libreoffice.org/daily/master/current.html. It installs in addition to your working LO.
Comment 16 Commit Notification 2021-08-25 13:09:47 UTC
Kevin Suo committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/7c2d2f8fbc8b5751121c7c69dbc0f764ec4cc35e

tdf#143959 sdext.pdfimport: fix font name with subtag

It will be available in 7.2.1.

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 17 Commit Notification 2021-10-11 07:09:27 UTC
Kevin Suo committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2d486bac81e06c64d13c647f35d3f4affbeb183e

tdf#143959 sdext.pdfimport: call vcl::Font::identifyFont directly

It will be available in 7.3.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.