Bug 438454 - Scatter plots from R are not shown incorrectly
Summary: Scatter plots from R are not shown incorrectly
Status: RESOLVED NOT A BUG
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 21.04.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-11 08:47 UTC by Oleksandr Ostrenko
Modified: 2021-06-13 05:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
sample plot (5.29 KB, application/pdf)
2021-06-11 08:47 UTC, Oleksandr Ostrenko
Details
file->properties->fonts (38.95 KB, image/png)
2021-06-12 08:34 UTC, Oleksandr Ostrenko
Details
issue (37.60 KB, image/png)
2021-06-12 08:36 UTC, Oleksandr Ostrenko
Details
file->properties->fonts 2 (42.85 KB, image/png)
2021-06-12 08:44 UTC, Oleksandr Ostrenko
Details
works (62.11 KB, image/png)
2021-06-12 11:49 UTC, Oleksandr Ostrenko
Details
Fonts that work (29.61 KB, image/png)
2021-06-12 13:00 UTC, Yuri Chornoivan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleksandr Ostrenko 2021-06-11 08:47:03 UTC
Created attachment 139225 [details]
sample plot

SUMMARY
Scatter plots produced in R are not show in okular or qpdfview, but it works in MuPDF or Atril (see attachment).

STEPS TO REPRODUCE
1. Open a PDF produced by R

OBSERVED RESULT
Observe the empty plot

EXPECTED RESULT
Observe the scatter plot

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Leap 15.2
KDE Plasma Version: 5.18.6
KDE Frameworks Version: 5.71.0
Qt Version: 5.12.7

ADDITIONAL INFORMATION
Poppler 21.05.0
Comment 1 Yuri Chornoivan 2021-06-11 08:59:07 UTC
Cannot confirm this bug in Okular 21.07.70 (poppler 20.12.1). The document is rendered as expected.
Comment 2 Albert Astals Cid 2021-06-11 20:13:35 UTC
Wroks here too, i guess it's another issue of the wrong font being substituted, can you attach a capture of the file->properties->fonts dialog?
Comment 3 Oleksandr Ostrenko 2021-06-12 08:33:52 UTC
(In reply to Albert Astals Cid from comment #2)
> Wroks here too, i guess it's another issue of the wrong font being
> substituted, can you attach a capture of the file->properties->fonts dialog?

Sure, it's attached.
Comment 4 Oleksandr Ostrenko 2021-06-12 08:34:21 UTC
Created attachment 139244 [details]
file->properties->fonts
Comment 5 Oleksandr Ostrenko 2021-06-12 08:36:24 UTC
Created attachment 139245 [details]
issue
Comment 6 Yuri Chornoivan 2021-06-12 08:39:33 UTC
(In reply to Oleksandr Ostrenko from comment #3)
> (In reply to Albert Astals Cid from comment #2)
> > Wroks here too, i guess it's another issue of the wrong font being
> > substituted, can you attach a capture of the file->properties->fonts dialog?
> 
> Sure, it's attached.

Can you try to remove texlive-tex-gyre-fonts (and install some Helvetica font, e.g. LiberationSans) temporarily?

Thanks in advance for your answer.
Comment 7 Oleksandr Ostrenko 2021-06-12 08:44:30 UTC
(In reply to Yuri Chornoivan from comment #6)
> (In reply to Oleksandr Ostrenko from comment #3)
> > (In reply to Albert Astals Cid from comment #2)
> > > Wroks here too, i guess it's another issue of the wrong font being
> > > substituted, can you attach a capture of the file->properties->fonts dialog?
> > 
> > Sure, it's attached.
> 
> Can you try to remove texlive-tex-gyre-fonts (and install some Helvetica
> font, e.g. LiberationSans) temporarily?
> 
> Thanks in advance for your answer.

I removed texlive-tex-gyre-fonts, but the issue persists. A capture of the fonts tab is attached, showing that LiberationSans is  used now instead.
Comment 8 Oleksandr Ostrenko 2021-06-12 08:44:57 UTC
Created attachment 139246 [details]
file->properties->fonts 2
Comment 9 Albert Astals Cid 2021-06-12 10:06:17 UTC
Roboto is a terrible substitution for ZapfDingbats (which my quess is what's being used for the dots).

Install a package that gives you an actual ZapfDingbats compatible font like D050000L.otf and while at it please complain to your distro to make that a very very very very recommended package for okular.
Comment 10 Oleksandr Ostrenko 2021-06-12 11:48:57 UTC
(In reply to Albert Astals Cid from comment #9)
> Roboto is a terrible substitution for ZapfDingbats (which my quess is what's
> being used for the dots).
> 
> Install a package that gives you an actual ZapfDingbats compatible font like
> D050000L.otf and while at it please complain to your distro to make that a
> very very very very recommended package for okular.

OK, after checking my packages I found some Zapfding fonts in 
texlive-zapfding:

/usr/share/texmf/dvips/zapfding/config.uzd
/usr/share/texmf/fonts/afm/adobe/zapfding/pzdr.afm
/usr/share/texmf/fonts/afm/urw/zapfding/uzdr.afm
/usr/share/texmf/fonts/map/dvips/zapfding/uzd.map
/usr/share/texmf/fonts/tfm/adobe/zapfding/pzdr.tfm
/usr/share/texmf/fonts/tfm/urw35vf/zapfding/uzdr.tfm
/usr/share/texmf/fonts/type1/urw/zapfding/uzdr.pfb
/usr/share/texmf/fonts/type1/urw/zapfding/uzdr.pfm
/usr/share/texmf/tex/latex/zapfding/uuzd.fd

But no OTF fonts. I tried looking into other packages and I found D050000L.{afm,pfb} in ghostscript-fonts-std. But, again, not an OTF font. So I had to download and install it manually and, voila, now it works. 

However, I don't quite understand why none of the installed fonts from texlive-zapfding or ghostscript-fonts-std could be used to substitute it. Did I miss anything or is it bug? If so, what should I report it against?
Comment 11 Oleksandr Ostrenko 2021-06-12 11:49:16 UTC
Created attachment 139248 [details]
works
Comment 12 Yuri Chornoivan 2021-06-12 12:31:03 UTC
(In reply to Oleksandr Ostrenko from comment #10)
> (In reply to Albert Astals Cid from comment #9)
> > Roboto is a terrible substitution for ZapfDingbats (which my quess is what's
> > being used for the dots).
> > 
> > Install a package that gives you an actual ZapfDingbats compatible font like
> > D050000L.otf and while at it please complain to your distro to make that a
> > very very very very recommended package for okular.
> 
> OK, after checking my packages I found some Zapfding fonts in 
> texlive-zapfding:
> 
> /usr/share/texmf/dvips/zapfding/config.uzd
> /usr/share/texmf/fonts/afm/adobe/zapfding/pzdr.afm
> /usr/share/texmf/fonts/afm/urw/zapfding/uzdr.afm
> /usr/share/texmf/fonts/map/dvips/zapfding/uzd.map
> /usr/share/texmf/fonts/tfm/adobe/zapfding/pzdr.tfm
> /usr/share/texmf/fonts/tfm/urw35vf/zapfding/uzdr.tfm
> /usr/share/texmf/fonts/type1/urw/zapfding/uzdr.pfb
> /usr/share/texmf/fonts/type1/urw/zapfding/uzdr.pfm
> /usr/share/texmf/tex/latex/zapfding/uuzd.fd
> 
> But no OTF fonts. I tried looking into other packages and I found
> D050000L.{afm,pfb} in ghostscript-fonts-std. But, again, not an OTF font. So
> I had to download and install it manually and, voila, now it works. 
> 
> However, I don't quite understand why none of the installed fonts from
> texlive-zapfding or ghostscript-fonts-std could be used to substitute it.
> Did I miss anything or is it bug? If so, what should I report it against?

DejaVu Sans (dejavu-fonts package) should be enough. You can file a bug report against openSUSE package to include it as a dependence as proposed by Albert.
Comment 13 Oleksandr Ostrenko 2021-06-12 12:53:41 UTC
(In reply to Yuri Chornoivan from comment #12)
> (In reply to Oleksandr Ostrenko from comment #10)
> > (In reply to Albert Astals Cid from comment #9)
> > > Roboto is a terrible substitution for ZapfDingbats (which my quess is what's
> > > being used for the dots).
> > > 
> > > Install a package that gives you an actual ZapfDingbats compatible font like
> > > D050000L.otf and while at it please complain to your distro to make that a
> > > very very very very recommended package for okular.
> > 
> > OK, after checking my packages I found some Zapfding fonts in 
> > texlive-zapfding:
> > 
> > /usr/share/texmf/dvips/zapfding/config.uzd
> > /usr/share/texmf/fonts/afm/adobe/zapfding/pzdr.afm
> > /usr/share/texmf/fonts/afm/urw/zapfding/uzdr.afm
> > /usr/share/texmf/fonts/map/dvips/zapfding/uzd.map
> > /usr/share/texmf/fonts/tfm/adobe/zapfding/pzdr.tfm
> > /usr/share/texmf/fonts/tfm/urw35vf/zapfding/uzdr.tfm
> > /usr/share/texmf/fonts/type1/urw/zapfding/uzdr.pfb
> > /usr/share/texmf/fonts/type1/urw/zapfding/uzdr.pfm
> > /usr/share/texmf/tex/latex/zapfding/uuzd.fd
> > 
> > But no OTF fonts. I tried looking into other packages and I found
> > D050000L.{afm,pfb} in ghostscript-fonts-std. But, again, not an OTF font. So
> > I had to download and install it manually and, voila, now it works. 
> > 
> > However, I don't quite understand why none of the installed fonts from
> > texlive-zapfding or ghostscript-fonts-std could be used to substitute it.
> > Did I miss anything or is it bug? If so, what should I report it against?
> 
> DejaVu Sans (dejavu-fonts package) should be enough. You can file a bug
> report against openSUSE package to include it as a dependence as proposed by
> Albert.

I am sorry, I am still a bit confused.

I had all those fonts installed (dejavu-fonts, texlive-zapfding, ghostscript-fonts-std) and it still did not work, until I MANUALLY downloaded an OTF file for Zapfding from the web and installed it. I had the other fonts installed as afm & pfb files, but, apparently, they are not considered for rendering by okular. For instance, Roboto.ttf was choosen over D050000L.{afm,pfb}. Is this the expected behavior? Sorry if that is seems trivial, but I am a bit lost here.
Comment 14 Yuri Chornoivan 2021-06-12 13:00:13 UTC
Created attachment 139254 [details]
Fonts that work

Linux fontconfig subsystem is complex and fragile. It is hard to decide what to do in such cases. As a rule of thumb, you should install the substituted fonts. Or just embed fonts.

https://hansjoerg.me/2018/02/15/font-embedding-for-latex-and-r-users/
Comment 15 Oleksandr Ostrenko 2021-06-12 13:16:52 UTC
(In reply to Yuri Chornoivan from comment #14)
> Created attachment 139254 [details]
> Fonts that work
> 
> Linux fontconfig subsystem is complex and fragile. It is hard to decide what
> to do in such cases. As a rule of thumb, you should install the substituted
> fonts. Or just embed fonts.
> 
> https://hansjoerg.me/2018/02/15/font-embedding-for-latex-and-r-users/

Ah, I see. Thank you for providing this link.

So it's a "feature". 

Thanks to everybody in the thread for helping me hunt it down!
It's been resolved for me.
Comment 16 Laura David Hurka 2021-06-12 13:39:36 UTC
Why wasn’t the <?> symbol rendered instead of the missing character?

https://en.wikipedia.org/wiki/Specials_(Unicode_block)
U+FFFD � REPLACEMENT CHARACTER used to replace an unknown, unrecognized, or unrepresentable character
Comment 17 Albert Astals Cid 2021-06-12 18:28:09 UTC
(In reply to Yuri Chornoivan from comment #12)
> DejaVu Sans (dejavu-fonts package) should be enough. You can file a bug
> report against openSUSE package to include it as a dependence as proposed by
> Albert.

This is not correct. Dejavu is not a correct replacement for ZapfDingbats.

ZapfDingbats is a special font where A is not rendered as an A but as the star of david, etc.
Comment 18 Yuri Chornoivan 2021-06-13 05:42:52 UTC
(In reply to Albert Astals Cid from comment #17)
> (In reply to Yuri Chornoivan from comment #12)
> > DejaVu Sans (dejavu-fonts package) should be enough. You can file a bug
> > report against openSUSE package to include it as a dependence as proposed by
> > Albert.
> 
> This is not correct. Dejavu is not a correct replacement for ZapfDingbats.
> 
> ZapfDingbats is a special font where A is not rendered as an A but as the
> star of david, etc.

It can be proven (e.g. using FontForge) that DejaVu Sans is a good replacement of ZapfDingbats as it contains dingbats part and is common in the distributions. The screenshot above (Mageia 8, fontconfig 2.13.93) is additional proof of the fact that it can be used to render the test file. The only problem is the font precedence.