From tov@ece.cmu.edu  Tue Feb  6 14:50:42 2001
From: tov@ece.cmu.edu (tov@ece.cmu.edu)
Date: Tue, 6 Feb 2001 15:50:42 +0100 (MET)
Subject: [Rd] X11 warnings about "wrong" font sizes (PR#840)
Message-ID: <200102061450.PAA22765@pubhealth.ku.dk>


Hi.  This is cosmetic in nature, yet annoying as the warning points
to the wrong source:  On a screen running on an X server with 100 DPI,
I always got warnings about X11 using the wrong font size:

> x11()
Warning message: 
X11 used font size 17 when 12 was requested 

Then I looked at the code and X11 is _not_ to be blamed for this:
R resets the requested font size for 100 DPI screens!  There should be
no warning.  (At least not a warning that makes people wonder whether
they misconfigured the font server again.)

The patch below moves Peter's scaling equation up, before the font
cache check and directly writes to size.  Thus it's true that:
  variable size == (IS_100DPI ? scaled requested size : requested size)
  variable pixelsize == (font available ? size (same as above)
						: size of allocated font)

Regards,
  -tom



*** ../src/unix/X11/devX11.c	Tue Feb  6 09:27:48 2001
--- ../src/unix/X11/devX11.c~	Fri Feb  2 08:20:37 2001
***************
*** 834,855 ****
      if (size < SMALLEST) size = SMALLEST;
      face--;
  
-     /* Here's a 1st class fudge: make sure that the Adobe design sizes
-        8, 10, 11, 12, 14, 17, 18, 20, 24, 25, 34 can be obtained via
-        an integer "size" at 100 dpi, namely 6, 7, 8, 9, 10, 12, 13,
-        14, 17, 18, 24 points. It's almost y = x * 100/72, but not
-        quite. The constants were found using lm(). --pd */
-     if (IS_100DPI) size = R_rint(size * 1.43 - 0.4);
- 
      /* search fontcache */
      for ( i = nfonts ; i-- ; ) {
  	f = &fontcache[i];
  	if ( f->face == face && f->size == size ) return f->font;
      }
  
!     /* 'size' is the requested size, 'pixelsize'  the size of the
!        actually allocated font*/
!     pixelsize = size;
  
      if (face == 4)
  	sprintf(buf, symbolname,  pixelsize);
--- 834,854 ----
      if (size < SMALLEST) size = SMALLEST;
      face--;
  
      /* search fontcache */
      for ( i = nfonts ; i-- ; ) {
  	f = &fontcache[i];
  	if ( f->face == face && f->size == size ) return f->font;
      }
  
! 
! 
!     /* Here's a 1st class fudge: make sure that the Adobe design sizes
!        8, 10, 11, 12, 14, 17, 18, 20, 24, 25, 34 can be obtained via
!        an integer "size" at 100 dpi, namely 6, 7, 8, 9, 10, 12, 13,
!        14, 17, 18, 24 points. It's almost y = x * 100/72, but not
!        quite. The constants were found using lm(). --pd */
! 
!     pixelsize = IS_100DPI ? R_rint(size * 1.43 - 0.4) : size;
  
      if (face == 4)
  	sprintf(buf, symbolname,  pixelsize);


--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = Under development (unstable)
 major = 1
 minor = 3.0
 year = 2001
 month = 02
 day = 02
 language = R

Search Path:
 .GlobalEnv, package:ctest, Autoloads, package:base



-- 
mailto:tov@ece.cmu.edu (Tom Vogels)   Tel: (412) 268-6638   FAX: -3204


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] X11 warnings about "wrong" font sizes (PR#840)
tov@ece.cmu.edu