[Rd] Plotmath on Fedora 31 broken with with pango >= 1.44 - workarounds?

Paul Murrell p@u| @end|ng |rom @t@t@@uck|@nd@@c@nz
Tue Mar 31 03:32:10 CEST 2020



On 31/03/20 10:12 am, Iñaki Ucar wrote:
> On Mon, 30 Mar 2020 at 22:41, Paul Murrell <paul using 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 using 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 using stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-devel mailing list