On Sun, Jan 05, 2020 at 10:22:58PM +0000, Stuart Henderson wrote:
> I can tell you why but not fully how to fix it.
> 
> Newer versions of Pango uses harfbuzz for text shaping, which doesn't
> support type 1 or pcf fonts.
> 
> For things using pcf fonts (this has come up with i3bar users and
> terminus) the fonts want converting to otb (this probably needs a newer
> version of fonttosfnt than we have in xenocara, some commits fixing
> things for this type of conversion were landed there recently,
> though it looks like there may also be a way to do this with
> fontforge).
> 
> In this case though it's type 1 fonts (.pfb files), it's fairly likely
> that you're actually using this font:
> 
> $ fc-match helvetica
> n019003l.pfb: "Nimbus Sans L" "Regular"

Yes, I purposely tested things on a "vanilla" -current VM with nothing
more than pkg_add R, to rule out interactions with other packages and/or
misconfigurations on my machine.

> This is from print/ghostscript/gnu-fonts which is in the dependency
> chain of R so you can't just pkg_delete it.
> 
> As a dirty workaround you can move the pfb files out of
> /usr/local/share/fonts/ghostscript and I expect that will get it working
> for you. Unsure about a better fix though, maybe a fontconfig wizard
> will read this and step in with some clues :-)

Thanks for the workaround.  Personally, I find it easier to change the
default font.  I posted the message as more of a 'heads up' that things
weren't working quite right out-of-the-box, and someone else might
stumble on this.

Although changing the default font can be easily done -- adding a
default site-wide configuration file could be a possible workaround to
make the port work properly again -- this appears not to be the case
with the math/greek symbols font, which seems to be harder to replace,
so just changing fonts isn't a proper fix.

However, all works properly if R is instructed to forget about cairo and
just use the "Xlib" device as a default (as is done on macOS, precisely
due to issues with pango).  Ingo: do you think we should patch the port
to do this, until the pango/type 1 issues are solvable?


(incidentally, fontforge also has the same problem, there is plenty of
UI text that doesn't render properly)


> On 2020/01/05 17:05, Zé Loff wrote:
> > 
> > Hi all
> > 
> > On -current (#562), R's X11cairo device doesn't render the default font
> > properly, I get the "hex number inside a square" characters, instead,
> > e.g.:
> > 
> >   > plot(density(rnorm(1000)))
> > 
> > According to X11.options(), the default fonts are -adobe-helvetica and
> > -adobe-symbol-medium:
> > 
> >   > X11.options()$fonts
> >   [1] "-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*"
> >   [2] "-adobe-symbol-medium-r-*-*-%d-*-*-*-*-*-*-*"
> > 
> > which are properly rendered by xfontsel, so I think this is strictly
> > Cairo-related.
> >   
> > If the device is initialized with a different font, all text is properly
> > rendered:
> > 
> >   > dev.new(family = 'DejaVu Sans')
> >   > plot(density(rnorm(1000))
> > 
> > The pdf() device also seems to work properly (with its default font) i.e.
> > 
> >  > pdf()
> >  > plot(density(rnorm(1000))
> >  > dev.off()
> > 
> > produces a PDF which is rendered properly by mupdf on the same machine.
> > 
> > 
> > 
> > -- 
> >  
> > 
> 

-- 
 

Reply via email to