[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-dev
Subject:    Re: [PEAR-DEV] Image_Canvas: How to correct font-size with
From:       Michael Gauthier <mike () silverorange ! com>
Date:       2010-01-04 18:06:44
Message-ID: 1262628404.2601.9.camel () mir
[Download RAW message or body]

On Mon, 2009-12-21 at 03:04 +0100, Stefan Neufeind, PEAR wrote:
> Hi,
> 
> it turns out that during creation of the Image_Canvas-package one thing
> was overlooked: Since GD2 (which I suspect most people use nowadays) the
> TTF-functions use a font-size with points instead of pixels. And yes,
> that makes quite some difference :-)
> 
> In the API (phpdoc) it's documented that the font-size is given in
> pixels. So actually according to the API-doc a correction-factor is
> needed for TTF-functions for everything using Image_Canvas with GD2.
> 
> However on the other hand one might possibly assume that quite a number
> of people used it with GD as their canvas-type. So the other way of
> "getting it right" might also be to correct the API-docs to say "points"
> instead of "pixels" and fix the other output-drivers (e.g. SVG).
> 
> Either way BC needs to be broken to get it (some sort of) correct and
> consistent, allowing to switch from GD-output to e.g. SVG-output without
> too much difference. (Note that anyhow there will be some difference in
> calculation of a font-size etc.).
> 
> 
> Please let me know what you think. I'll do my best to take them into
> account and make a "wise" decision for the BC-breakage. *sigh*
> 
> 
> Kind regards,
>  Stefan
> 

Hi Stefan,

I'd say most developers using Image_Canvas are using the gd backend. In
this case, I'd suggest updating the docs to specifically say "points"
instead of "pixels" and then fix the other backends. This seems like the
less likely fix to cause problems to existing code.

In the future, it might be nice to provide related methods that work in
pixels, or to provide an optional parameter to the font size to specify
units. For now, updating the API documentation and fixing the other
backends is fine.

Cheers,


Mike


-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic