From hintak_leung at yahoo.co.uk  Tue Nov  1 00:52:43 2011
From: hintak_leung at yahoo.co.uk (Hin-Tak Leung)
Date: Mon, 31 Oct 2011 23:52:43 +0000 (GMT)
Subject: [Rd] Sweave, cairo_pdf, xetex, CJK (Re:  Sweave, cairo_pdf, CJK,
	ghostscript)
In-Reply-To: <1F45FA64-761D-432C-A523-8FE402FE127F@r-project.org>
Message-ID: <1320105163.3506.YahooMailClassic@web29504.mail.ird.yahoo.com>

--- On Mon, 31/10/11, Simon Urbanek <simon.urbanek at r-project.org> wrote:

> On Oct 31, 2011, at 5:56 PM, Hin-Tak Leung wrote:
> 
> > I am still doing some cosmetic things (adding
> annotations with some of the really minority languages in
> Sichuan), but here are a few misc tips and quirks so far:
> > 
> > - cairo_pdf() behaves differently via "R CMD Sweave
> <file>" vs Sweave("file") within R. The former
> produces a lot of warnings about not being able to determine
> strwidth and have to substitute. Probably understandable,
> but still annoying.
> > 
> > - It generates pdf 1.5 - when used in combination with
> xetex, - which uses xdvipdfmx for pdf generation, and
> xdvipdfmx has the rather disturbing behavior of *silently*
> *skipping* included pdf's that's higher than the default
> (instead of do it with warning like pdfTeX) so no graphics
> will be included, unless xetex is run with
> -output-driver="xdvipdfmx -V 5"... to declare to output pdf
> 1.5 .
> > 
> > - xetex needs noae in \usepackage{SWeave}. FWIW,
> Werner Lemberg's CJK (the LaTeX package) can work without
> declaring noae, so that's my preferred choice at the moment,
> although I have got both of them working, for doing Chinese
> in a LaTeX document.
> > 
> > I think some of these information should go into the
> man page of cairo_pdf()...
> > 
> 
> Well, I don't see how most of the above is in any way
> relevant. What PDF gets generated really depends on the
> cairo version you are using, not on R. Only most recent
> versions of Cairo (1.10.x) switched the format to PDF-1.5
> and added format restriction functions, they are not
> available in general. In addition, PDF-1.5 is 8 years old,
> so whatever tools can't deal with it are seriously out of
> date.

That's ignorant. In terms of visual elements and desktop publishing, the last major change in the pdf specification was 1.4, which introduces transparency. Most open-source pdf rendering capbalities are based on either ghostscript or xpdf/libpoppler . (TexLive/xetex/xdvipdfmx in the latter camp). Granted the developer od xdivpdfmx made a strange decision - the pdf specification explicitly state that renderers/readers should ignore features they don't understand and make "best effort" rather than abort, but what you claimed - "whatever tools cannot cannot deal with [PDF-1.5] are seriously out of date" is utterly wrong: neither ghostscript nor libpopper supports that fully. And I wonder what "tools" you use (other than Acrobat) are not based on those two.

FWIW, have a look at ghostscript's bug database, and search for "cairo".



[Rd] Sweave, cairo_pdf, xetex, CJK (Re: Sweave, cairo_pdf, CJK, ghostscript)
Hin-Tak Leung