When I began working on phase one of my Google Summer of Code project, Inkscape’s unit handling code was scattered between multiple implementations with different files using different, incompatible implementations. I since consolidated this code into one implementation, residing in util/units.*
, eliminating SPUnit
, SPMetric
, and unit-constants.h
.
I also started to replace the SVGLength
class but then changed my mind about doing so as the class is specific to the SVG specification, not general units. For example, common units, e.g. feet, are not part of the specification. I still may make it a child class of Util::Unit
during phase two, depending on how I end up implementing things, but will leave it alone for now.
With these changes, I have consolidated Inkscape’s unit handling code, completing phase one of my Google Summer of Code project. Although there are only some minor user-facing changes, mostly bug fixes, the internal changes will facilitate the addition of user-facing changes both in phase two and beyond. As an example, pixels per inch are no longer hard-coded, so I plan on adding an option both in Inkscape preferences and document properties to configure the relationship between pixels and physical units early on in phase two. To begin phase two, I plan on hand-crafting SVG files with various types of unit configurations and then implementing support for them starting with a default document-wide unit.