Re: [Bug 90166] Add a way to specify units (in SVG output)
David Kastrup <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Adrian Johnson <[email protected]> writes: > On 16/10/17 07:42, Petr Kobalíček wrote: >> 'MM/CM' vs 'INCHES' and all others seems inconsistent to me. > > What do you suggest? > >> >> On Thu, Oct 12, 2017 at 9:38 PM, Adrian Johnson <[email protected] >> <mailto:[email protected]>> wrote: >> >> On 12/10/17 21:59, Adrian Johnson wrote: >> > On 12/10/17 20:55, Antonio Ospite wrote: >> >> The API addition I originally proposed[1,2] looks like this: >> >> >> >> void cairo_svg_surface_set_document_unit (cairo_surface_t*, >> >> cairo_svg_unit_t) >> >> >> >> Where cairo_svg_unit_t is an enum type representing all the possible >> >> units. >> > >> > The enum in the patch is: >> > >> > typedef enum _cairo_svg_unit { >> > CAIRO_SVG_UNIT_EM, >> > CAIRO_SVG_UNIT_EX, >> > CAIRO_SVG_UNIT_PX, >> > CAIRO_SVG_UNIT_IN, >> > CAIRO_SVG_UNIT_CM, >> > CAIRO_SVG_UNIT_MM, >> > CAIRO_SVG_UNIT_PT, >> > CAIRO_SVG_UNIT_PC, >> > CAIRO_SVG_UNIT_PERCENT, >> > CAIRO_SVG_UNIT_USER >> > } cairo_svg_unit_t; >> >> We don't have to use the SVG abbreviations in the enum. The non standard >> abbreviations can be expanded to make it clearer. I've reordered it >> slightly to put the default first followed by the more common units. >> >> typedef enum _cairo_svg_unit { >> CAIRO_SVG_UNIT_POINTS, >> CAIRO_SVG_UNIT_PIXELS, >> CAIRO_SVG_UNIT_MM, >> CAIRO_SVG_UNIT_CM, >> CAIRO_SVG_UNIT_INCHES, >> CAIRO_SVG_UNIT_PICAS, >> CAIRO_SVG_UNIT_FONT_EM, >> CAIRO_SVG_UNIT_FONT_X, >> CAIRO_SVG_UNIT_PERCENT, >> CAIRO_SVG_UNIT_USER >> } cairo_svg_unit_t; Frankly, this is not just the "SVG abbreviations". It's TeX terminology as well as used in HTML/CSS. Programmers will tend to know the two character abbreviations better than the long names (FONT_X ? For real?). This does not look like an actual improvement to me. That it prompts a bikeshedding discussion should be proof enough that this makes things more rather than less arbitrary and harder rather than easier to guess. -- David Kastrup -- cairo mailing list [email protected] https://lists.cairographics.org/mailman/listinfo/cairo