[cairo] _cairo_lround (and effects on positioning of text)

Behdad Esfahbod behdad at behdad.org
Wed Nov 22 16:12:30 PST 2006


On Tue, 2006-11-21 at 20:58 -0500, Carl Worth wrote:
> On Tue, 21 Nov 2006 17:37:02 -0800, Carl Worth wrote:
> > I suppose it's "only" text that's going to be affected by this,
> 
> I did just verify that the patch only introduces _cairo_lround to
> glyph-related function, (at least for supported backends---there is
> also one case of _cairo_lround in _cairo_directfb_surface_composite
> which I haven't looked at closely yet).
> 
> > So, do we care that this patch might move some text around by a pixel
> > compared to where it was drawn before?
> 
> Phrased another way, how do we want to document the behavior of the
> values passed to cairo_show_glyphs? We're accepting floating-point
> values, but then rounding them. Do we really want to specify banker's
> rounding for this? That feels so wrong.

I'm all for "undefined rounding".

> Maybe we really should have just provided an integer-only API for
> positioning text glyphs. (If so, one option would be to document that
> the API really should be used with only integers for now, and that the
> rounding mode is undefined for any non-integer value.)

Am I missing something here?  Integer positions don't make sense for at
least three reasons:

  1) They have to pass the CTM and font_matrix before becoming device
coordinates.
  2) Rounding is already relevant for raster backends.
  3) Subpixel glyph positioning is just a lacking feature.  FreeType
already implements that.  Cairo will do at some point.


> I'd at least
> feel more comfortable specifying undefined rounding behavior than
> banker's rounding for this.
> 
> -Carl

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list