|
From: Allin C. <cot...@wf...> - 2009-09-10 18:38:22
|
On Wed, 9 Sep 2009, Ethan Merritt wrote: > On Wednesday 09 September 2009, Allin Cottrell wrote: > > > > I like the *cairo terminals a lot: PNG looks good on screen and > > PDF is good for publication-quality output; and these two > > terminals share a common command-set with high fidelity, since > > they use a common back-end. Except for one thing... > > > > The help for both pngcairo and pdfcairo says that the default size > > for fonts is 6 points. That's fine, and if you go with the > > default you get quite consistent-looking output from the two > > terminals. > > > > But if you alter the size, an inconsistency emerges. Suppose I'd > > prefer 8 points. I do my PNG plot using > > > > set term pngcairo font ",8" > > > > then do my PDF plot using > > > > set term pdfcairo font ",8" > > > > Relative to the "6-point" baseline, the PNG file shows a smaller > > font (8 < 6, hmm) while the PDF plot shows a larger font (8 > 6). > > > > I'm happy to take a look at the code and see if I can come up with > > a patch for this. But I'd rather hear any comments first. > > I don't see anything immediately in looking at the code. > It really is initialized to 6, but after that it seems to just pass > through any request to the cairo library. Ah, in cairo.trm we have two alternative default initializations, CAIROPDF_PARAMS_DEFAULT and CAIROPNG_PARAMS_DEFAULT; the former specifies a 6-point font and the latter specifies 12-point. > The whole idea of "font size" in a png image is kind of arbitrary anyhow, > since it depends entirely on the pixel size of the device it is viewed on. Yes, agreed, there is a degree of freedom here, and I think the following may be the implicit logic of how that degree of freedom is used at present: * In pdfcairo a 6-point font looks appropriate. * We want the default appearance of PNG to be similar to PDF. * You get similar-looking output by setting a fontsize of 12 for pngcairo. * So we'll call that (fontsize = 12) "6 points" in the doc for pngcairo. This seems alright until the user changes the font size in pngcairo, and sees that "8 point" comes out smaller than "6 point". What's to be done? One option would be to multiply the user's font size specification by 2 in the case of pngcairo, to make it consistent with the "6 point" default. That is, if I say set term pngcairo font "foo,8" the actual size sent to the driver is 16. The alternative would be to amend the doc for pngcairo to say that the default is 12 points. This has the advantage that it doesn't change the output of existing gnuplot scripts, but the disadvantage that it ratifies the situation where you have to apply a factor of 2 to the font size if you want comparable output from pdfcairo and pngcairo (in the case where you're not just accepting the default size). Allin Cottrell |