Issue 358 in pdfium: pdfium can only use one fallback font at a time

212 views
Skip to first unread message

olsen@google.com via Monorail

unread,
Jan 11, 2016, 11:32:19 PM1/11/16
to pdfiu...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 358 by ol...@google.com: pdfium can only use one fallback font at
a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358

Steps to reproduce the problem:
1. View the following file:
http://www.gtp.or.kr/antp/upload/pds/%BA%E4%C6%BC%BB%EA%BE%F7.pdf
This file references one non-embedded font that supports both Latin
(English) characters and Hangul (Korean) characters.

2. Do so on a system that has Latin fallback fonts installed, and Hangul
fallback fonts installed, but has no font that supports both Latin and
Hangul. This might be hard to arrange.
Many android devices have only fonts like this, you can try to reproduce
this bug there using the Google PDF Viewer or Drive PDF Viewer app.

What is the expected behavior?
All characters of the PDF are rendered.

What went wrong?
At best, only Hangul characters are rendered (or worse, only Latin
characters are rendered).
This is because, as far as I can tell, pdfium replaces each missing font
with a single fallback font, and so doesn't interleave the different Hangul
and Latin fallback fonts in order to render every character in the document.

Did this work before? No

pdfium version: chromium/2614

Might be hard for to reproduce and work on - let me know if I can help in
some way.

--
You received this message because:
1. The project was configured to send all issue notifications to this
address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

thestig@chromium.org via Monorail

unread,
Jan 12, 2016, 12:39:31 AM1/12/16
to pdfiu...@googlegroups.com
Updates:
Cc: jun_f...@foxitsoftware.com

Comment #1 on issue 358 by thes...@chromium.org: pdfium can only use one
fallback font at a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358#c1

(No comment was entered for this change.)

olsen@google.com via Monorail

unread,
May 30, 2016, 2:09:55 AM5/30/16
to pdfiu...@googlegroups.com

Comment #2 on issue 358 by ol...@google.com: pdfium can only use one fallback font at a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358#c2

This is the rendering problem that our end-users report to us the most - can we increase the priority and find an owner?

dsinclair@chromium.org via Monorail

unread,
May 30, 2016, 10:34:15 AM5/30/16
to pdfiu...@googlegroups.com
Updates:
Cc: the...@chromium.org tse...@chromium.org

Comment #3 on issue 358 by dsin...@chromium.org: pdfium can only use one fallback font at a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358#c3


(No comment was entered for this change.)

carycl...@chromium.org via Monorail

unread,
Jun 27, 2016, 8:34:37 AM6/27/16
to pdfiu...@googlegroups.com

Comment #4 on issue 358 by cary...@chromium.org: pdfium can only use one fallback font at a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358#c4

With the experimental Skia backend enabled, this renders correctly. The fallback characters draw as expected.

dsincl…@chromium.org via Monorail

unread,
Jul 20, 2016, 4:10:43 PM7/20/16
to pdfiu...@googlegroups.com
Updates:
Owner: n...@chromium.org
Status: Started

Comment #5 on issue 358 by dsin...@chromium.org: pdfium can only use one fallback font at a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358#c5


(No comment was entered for this change.)

bugdro… via monorail

unread,
Aug 24, 2016, 2:24:18 PM8/24/16
to pdfiu...@googlegroups.com

Comment #6 on issue 358 by bugd...@chromium.org: pdfium can only use one fallback font at a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358#c6

The following revision refers to this bug:
https://pdfium.googlesource.com/pdfium.git/+/b107193e9780b4a50e85d54c1ffbd2303263e193

commit b107193e9780b4a50e85d54c1ffbd2303263e193
Author: npm
Date: Wed Aug 24 18:23:49 2016

Allow CPDF_Font to use fallback fonts

Added a vector of pointers to CFX_Fonts in the class CPDF_Font, so that
fallback fonts may be used. In CPDF_CharPosList::Load, the glyphs for each
character are calculated. When m_Font does not support a character, a fallback
font is selected and the character is rendered using that font. This meant
adding an attribute to FXTEXT_CHARPOS so it knows which font renders it.

Also, methods in fpdf_render_text.cpp now may need to call device drawing
methods multiple times because these only support one font at a time. In
CPDF_TextRenderer::DrawNormalText and in CPDF_TextRenderer::DrawTextPath, the
device drawing method is called as few times as possible by grouping contiguous
characters rendered by the same font. In
CPDF_RenderStatus::DrawTextPathWithPattern, drawing was already done one
character at a time, but precalculating CFX_FaceCache. Now, the face cache is
precalculated for all of the fallback fonts.

The list of fallback fonts does not include tha main font. Otherwise the list
would be of raw pointers to avoid double free problems. For now, the font
Arial is used as fallback. This should fix the issue of not seeing Latin
characters displayed when bad fonts are used. However, this should be improved.

Tested manually using the file in the bug, plus a font directory containing a
font that supports Hangul but not Latin. This font is chosen as the substitute
font, but Latin characters are now being rendered.

Design proposal: go/pdfium_fallbackfonts

BUG=pdfium:358

Review-Url: https://codereview.chromium.org/2276653002

[modify] https://crrev.com/b107193e9780b4a50e85d54c1ffbd2303263e193/core/fpdfapi/fpdf_font/cpdf_font.cpp
[modify] https://crrev.com/b107193e9780b4a50e85d54c1ffbd2303263e193/core/fpdfapi/fpdf_font/include/cpdf_font.h
[modify] https://crrev.com/b107193e9780b4a50e85d54c1ffbd2303263e193/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
[modify] https://crrev.com/b107193e9780b4a50e85d54c1ffbd2303263e193/core/fxge/include/cfx_renderdevice.h

n… via monorail

unread,
Aug 31, 2016, 10:44:37 AM8/31/16
to pdfiu...@googlegroups.com
Updates:
Status: Fixed

Comment #7 on issue 358 by n...@chromium.org: pdfium can only use one fallback font at a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358#c7

Manually tested that with the above change, the pdf viewer on Android now displays previously missing Latin characters on the pdf file of this bug. Thus, I'm closing this bug. I should note that there are still missing Hangul characters (I'm assuming because the font being used does not support these characters).
The change should be seen the next time pdfium is updated in google3.

n… via monorail

unread,
Jan 4, 2017, 12:23:44 PM1/4/17
to pdfiu...@googlegroups.com

Comment #8 on issue 358 by n...@chromium.org: pdfium can only use one fallback font at a time
https://bugs.chromium.org/p/pdfium/issues/detail?id=358#c8

Issue 638 has been merged into this issue.
Reply all
Reply to author
Forward
0 new messages