Re: [R] plotmath overstrikes in output on a Linux system

2008-04-15 Thread Paul Johnson
On Tue, Apr 8, 2008 at 1:23 PM, Paul Johnson [EMAIL PROTECTED] wrote:
 On Tue, Apr 8, 2008 at 4:29 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote:
   Looks likes the the laptop is using different fonts with incorrect font
   metrics.  This could happen because it has a different screen resolution, 
 or
   one of the systems is set to use scalable fonts or it is giving metrics for
   one fonts and using another or 
  

I found a fix for the funny font overlaps, and it was quite by
accident. In case there are other Fedora users for whom this might
appear, I would like to close the thread with this. In the livna
repository, there is a package called

freetype-freeworld-2.3.5-3.lvn8

After installing that, the fonts on screen are fine.  I do not
understand exactly why this works, or why freetype-freeworld is not in
the freetype distribution all along.  The package is described thusly,
and you will notice it has the same magic words that Professor Ripley
used--hints and glyphs:

$ rpm -qi freetype-freeworld
Name: freetype-freeworld   Relocations: (not relocatable)
Version : 2.3.5 Vendor: rpm.livna.org
Release : 3.lvn8Build Date: Tue 18 Sep
2007 10:28:30 AM CDT
Install Date: Sun 13 Apr 2008 11:16:45 PM CDT  Build Host:
plague-builder.livna.org
Group   : System Environment/Libraries   Source RPM:
freetype-freeworld-2.3.5-3.lvn8.src.rpm
Size: 685309   License: FTL or GPLv2+
Signature   : DSA/SHA1, Sat 22 Sep 2007 10:23:19 AM CDT, Key ID 71295441a109b1ec
Packager: rpm.livna.org http://bugzilla.livna.org
URL : http://www.freetype.org
Summary : A free and portable font rendering engine
Description :
The FreeType engine is a free and portable font rendering
engine, developed to provide advanced font support for a variety of
platforms and environments. FreeType is a library which can open and
manages font files as well as efficiently load, hint and render
individual glyphs. FreeType is not a font server or a complete
text-rendering library.

This version is compiled with the patented bytecode interpreter and subpixel
rendering enabled. It transparently overrides the system library using
ld.so.conf.d.



-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] plotmath overstrikes in output on a Linux system

2008-04-08 Thread Paul Johnson
I've been testing plotmath.  But I'm getting some funny output one one
computer. The problem is that characters are 'jumbled' and overstrike
when symbols are introduced.

Sample code:

mu - 440.0
sigma - 12.5
myx - seq( mu - 4*sigma,  mu+ 4*sigma, length.out=500)
myDensity - dnorm(myx,mean=mu,sd=sigma)

# Here's one way to retrieve the values of mu and sigma and insert
them into an expression
t1t2 - bquote (paste(Normal(, mu== .(mu), ',', sigma== .(sigma),)) )

plot(myx, myDensity, type=l, xlab=X, ylab=Probability Density , main=t1t2)


I have tested this code and it works on two desktop Fedora Linux 8
systems to make a nice figure, but on a Dell Laptop with Fedora Linux
8 and R 2.6.2, something funny happens: the characters overstrike
each other.  The Greek letter mu is printed several spaces to the
left of the ( that it is supposed to follow.  I made an itty  bitty
picture of the figure title to show you:

http://pj.freefaculty.org/R/plotmath_problem.png

I can force in spaces to re-arrange the symbols so they do not
overstrike. The following looks fine in the output.


t1t2 - bquote (paste(Normal (   , mu== .(mu), '  ,  ', sigma==
.(sigma), )) )
### Note spaces manually inserted above are needed, otherwise plotmath
overlaps l of

plot(myx, myDensity, type=l, xlab=X, ylab=Probability Density , main=t1t2)


What do you suppose is wrong? The X configuration?


-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plotmath overstrikes in output on a Linux system

2008-04-08 Thread Prof Brian Ripley
Looks likes the the laptop is using different fonts with incorrect font 
metrics.  This could happen because it has a different screen resolution, 
or one of the systems is set to use scalable fonts or it is giving 
metrics for one fonts and using another or 

BTW, this is probably nothing to do with plotmath per se -- the issue is 
most likely the device (presumably X11(), but you did not say) and its 
handling of font metric requests.  It looks to me as if the widths of 
normal text strings (and not symbols) is the problem.  I have seen 
something similar where there was a long-standing bug in plotmath (fixed 
in r44534), but this only manifested itself when text was kerned, which 
the X11() device in 2.6.2 does not ask for.

My best guess is that the font selected is (to use the technical terms) 
returning glyph widths without left/right bearings.

Please try 2.7.0 beta, which has a different X11() device (and the above 
bug fixed).  That ought to solve the problem for you, but otherwise you'll 
need to debug what the X11 metricInfo callback is giving you.

On Tue, 8 Apr 2008, Paul Johnson wrote:

 I've been testing plotmath.  But I'm getting some funny output one one
 computer. The problem is that characters are 'jumbled' and overstrike
 when symbols are introduced.

 Sample code:

 mu - 440.0
 sigma - 12.5
 myx - seq( mu - 4*sigma,  mu+ 4*sigma, length.out=500)
 myDensity - dnorm(myx,mean=mu,sd=sigma)

 # Here's one way to retrieve the values of mu and sigma and insert
 them into an expression
 t1t2 - bquote (paste(Normal(, mu== .(mu), ',', sigma== .(sigma),)) )

 plot(myx, myDensity, type=l, xlab=X, ylab=Probability Density , 
 main=t1t2)


 I have tested this code and it works on two desktop Fedora Linux 8
 systems to make a nice figure, but on a Dell Laptop with Fedora Linux
 8 and R 2.6.2, something funny happens: the characters overstrike
 each other.  The Greek letter mu is printed several spaces to the
 left of the ( that it is supposed to follow.  I made an itty  bitty
 picture of the figure title to show you:

 http://pj.freefaculty.org/R/plotmath_problem.png

 I can force in spaces to re-arrange the symbols so they do not
 overstrike. The following looks fine in the output.


 t1t2 - bquote (paste(Normal (   , mu== .(mu), '  ,  ', sigma==
 .(sigma), )) )
 ### Note spaces manually inserted above are needed, otherwise plotmath
 overlaps l of

 plot(myx, myDensity, type=l, xlab=X, ylab=Probability Density , 
 main=t1t2)


 What do you suppose is wrong? The X configuration?


 --
 Paul E. Johnson
 Professor, Political Science
 1541 Lilac Lane, Room 504
 University of Kansas

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plotmath overstrikes in output on a Linux system

2008-04-08 Thread Peter Dalgaard
Paul Johnson wrote:
 I've been testing plotmath.  But I'm getting some funny output one one
 computer. The problem is that characters are 'jumbled' and overstrike
 when symbols are introduced.

 Sample code:

 mu - 440.0
 sigma - 12.5
 myx - seq( mu - 4*sigma,  mu+ 4*sigma, length.out=500)
 myDensity - dnorm(myx,mean=mu,sd=sigma)

 # Here's one way to retrieve the values of mu and sigma and insert
 them into an expression
 t1t2 - bquote (paste(Normal(, mu== .(mu), ',', sigma== .(sigma),)) )

 plot(myx, myDensity, type=l, xlab=X, ylab=Probability Density , 
 main=t1t2)


 I have tested this code and it works on two desktop Fedora Linux 8
 systems to make a nice figure, but on a Dell Laptop with Fedora Linux
 8 and R 2.6.2, something funny happens: the characters overstrike
 each other.  The Greek letter mu is printed several spaces to the
 left of the ( that it is supposed to follow.  I made an itty  bitty
 picture of the figure title to show you:

 http://pj.freefaculty.org/R/plotmath_problem.png

 I can force in spaces to re-arrange the symbols so they do not
 overstrike. The following looks fine in the output.


 t1t2 - bquote (paste(Normal (   , mu== .(mu), '  ,  ', sigma==
 .(sigma), )) )
 ### Note spaces manually inserted above are needed, otherwise plotmath
 overlaps l of

 plot(myx, myDensity, type=l, xlab=X, ylab=Probability Density , 
 main=t1t2)


 What do you suppose is wrong? The X configuration
My guess would be that something is wrong with the font metrics on one 
system. If the length of Normal( is miscalculated, that would explain 
the rest.

Do you see the same thing if you do something like

plot(0, main=quote(paste(Lengthy string, A)))

It could be related to dpi settings; I seem to recall that this can do 
weird things on wide-screen displays. Doex xdpyinfo provide any clues? 
Look for lines like this

screen #0:
  dimensions:1024x768 pixels (260x195 millimeters)
  resolution:100x100 dots per inch
 
You could also play with the pointsize argument to X11() and see if the 
problem disappears at different sizes.

-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plotmath overstrikes in output on a Linux system

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 4:29 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 Looks likes the the laptop is using different fonts with incorrect font
 metrics.  This could happen because it has a different screen resolution, or
 one of the systems is set to use scalable fonts or it is giving metrics for
 one fonts and using another or 

  BTW, this is probably nothing to do with plotmath per se -- the issue is
 most likely the device (presumably X11(), but you did not say) and its
 handling of font metric requests.  It looks to me as if the widths of normal
 text strings (and not symbols) is the problem.  I have seen something
 similar where there was a long-standing bug in plotmath (fixed in r44534),
 but this only manifested itself when text was kerned, which the X11() device
 in 2.6.2 does not ask for.

  My best guess is that the font selected is (to use the technical terms)
 returning glyph widths without left/right bearings.

  Please try 2.7.0 beta, which has a different X11() device (and the above
 bug fixed).  That ought to solve the problem for you, but otherwise you'll
 need to debug what the X11 metricInfo callback is giving you.



I installed R-latest from the beta directory.  Following your leads,
I've got some information that may help you see if this is purely an
isolated X11 problem on my computer or something you might fix in R.

On screen, I see this bad looking plot:

http://pj.freefaculty.org/R/png-screenshot-notOK.png

Using a png device to write the graph to file, either with

dev.copy(png ... )

or

png (file =  )
plot ( )
dev.off()

The saved file is GOOD:

http://pj.freefaculty.org/R/png-output-OK.png

http://pj.freefaculty.org/R/png_dev_copy_OK.png

More details about this laptop.  The display has a native resolution
of 1680x1050, and IF I put the X11 display at that resolution, then
the on-screen X11 display of that particular graph is fine.

However, if I change the display to another value, the one I prefer is
1400x1050, and re-start, then I see the bad on-screen display.   In
both cases, however, I have confirmed that the DPI settings in
xdpyinfo are correctly representing pixels/inches.

That leads me back to Prof. Ripley's suggestion that I've got a
mismatch in fonts between what X11 really wants and what it gets.  The
font configuration on these systems is becoming so complicated I'm
completely bewildered, as Fedora has both traditional linux font
server and xft fonts and pango/cairo and freetype and apparently
anything else they can think of.  I'm going to keep studying the R
admin guide to see how to debug it.


off topic

Finally,  something came up that I don't want to forget. It is an RPM
building question for R fans.  This concerns my experience with
R-beta-20080407.r45159.  R built  installed without any apparent
trouble, and I decided to try to make an RPM package of it so other
Fedora people can test.  I took the spec file from the existing Fedora
8 updates R package, and made a few changes to suit the new file name
for R, and I built RPMS.  The build proceeds without noticeable
trouble, but when I try to install the RPM, I get this error

 $ sudo rpm -ivh R-2.7.20080407.r45159-1fc8.1.i386.rpm
Password:
error: Failed dependencies:
perl(R::Dcf) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Logfile) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Rd) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Rdconv) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Rdtools) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Utils) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Vars) is needed by R-2.7.20080407.r45159-1fc8.1.i386

As you can see, the package does have the perl modules, but something
has gone wrong in the scripting process that takes note of them:

$ rpm -qilp R-2.7.20080407.r45159-1fc8.1.i386.rpm | grep perl
/usr/share/R/perl
/usr/share/R/perl/File
/usr/share/R/perl/File/Copy
/usr/share/R/perl/File/Copy/Recursive.pm
/usr/share/R/perl/R
/usr/share/R/perl/R/Dcf.pm
/usr/share/R/perl/R/Logfile.pm
/usr/share/R/perl/R/Rd.pm
/usr/share/R/perl/R/Rdconv.pm
/usr/share/R/perl/R/Rdlists.pm
/usr/share/R/perl/R/Rdtools.pm
/usr/share/R/perl/R/Utils.pm
/usr/share/R/perl/R/Vars.pm
/usr/share/R/perl/Text
/usr/share/R/perl/Text/DelimMatch.pm
/usr/share/R/perl/build-help-windows.pl
/usr/share/R/perl/build-help.pl
/usr/share/R/perl/massage-Examples.pl

I'm contacting the RPM maintainer from redhat to see if he knows. But
if you know, please let me know.

-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.