[Rd] italic (PR#7932)

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Wed Jun 15 17:14:55 CEST 2005


On Wed, 15 Jun 2005 ligges at statistik.uni-dortmund.de wrote:

> ggrothendieck at gmail.com wrote:
>
>> Full_Name: G. Grothendieck
>> Version: R version 2.1.0, 2005-05-14
>> OS: Windows XP
>> Submission from: (NULL) (216.59.254.207)
>>
>>
>> This code:
>>
>>
>>> plot(1:10)
>>> text(5,5,lab=expression(italic(22*"33")))
>
> For mathematical non-character-string annotation a math font is used
> that does not support italic/bold/bolditalic/plain.
> It seems to be worth adding this information to ?plotmath, such as:
> "(only for characters, but not for math font)".

I don't think that is true: plotmath uses the same 5 fontfaces as any 
other form of graph annotation.  The reason was staring Grothendieck
in the face: the code is

static BBOX RenderNumber(SEXP expr, int draw, mathContext *mc,
 			 R_GE_gcontext *gc, GEDevDesc *dd)
{
     BBOX bbox;
     FontType prevfont = SetFont(PlainFont, gc);
     bbox = RenderStr(CHAR(asChar(expr)), draw, mc, gc, dd);
     SetFont(prevfont, gc);
     return bbox;
}

so it is by design.  Numeric constants are always in PlainFont.

>> has the effect of italicizing 33 (which is a character string) but not 22
>> (which is not).  I would have thought that both, not just 33, would be
>> italicized.

(We do ask people to actually do the thinking before posting a bug 
report.)

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list