Iñaki Ucar
2020-Mar-30 21:12 UTC
[Rd] Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?
On Mon, 30 Mar 2020 at 22:41, Paul Murrell <paul at stat.auckland.ac.nz> wrote:> > Hi > > On 30/03/20 10:43 pm, I?aki Ucar wrote: > > On Mon, 30 Mar 2020 at 04:24, Paul Murrell <paul at stat.auckland.ac.nz> wrote: > >> > >> Hi > >> > >> I have created an R branch that contains a potential fix ... > >> > >> https://svn.r-project.org/R/branches/R-symfam/ > >> > >> This allows, for example, ... > >> > >> cairo_pdf(symbolfamily="OpenSymbol") > >> > >> ... to specify that the OpenSymbol family should be used as the "symbol" > >> font (e.g., for "plotmath") in R. > > > > Will this be a default on Linux? Or are you planning any mechanism > > (env variable, option...) to make it the default? Because, otherwise, > > as pango is updated across distributions, R graphics will be "broken" > > by default unless the user explicitly calls the graphics device in > > that way to set that option, which I would say is uncommon. > > Good question. Currently, for x11() (and png() etc) the default is > taken from X11.options(). So it is possible to set this default for a > session, or even for an installation via one of the ?Startup mechanisms > (e.g., an R_HOME/etc/Rprofile.site file). > > For svg(), cairo_pdf(), and cairo_ps(), the default is hard-coded in the > function arguments, but I *think* they are used less as default graphics > devices. > > Another option would be to try to detect Fedora and set the default > X11.options() differently there. Two problems: I am not sure there is > a reliable R code chunk for detecting Fedora (sessionInfo()$running?) > let alone Fedora >= 30; what to set the default to? (just has to be a > font with a good Unicode coverage that is pretty much guaranteed to be > in a default Fedora install).As per Nicolas' comment (I failed to include him in CC in my last email, and he's not in this list, sorry for that) any font installed by default would have good symbol coverage, so there's really no need to set a different font for symbols. According again to Nicolas (he's one of the font experts in Fedora), the "sans-serif" or "monospace" fontconfig defaults would work out of the box, and if a symbol is not available, fontconfig should fallback gracefully to another font. So maybe instead of a new "symbolfamily" argument, maybe it's better to just use the "family" for all characters, including symbols, on Linux, and fontconfig should take care of everything (if I understood correctly your explanation, Nicolas; please correct me if I'm wrong). -- I?aki ?car
Paul Murrell
2020-Mar-31 01:32 UTC
[Rd] Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?
On 31/03/20 10:12 am, I?aki Ucar wrote:> On Mon, 30 Mar 2020 at 22:41, Paul Murrell <paul at stat.auckland.ac.nz> wrote: >> >> Hi >> >> On 30/03/20 10:43 pm, I?aki Ucar wrote: >>> On Mon, 30 Mar 2020 at 04:24, Paul Murrell <paul at stat.auckland.ac.nz> wrote: >>>> >>>> Hi >>>> >>>> I have created an R branch that contains a potential fix ... >>>> >>>> https://svn.r-project.org/R/branches/R-symfam/ >>>> >>>> This allows, for example, ... >>>> >>>> cairo_pdf(symbolfamily="OpenSymbol") >>>> >>>> ... to specify that the OpenSymbol family should be used as the "symbol" >>>> font (e.g., for "plotmath") in R. >>> >>> Will this be a default on Linux? Or are you planning any mechanism >>> (env variable, option...) to make it the default? Because, otherwise, >>> as pango is updated across distributions, R graphics will be "broken" >>> by default unless the user explicitly calls the graphics device in >>> that way to set that option, which I would say is uncommon. >> >> Good question. Currently, for x11() (and png() etc) the default is >> taken from X11.options(). So it is possible to set this default for a >> session, or even for an installation via one of the ?Startup mechanisms >> (e.g., an R_HOME/etc/Rprofile.site file). >> >> For svg(), cairo_pdf(), and cairo_ps(), the default is hard-coded in the >> function arguments, but I *think* they are used less as default graphics >> devices. >> >> Another option would be to try to detect Fedora and set the default >> X11.options() differently there. Two problems: I am not sure there is >> a reliable R code chunk for detecting Fedora (sessionInfo()$running?) >> let alone Fedora >= 30; what to set the default to? (just has to be a >> font with a good Unicode coverage that is pretty much guaranteed to be >> in a default Fedora install). > > As per Nicolas' comment (I failed to include him in CC in my last > email, and he's not in this list, sorry for that) any font installed > by default would have good symbol coverage, so there's really no need > to set a different font for symbols. According again to Nicolas (he's > one of the font experts in Fedora), the "sans-serif" or "monospace" > fontconfig defaults would work out of the box, and if a symbol is not > available, fontconfig should fallback gracefully to another font. > > So maybe instead of a new "symbolfamily" argument, maybe it's better > to just use the "family" for all characters, including symbols, on > Linux, and fontconfig should take care of everything (if I understood > correctly your explanation, Nicolas; please correct me if I'm wrong).I think R will retain the idea of a separate symbol font in at least the short term because of backward compatibility and cross-platform support and support for a range of graphics devices. So this fix is just for cairo-based devices on Linux at most (probably only Fedora). So this becomes just a decision about user interface and default settings. I did consider the option of allowing the existing "family" parameter to be length-two (with the second one being an optional symbol font specification), but because of the overlaps of X11/cairo and different cairo-based device interfaces, this became awkward. Hence the separate "symbolfamily" interface. And in any case, this still means a separate "symbol" font specification (for the reasons above). Regarding changing to a default symbolfamily=family on Linux generally (rather than just on Fedora), I have at least one counter-example (my Ubuntu 18.04) that shows that this would degrade output significantly. For one, the symbols are a LOT uglier, plus there are some incorrect glyphs. So I think we have to stay with treating Fedora as a special case for now. Thanks for your point about just using symbolfamily=family as the Fedora default. That seems reasonable (and definitely better than it just being completely broken!). That does still leave the problem of how to set the default value for "symbolfamily" JUST on Fedora. I am not convinced we can use R code to detect Fedora >= 30 reliably (but happy to learn otherwise). Is it a possibility for the Fedora distribution to include a .Rprofile.site file that sets the X11.options() ? Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Iñaki Ucar
2020-Mar-31 07:41 UTC
[Rd] Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?
On Tue, 31 Mar 2020 at 03:32, Paul Murrell <paul at stat.auckland.ac.nz> wrote:> > I think R will retain the idea of a separate symbol font in at least the > short term because of backward compatibility and cross-platform support > and support for a range of graphics devices. So this fix is just for > cairo-based devices on Linux at most (probably only Fedora). > > So this becomes just a decision about user interface and default settings. > > I did consider the option of allowing the existing "family" parameter to > be length-two (with the second one being an optional symbol font > specification), but because of the overlaps of X11/cairo and different > cairo-based device interfaces, this became awkward. Hence the separate > "symbolfamily" interface. And in any case, this still means a separate > "symbol" font specification (for the reasons above). > > Regarding changing to a default symbolfamily=family on Linux generally > (rather than just on Fedora), I have at least one counter-example (my > Ubuntu 18.04) that shows that this would degrade output significantly. > For one, the symbols are a LOT uglier, plus there are some incorrect > glyphs. So I think we have to stay with treating Fedora as a special > case for now.You can try Noto Sans Symbols (google-noto-sans-symbols-fonts) or Symbola (gdouros-symbola-fonts). We could make the R package depend on any of these fonts included in Fedora.> Thanks for your point about just using symbolfamily=family as the Fedora > default. That seems reasonable (and definitely better than it just > being completely broken!). > > That does still leave the problem of how to set the default value for > "symbolfamily" JUST on Fedora. I am not convinced we can use R code to > detect Fedora >= 30 reliably (but happy to learn otherwise). Is it a > possibility for the Fedora distribution to include a .Rprofile.site file > that sets the X11.options() ?1. I don't think you need to detect you are in Fedora at all, just to detect the version of pango, and apply this configuration if it's >1.44 (e.g., by executing pango-view --version; or better yet, at building time https://developer.gnome.org/pango/stable/pango-Version-Checking.html). 2. Yes, we can include any custom configuration files or patches. In fact we will need to patch R 3.6.3 for Fedora 31 at least, because Fedora 32 is about to be released, and thus R 4.0.0 won't be included in Fedora 31. The problem with the .Rprofile.site is that any user-specific .Rprofile will prevent the default from being loaded, right? And I'd say ~/.Rprofile is pretty common out there, and even project-specific .Rprofile. -- I?aki ?car
Seemingly Similar Threads
- Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?
- Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?
- Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?
- Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?
- Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?