The joys of conflicting comments

No wonder I kept being confused about the various text width functions:

/* Returns the EXACT width of text in pixels, using the current font
   This operation just has to be defined for renderers that are
   interactive, (ie. the screen). As you can't generally calculate
   exact widths otherwise.
typedef real (*GetTextWidthFunc) (Renderer *renderer,
                                  const utfchar *text, int length);

/* Takes pixel length and returns real length */
ddisplay_untransform_length(DDisplay *ddisp, real len)
  return len / ddisp->zoom_factor;

static real
get_text_width(RendererGdk *renderer,
               const utfchar *text, int length)
  return ddisplay_untransform_length(renderer->ddisp, (real) iwidth);

Looks to me like the comment for GetTextWidthFunc is wrong, yes?  At least
it seems that the places using it expect cm, not pixels.  We shouldn't
really know about pixel widths outside of the renderers anyway,


Lars Clausen (| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]