diff --git a/src/utils/units.cpp b/src/utils/units.cpp index 2c7a1237..deb4aa7c 100644 --- a/src/utils/units.cpp +++ b/src/utils/units.cpp @@ -45,6 +45,9 @@ namespace units_utils { return static_cast(math_util::percentage_to_value(g_format.percentage, max) + offset_pixel); } + /** + * Same as percentage_with_offset_to_pixel but capped below at 0 pixels + */ unsigned percentage_with_offset_to_pixel_nonnegative(percentage_with_offset g_format, double max, double dpi) { return std::max(0, percentage_with_offset_to_pixel(g_format, max, dpi)); } @@ -135,6 +138,11 @@ namespace units_utils { return {type, size_value}; } + /** + * Creates an extent from a spacing value. + * + * @param spacing Value to convert, must not be SPACE + */ extent_val spacing_to_extent(spacing_val spacing) { extent_type t;