Skip to content

Undocumented 4.2.0 changes in grid text handling?

3 messages · Jan Netík, Paul Murrell

#
Hello everyone,

I've been testing R 4.2.0 release candidates for some time and have spotted
a few changes that are not documented in
https://svn.r-project.org/R/branches/R-4-2-branch/src/library/grid/inst/doc/changes.txt,
general R NEWS, nor in this blogpost
https://developer.r-project.org/Blog/public/2021/12/14/updating-graphics-devices-for-r-4.2.0/index.html
.

In R 4.1.3, grid::gpar(fontface= "bold") results in a gpar "list" with
$fontface and (legacy?) $font entries, but in R 4.2.0, there is only $font.
In the manual, font is described only for backward compatibility.

I think there are more possibly subtle changes around text rendering
because bold fontface and inter-word spacing in the package {gridtext}
happened to stop working, see the issue at
https://github.com/wilkelab/gridtext/issues/24. Turns out it is pretty hard
to debug and to solve. Do you have some hints about other changes in grid
that could explain so different behaviour?

Many thanks and kind regards!
Jan
#
Hi

 From the github issue discussion, it looks like you have detected the 
problem, which appears to be that 'gridtext' was paying attention to 
gp$fontface, whereas 'grid' internally focuses on gp$font.

I created the problem for 'gridtext' by "tidying up" and removing 
gp$fontface internally.  Apologies for that.

I think I can partially hide behind the fact that these are internal 
details to 'grid', which is why the change was not documented in the 
places that you point out.

Please let me know if you still think that there is an error in 'grid' 
that needs fixing.

Paul
On 22/04/2022 3:38 am, Jan Net?k wrote:

  
    
#
Thanks for the clarification and assurance! The issue is now solved, it was
indeed caused by fontface par removal in the new R version.

I agree that this change is somewhat internal and I would have not reported
that in my package changelog necessarily, but maybe in the base R packages
even this change is welcomed in the news. Many packages are build around
grid (and on the rest of base R, obviously) and while this change would
certainly not bother any "endpoint" user, it has an impact, as we have
seen. Moreover, in ?grid::gpar, it seems that fontface par is preferable
and font is somewhat legacy, which you could potentially understand like
the fontface is in use and font is translated into fontface par.

Anyway, many thanks for your work on R graphics not only for the 4.2.0!

Best,
Jan

Dne p? 22. 4. 2022 3:44 u?ivatel Paul Murrell <paul at stat.auckland.ac.nz>
napsal: