Use typedef for Pango units?
Submitted by ton..@..un.com
Assigned to Behdad Esfahbod
Pango uses 'int' to represent both device units and Pango units (1/PANGO_SCALE device units).
Working out whether an 'int' represents device units or Pango units comes down to reading the documentation, but sometimes that doesn't tell you. For example, the x_pos argument to pango_glyph_string_x_to_index() is documented as "the x offset (in thousands of a device unit)", but the x_pos argument to pango_glyph_string_index_to_x() is documented as "location to store result"
Making a typedef for Pango units, e.g.:
typedef int PangoUnit;
in pango-types.h and using the typedef for all parameters and return values that are in Pango units will make the uses of Pango units obvious even if someone reads just the header files instead of the documentation.