Bug 107812 - LibreOffice pdfimport and ipdf filter not picking up Italic or Bold+Italic for Type1 PS fonts
Summary: LibreOffice pdfimport and ipdf filter not picking up Italic or Bold+Italic fo...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.2.5.1 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:5.4.0
Keywords:
Depends on:
Blocks: PDF-Import-Draw
  Show dependency treegraph
 
Reported: 2017-05-13 00:20 UTC by jserock
Modified: 2021-07-13 07:00 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Test PDF document using different styles of Helvetica font (1.25 KB, application/pdf)
2017-05-13 00:26 UTC, jserock
Details
Shows font properties of test PDF attachment (51.47 KB, image/png)
2017-05-13 02:01 UTC, jserock
Details
Shows how LibreOffice Draw formats Helvetica Bold text correctly (124.49 KB, image/png)
2017-05-14 12:26 UTC, jserock
Details
Shows how LibreOffice Draw formats Helvetica Oblique text incorrectly (126.30 KB, image/png)
2017-05-14 12:28 UTC, jserock
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jserock 2017-05-13 00:20:14 UTC
Description:
When LibreOffice Draw opens a PDF document having text with the Helvetica-Oblique or Helvetica-BoldOblique fonts, the font family chosen is HelveticaOblique rather than Helvetica and the style chosen is Regular rather than Italic or Bold Italic. Consequently, text in the Draw document that should be formatted as Italic or Bold Italic is not.

Steps to Reproduce:
1. Open with LibreOffice Draw a PDF document that uses the Helvetica-Oblique font.
2. Select some text characters in the Draw document that should be formatted using the Helvetica-Oblique font.
3. Go to Format > Character... to see the font family and style of the selected text.

Actual Results:  
When characters in the Helvetica-Oblique font are selected, the font family is shown as HelveticaOblique and the style is shown as Regular.

When characters in the Helvetica-BoldOblique font are selected, the font family is shown as HelveticaOblique and the style is shown as Bold.

Expected Results:
When characters in the Helvetica-Oblique font are selected, the font family should be shown as Helvetica and the style shown as Italic.

When characters in the Helvetica-BoldOblique font are selected, the font family should be shown as Helvetica and the style shown as Bold Italic.


Reproducible: Always

User Profile Reset: No

Additional Info:
The issue was first observed on openSUSE 42.2 Linux.
The same issue occurs in LibreOffice 5.3.3.2 (x64) on Windows 10.


User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Comment 1 jserock 2017-05-13 00:26:08 UTC
Created attachment 133284 [details]
Test PDF document using different styles of Helvetica font

When the PDF document is opened in LibreOffice Draw, none of the displayed text is formatted as italic.
Comment 2 m_a_riosv 2017-05-13 01:35:38 UTC
Clicking on the text the right Font name is showed on the side bar, but I have not installed those fonts, and those fonts are not embedded on the pdf.

Have you those fonts installed?
Comment 3 jserock 2017-05-13 02:01:59 UTC
Created attachment 133285 [details]
Shows font properties of test PDF attachment
Comment 4 jserock 2017-05-13 02:03:13 UTC
(In reply to m.a.riosv from comment #2)

No, I don't have the fonts installed. The Helvetica, Helvetica-Bold, Helvetica-Oblique, and Helvetica-BoldOblique fonts are in the set of the 14 standard fonts (see https://en.wikipedia.org/wiki/Portable_Document_Format#Standard_Type_1_Fonts_.28Standard_14_Fonts.29).

The Evince Document Viewer on openSUSE 42.2 Linux substitutes the Helvetica fonts with Nimbus Sans L fonts as shown in the document-viewer-font-properties.png attachment.
Comment 5 m_a_riosv 2017-05-13 12:08:53 UTC
Remember that LibreOffice it's not a pdf reader, the purpose for open the pdf in draw it's allow a basic editing on the pdf.

You can set up the font substitution on Menu/Tools/Options/LibreOffice/Fonts

But IMO there is not a bug in LibreOffice.
Comment 6 jserock 2017-05-14 12:12:04 UTC
(In reply to m.a.riosv from comment #5)

I'm not really trying to use LibreOffice as a PDF viewer. I have quite a few multi-page PDF documents that I want to edit with LibreOffice Draw to remove some personal information. After editing each document, I want to export it back to a PDF. I need the text in the exported PDF to have the same styles (bold, italic, etc.) as the original PDF. I don't want to have to determine which text in the original document was italicized and manually change the text style to be italicized in LibreOffice Draw before exporting as PDF; that's too much manual effort.

I have tried to use the font substitution feature in LibreOffice to substitute the HelveticaOblique font with another font, but I have not been successful in getting the font substitution to apply the italic/oblique style.

Being that LibreOffice Draw handles Helvetica-Bold correctly by using the Helvetica font family and the bold style, I think that LibreOffice Draw should be able to handle Helvetica-Oblique correctly by using the italic style. That's why I think this is a bug.

I'll try to show how Helvetica Bold and Helvetica Oblique are handled inconsistently in LibreOffice Draw by attaching two screen shots.
Comment 7 jserock 2017-05-14 12:26:37 UTC
Created attachment 133309 [details]
Shows how LibreOffice Draw formats Helvetica Bold text correctly

To create the screen shot, I opened the attached helvetica.pdf document in LibreOffice Draw and selected "vet" in the text "Helvetica Bold". Then I selected Format > Character... from the main menu.

The screen shot shows that the selected text ("vet") is correctly formatted with the Helvetica font family and the Bold style.
Comment 8 jserock 2017-05-14 12:28:53 UTC
Created attachment 133310 [details]
Shows how LibreOffice Draw formats Helvetica Oblique text incorrectly

To create the screen shot, I opened the attached helvetica.pdf document in LibreOffice Draw and selected "vet" in the text "Helvetica Oblique". Then I selected Format > Character... from the main menu.

The screen shot shows that the selected text ("vet") is incorrectly formatted with the HelveticaOblique font family and the Regular style.
The selected text should be formatted with the Helvetica font family and the Italic style.
Comment 9 V Stuart Foote 2017-05-14 14:34:21 UTC
Actually Helvectica and HelveticaObligue are going to be replaced anyway.

And this looks to be an issue with the font substitution logic losing the Italic and Bold+Italic attribute of the replacement font being assigned.

This also affects the ipdf filter.

=-ref-=
http://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/wrapper/wrapper.cxx?#466


Note: that support for Type1 PS and Bitmap fonts has been removed at 5.3

Meaning that even if installed none of the these fonts will even show in the GUI to be able to use a font substitution.  The Font list for the Style in the Properties deck does continue to show that the font is being substituted.
Comment 10 Caolán McNamara 2017-05-15 12:43:21 UTC
possibly sdext/source/pdfimport/wrapper/wrapper.cxx where we look for -LightOblique and -BoldOblique but not -Oblique
Comment 11 Commit Notification 2017-05-15 15:29:23 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=32cb3760a9d7742763fc8610db01689fdb719780

Resolves: tdf#107812 add check for -Oblique

It will be available in 5.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 12 V Stuart Foote 2017-05-16 03:24:12 UTC
Confirmed fixed on Windows 10 Pro 64-bit en-US with
Version: 5.4.0.0.alpha1+
Build ID: 774f033f86b3728123842321f21b10b400cf6b9a
CPU threads: 8; OS: Windows 6.19; UI render: GL; 
TinderBox: Win-x86@39, Branch:master, Time: 2017-05-16_02:20:51
Locale: en-US (en_US); Calc: CL

The Helvetica-Oblique is picked up with substitute font as Italic style. The Helvetica-BoldOblique is picked up with substitute font as Bold + Italic style.

On this Windows build font substitution is LiberationSans, Bold, BoldItalic and Italic.
Comment 13 jserock 2017-05-17 08:15:00 UTC
Thank you all for fixing this issue.

For what it's worth, I tested the fix on openSUSE Leap 42.2 64-bit and confirmed the fix is working.

Version: 5.4.0.0.alpha1+
Build ID: 666901bc82fab69f9a80b564f97b5456d0ef684e
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2017-05-16_03:33:45
Locale: en-US (en_US.UTF-8); Calc: group