From z@gu @end|ng |rom dk|z-he|de|berg@de  Sat Nov 13 12:51:04 2021
From: z@gu @end|ng |rom dk|z-he|de|berg@de (Gu, Zuguang)
Date: Sat, 13 Nov 2021 11:51:04 +0000
Subject: [Rd] Converting width for a grob where graphics parameters have
 length 0 crashes R
Message-ID: <1636804264876.29489@dkfz-heidelberg.de>

Dear developers,


In grid::gpar(), graphic parameters are not allowed to have length 0, but this can be done by first creating a gpar object and later modifying it:


gp = gpar(fontsize = 10)

gp$fontsize = numeric(0)


when a grob has a gp where some parameters have length 0, converting the width or height of this grob will crash R.

?

A reproducible example is as follows:


> library(grid)

> gp = gpar(fontsize = 10)
> gp$fontsize = numeric(0)
> gb = textGrob("foo", gp = gp)
> convertWidth(grobWidth(gb), "mm")
[1]    21045 floating point exception  R??


Best regards,

Zuguang Gu


	[[alternative HTML version deleted]]



[Rd] Converting width for a grob where graphics parameters have length 0 crashes R
Gu, Zuguang