Open Bug 1539074 Opened 5 years ago Updated 4 months ago

Transformed fonts display badly in PDF

Categories

(Firefox :: PDF Viewer, defect, P3)

60 Branch
Unspecified
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mike, Unassigned, NeedInfo)

Details

(Whiteboard: [pdfjs-font-conversion])

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

Steps to reproduce:

View PDF file containing transformed font, prepared using ExtendFont in pdfTeX to condense the glyphs

Actual results:

The height as well as the width of characters is reduced

Expected results:

Reduction in width only, as seen when viewing the same file with Evince

Component: Untriaged → PDF Viewer
Has STR: --- → yes

Looks fine on MacOS, but I do see the issue on Linux.

OS: Unspecified → Linux
Priority: -- → P3
Whiteboard: [pdfjs-c-font-conversion]

FYI, I also see the issue on Linux with Debian's firefox 95.0.1-1 package.

Whiteboard: [pdfjs-c-font-conversion] → [pdfjs-font-conversion]
Severity: normal → S3

The same issue applies to Thunderbird 102 and Firefox-109. Font display for transformed fonts in PDF is ugly.

Setting
browser.display.use_document_fonts = 0
fixes the problem, but other users report, that this caused font problems in HTML display.

Duplicate of this bug: 1796997
No longer duplicate of this bug: 1796997

Just for the record, this is still happening in Nightly 117.0a1, 20230725211415. The workaround with browser.display.use_document_fonts = 0 also works.

It's a bit strange, it wfm on Windows and Mac, I can reproduce the issue on Fedora.
The font used for the second sequence of "x" is a type 1 font and it starts with:

%!PS-AdobeFont-1.1: LucidaTypewriter 1.002
%%CreationDate: 1994 Nov 12 10:47:10
% Bigelow & Holmes, Inc. Pat. Des. 289,422
% Lucida is a registered trademark of Bigelow & Holmes Inc.
11 dict begin
/FontInfo 9 dict dup begin
/version (1.002) readonly def
/Notice (Copyright (c) 1993, 1994 Bigelow & Holmes and Y&Y, Inc. http://www.YandY.com All Rights Reserved.) readonly def
/FullName (Lucida Typewriter) readonly def
/FamilyName (LucidaTypewriter) readonly def
/Weight (Medium) readonly def
/ItalicAngle 0 def
/isFixedPitch true def
/UnderlinePosition -100 def
/UnderlineThickness 50 def
end readonly def
/FontName /URXDVG+LucidaTypewriter-Extend_850 def
/PaintType 0 def
/FontType 1 def
/FontMatrix [0.00085 0 0 0.001 0 0 ] readonly def

In pdf.js, the font is wrapped in a CFF font and we correctly set the matrix transformation:
https://github.com/mozilla/pdf.js/blob/a2eca47ed1882c0c5c59b1943ca1e9333397a49e/src/core/type1_font.js#L340

Out of curiosity, I changed 0.00085 to 0.000085 and on Windows I can see a thin "x" but the same height the first ones, but on Fedora nothing I can see is displayed.
Maybe the min of the x-scale and y-scale factors is taken to adjust the font size... I don't know but it's very likely an issue in FreeType.

:jfkthame, maybe you'd know what be could wrong here.

Flags: needinfo?(jfkthame)
You need to log in before you can comment on or make changes to this bug.