fix math/R missing fonts on plots (Was: Re: graphics/cairo + math/R font issues)
Zé Loff writes: > 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 >> 3. Fonts don't render in the Plots window. Not sure why. Help >> appreciated. > > pango/harfbuzz fallout, probably. Pango stopped supporting Type 1 > fonts. I have the same issue with R itself. My solution it to add > > options.X11(family = "DejaVu Sans") > > or some other TrueType family. I was preparing an editors/TeXmacs update and noticed that the R plugin had graphs with missing glyphs. Here is a diff for R to do what Ze Loff suggested in these two threads[2][3]. Fix taken from [1]. sthen@ described the root cause in [2] but consider this workaround. This diff: - changes the site-wide config (/usr/local/lib/R/library/base/R/Rprofile) to use DejaVu Sans by default. - updates README to document that the font can be changed - bumps REVISION sources: [1] https://stackoverflow.com/questions/1189759/expert-r-users-whats-in-your-rprofile [2] https://marc.info/?l=openbsd-ports=157830898518255=2 [3] https://marc.info/?l=openbsd-ports=159342491019196=2 I was able to run these two test plots with the TeXmacs R plugin, math/rstudio and with R itself. test 1: demo(plotmath) mash enter a few times test 2: qnorm(1/2,mean=0,sd=1) x<-1:100 y<-rnorm(x) plot(x,y) Feedback and tests are welcome. Index: Makefile === RCS file: /cvs/ports/math/R/Makefile,v retrieving revision 1.118 diff -u -p -u -p -r1.118 Makefile --- Makefile23 Jun 2020 18:54:24 - 1.118 +++ Makefile16 Jul 2020 06:20:25 - @@ -2,6 +2,7 @@ COMMENT= powerful math/statistics/graphics language DISTNAME= R-4.0.2 +REVISION= 0 SO_VERSION=37.0 .for _lib in R Rblas Rlapack Index: patches/patch-src_library_profile_Common_R === RCS file: patches/patch-src_library_profile_Common_R diff -N patches/patch-src_library_profile_Common_R --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-src_library_profile_Common_R 16 Jul 2020 06:20:25 - @@ -0,0 +1,17 @@ +$OpenBSD$ + +add default font to fix missing font on plots. see: +https://stackoverflow.com/questions/1189759/expert-r-users-whats-in-your-rprofile + +Index: src/library/profile/Common.R +--- src/library/profile/Common.R.orig src/library/profile/Common.R +@@ -35,6 +35,8 @@ options(show.error.messages = TRUE) + options(scipen = 0) + options(max.print = 9)# max. #{entries} in internal printMatrix() + options(add.smooth = TRUE)# currently only used in 'plot.lm' ++setHook(packageEvent("grDevices", "onLoad"), ++function(...) grDevices::X11.options(family = "DejaVu Sans")) + + if(isFALSE(as.logical(Sys.getenv("_R_OPTIONS_STRINGS_AS_FACTORS_", + "FALSE" { Index: pkg/README === RCS file: /cvs/ports/math/R/pkg/README,v retrieving revision 1.10 diff -u -p -u -p -r1.10 README --- pkg/README 18 May 2020 05:26:13 - 1.10 +++ pkg/README 16 Jul 2020 06:20:25 - @@ -16,3 +16,9 @@ Running: as root, will update both ${TRUEPREFIX}/lib/R/etc/Makeconf and ${TRUEPREFIX}/lib/R/etc/ldpaths with the right settings. + +Changing fonts +== +Fonts on plots can be customized. + +> X11.options(family = "DejaVu Sans")
Re: Fix math/R
On Sun, Jan 22, 2012 at 06:47:28PM +0100, David Coppa wrote: On Thu, Jan 19, 2012 at 5:22 PM, David Coppa dco...@openbsd.org wrote: Hi, This diff fixes R's problem with pthread undefined symbols, as reported here: http://marc.info/?l=openbsd-portsm=132196919327917 and here: http://marc.info/?l=openbsd-portsm=132187529729922 It also fixes libpthread linkage (-lpthread - -pthread) and an incorrect usage of the --export-dynamic linker flag (it's '-Wl,--export-dynamic', not '-Wl,-export-dynamic'. Tested on sparc64 and amd64. Ok? Ping! It seems my last message did not get through, sorry. This fixes my problems on i386. Thanks.
Re: Fix math/R
On Thu, Jan 19, 2012 at 09:22:03AM -0700, David Coppa wrote: Hi, This diff fixes R's problem with pthread undefined symbols, as reported here: http://marc.info/?l=openbsd-portsm=132196919327917 and here: http://marc.info/?l=openbsd-portsm=132187529729922 It also fixes libpthread linkage (-lpthread - -pthread) and an incorrect usage of the --export-dynamic linker flag (it's '-Wl,--export-dynamic', not '-Wl,-export-dynamic'. Tested on sparc64 and amd64. Tested on i386. Works fine, thanks!
Re: Fix math/R
On Thu, Jan 19, 2012 at 5:22 PM, David Coppa dco...@openbsd.org wrote: Hi, This diff fixes R's problem with pthread undefined symbols, as reported here: http://marc.info/?l=openbsd-portsm=132196919327917 and here: http://marc.info/?l=openbsd-portsm=132187529729922 It also fixes libpthread linkage (-lpthread - -pthread) and an incorrect usage of the --export-dynamic linker flag (it's '-Wl,--export-dynamic', not '-Wl,-export-dynamic'. Tested on sparc64 and amd64. Ok? Ping! Index: Makefile === RCS file: /cvs/ports/math/R/Makefile,v retrieving revision 1.44 diff -u -p -r1.44 Makefile --- Makefile 3 Nov 2011 20:28:09 - 1.44 +++ Makefile 19 Jan 2012 16:10:45 - @@ -4,7 +4,7 @@ SHARED_ONLY= Yes COMMENT= clone of S, a powerful math/statistics/graphics language DISTNAME= R-2.8.1 -REVISION= 6 +REVISION= 7 SHARED_LIBS= Rlapack 29.0 \ Rblas 29.0 @@ -20,8 +20,8 @@ PERMIT_DISTFILES_FTP= Yes WANTLIB= GL ICE SM X11 Xext Xmu Xrender Xss Xt \ bz2 c cairo expat fontconfig freetype glib-2.0 \ gmodule-2.0 gobject-2.0 gthread-2.0 jpeg m ncurses pango-1.0 \ - pangocairo-1.0 pangoft2-1.0 pcre pixman-1 png pthread-stubs \ - readline tiff xcb xcb-render xcb-shm z \ + pangocairo-1.0 pangoft2-1.0 pcre pixman-1 png pthread \ + pthread-stubs readline tiff xcb xcb-render xcb-shm z \ ${MODFORTRAN_WANTLIB} ${MODTK_WANTLIB} MASTER_SITES= http://cran.r-project.org/src/base/R-2/ \ Index: patches/patch-configure === RCS file: /cvs/ports/math/R/patches/patch-configure,v retrieving revision 1.10 diff -u -p -r1.10 patch-configure --- patches/patch-configure 11 Mar 2009 08:21:33 - 1.10 +++ patches/patch-configure 19 Jan 2012 16:10:45 - @@ -1,6 +1,69 @@ $OpenBSD: patch-configure,v 1.10 2009/03/11 08:21:33 sthen Exp $ configure.orig Thu Dec 18 14:03:48 2008 -+++ configure Wed Mar 11 00:21:36 2009 +--- configure.orig Thu Dec 18 15:03:48 2008 configure Thu Jan 19 14:38:44 2012 +@@ -31142,7 +31142,7 @@ echo $as_me: WARNING: Use of flat namespace is reques + openbsd*) + ## looks like ${wl} is not defined here. Perhaps in libtool code? + if test -z `echo __ELF__ | $CC -E - | grep __ELF__`; then +- main_ldflags=${wl}-export-dynamic ++ main_ldflags=${wl}--export-dynamic + shlib_ldflags=-shared -fPIC + fi + ;; +@@ -52736,13 +52736,13 @@ rm -f core conftest.err conftest.$ac_objext conftest_i + if test -n $gl_have_pthread; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. +- { echo $as_me:$LINENO: checking for pthread_kill in -lpthread 5 +-echo $ECHO_N checking for pthread_kill in -lpthread... $ECHO_C 6; } ++ { echo $as_me:$LINENO: checking for pthread_kill in -pthread 5 ++echo $ECHO_N checking for pthread_kill in -pthread... $ECHO_C 6; } + if test ${ac_cv_lib_pthread_pthread_kill+set} = set; then + echo $ECHO_N (cached) $ECHO_C 6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS=-lpthread $LIBS ++LIBS=-pthread $LIBS + cat conftest.$ac_ext _ACEOF + /* confdefs.h. */ + _ACEOF +@@ -52806,7 +52806,7 @@ fi + { echo $as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill 5 + echo ${ECHO_T}$ac_cv_lib_pthread_pthread_kill 6; } + if test $ac_cv_lib_pthread_pthread_kill = yes; then +- LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread ++ LIBMULTITHREAD=-pthread LTLIBMULTITHREAD=-pthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas +@@ -52824,13 +52824,13 @@ fi + + else + # Some library is needed. Try libpthread and libc_r. +- { echo $as_me:$LINENO: checking for pthread_kill in -lpthread 5 +-echo $ECHO_N checking for pthread_kill in -lpthread... $ECHO_C 6; } ++ { echo $as_me:$LINENO: checking for pthread_kill in -pthread 5 ++echo $ECHO_N checking for pthread_kill in -pthread... $ECHO_C 6; } + if test ${ac_cv_lib_pthread_pthread_kill+set} = set; then + echo $ECHO_N (cached) $ECHO_C 6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS=-lpthread $LIBS ++LIBS=-pthread $LIBS + cat conftest.$ac_ext _ACEOF + /* confdefs.h. */ + _ACEOF +@@ -52895,8 +52895,8 @@ fi + echo ${ECHO_T}$ac_cv_lib_pthread_pthread_kill 6; } + if test $ac_cv_lib_pthread_pthread_kill = yes; then + gl_have_pthread=yes +- LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread +- LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread ++
Fix math/R
Hi, This diff fixes R's problem with pthread undefined symbols, as reported here: http://marc.info/?l=openbsd-portsm=132196919327917 and here: http://marc.info/?l=openbsd-portsm=132187529729922 It also fixes libpthread linkage (-lpthread - -pthread) and an incorrect usage of the --export-dynamic linker flag (it's '-Wl,--export-dynamic', not '-Wl,-export-dynamic'. Tested on sparc64 and amd64. Ok? ciao, David Index: Makefile === RCS file: /cvs/ports/math/R/Makefile,v retrieving revision 1.44 diff -u -p -r1.44 Makefile --- Makefile3 Nov 2011 20:28:09 - 1.44 +++ Makefile19 Jan 2012 16:10:45 - @@ -4,7 +4,7 @@ SHARED_ONLY=Yes COMMENT= clone of S, a powerful math/statistics/graphics language DISTNAME= R-2.8.1 -REVISION= 6 +REVISION= 7 SHARED_LIBS= Rlapack 29.0 \ Rblas 29.0 @@ -20,8 +20,8 @@ PERMIT_DISTFILES_FTP= Yes WANTLIB= GL ICE SM X11 Xext Xmu Xrender Xss Xt \ bz2 c cairo expat fontconfig freetype glib-2.0 \ gmodule-2.0 gobject-2.0 gthread-2.0 jpeg m ncurses pango-1.0 \ - pangocairo-1.0 pangoft2-1.0 pcre pixman-1 png pthread-stubs \ - readline tiff xcb xcb-render xcb-shm z \ + pangocairo-1.0 pangoft2-1.0 pcre pixman-1 png pthread \ + pthread-stubs readline tiff xcb xcb-render xcb-shm z \ ${MODFORTRAN_WANTLIB} ${MODTK_WANTLIB} MASTER_SITES= http://cran.r-project.org/src/base/R-2/ \ Index: patches/patch-configure === RCS file: /cvs/ports/math/R/patches/patch-configure,v retrieving revision 1.10 diff -u -p -r1.10 patch-configure --- patches/patch-configure 11 Mar 2009 08:21:33 - 1.10 +++ patches/patch-configure 19 Jan 2012 16:10:45 - @@ -1,6 +1,69 @@ $OpenBSD: patch-configure,v 1.10 2009/03/11 08:21:33 sthen Exp $ configure.orig Thu Dec 18 14:03:48 2008 -+++ configure Wed Mar 11 00:21:36 2009 +--- configure.orig Thu Dec 18 15:03:48 2008 configure Thu Jan 19 14:38:44 2012 +@@ -31142,7 +31142,7 @@ echo $as_me: WARNING: Use of flat namespace is reques + openbsd*) + ## looks like ${wl} is not defined here. Perhaps in libtool code? + if test -z `echo __ELF__ | $CC -E - | grep __ELF__`; then +- main_ldflags=${wl}-export-dynamic ++ main_ldflags=${wl}--export-dynamic + shlib_ldflags=-shared -fPIC + fi + ;; +@@ -52736,13 +52736,13 @@ rm -f core conftest.err conftest.$ac_objext conftest_i + if test -n $gl_have_pthread; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. +- { echo $as_me:$LINENO: checking for pthread_kill in -lpthread 5 +-echo $ECHO_N checking for pthread_kill in -lpthread... $ECHO_C 6; } ++ { echo $as_me:$LINENO: checking for pthread_kill in -pthread 5 ++echo $ECHO_N checking for pthread_kill in -pthread... $ECHO_C 6; } + if test ${ac_cv_lib_pthread_pthread_kill+set} = set; then + echo $ECHO_N (cached) $ECHO_C 6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS=-lpthread $LIBS ++LIBS=-pthread $LIBS + cat conftest.$ac_ext _ACEOF + /* confdefs.h. */ + _ACEOF +@@ -52806,7 +52806,7 @@ fi + { echo $as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill 5 + echo ${ECHO_T}$ac_cv_lib_pthread_pthread_kill 6; } + if test $ac_cv_lib_pthread_pthread_kill = yes; then +- LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread ++ LIBMULTITHREAD=-pthread LTLIBMULTITHREAD=-pthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas +@@ -52824,13 +52824,13 @@ fi + + else + # Some library is needed. Try libpthread and libc_r. +- { echo $as_me:$LINENO: checking for pthread_kill in -lpthread 5 +-echo $ECHO_N checking for pthread_kill in -lpthread... $ECHO_C 6; } ++ { echo $as_me:$LINENO: checking for pthread_kill in -pthread 5 ++echo $ECHO_N checking for pthread_kill in -pthread... $ECHO_C 6; } + if test ${ac_cv_lib_pthread_pthread_kill+set} = set; then + echo $ECHO_N (cached) $ECHO_C 6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS=-lpthread $LIBS ++LIBS=-pthread $LIBS + cat conftest.$ac_ext _ACEOF + /* confdefs.h. */ + _ACEOF +@@ -52895,8 +52895,8 @@ fi + echo ${ECHO_T}$ac_cv_lib_pthread_pthread_kill 6; } + if test $ac_cv_lib_pthread_pthread_kill = yes; then + gl_have_pthread=yes +- LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread +- LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread ++ LIBTHREAD=-pthread LTLIBTHREAD=-pthread ++ LIBMULTITHREAD=-pthread LTLIBMULTITHREAD=-pthread + fi + + if test -z $gl_have_pthread; then @@