Dimension (rinoh.dimension)

Classes for expressing dimensions: lengths, widths, line thickness, etc.

Each dimension is expressed in terms of a unit. Several common units are are defined here as constants. To create a new dimension, multiply number with a unit:

height = 100*PT
width = 50*PERCENT

Fractional dimensions are evaluated within the context they are defined in. For example, the width of a Flowable is evaluated with respect to the total width available to it.

class rinoh.dimension.Dimension(value=0, unit=None)

A simple dimension

  • value (int or float) – the magnitude of the dimension

  • unit (DimensionUnit) – the unit this dimension is expressed in. Default: PT.


Grow this dimension (in-place)

The value is interpreted as a magnitude expressed in the same unit as this dimension.


value (int or float) – the amount to add to the magnitude of this dimension


Dimension – this (growed) dimension itself

rinoh.dimension.PT = DimensionUnit(1.0, 'pt')

PostScript points

rinoh.dimension.PICA = DimensionUnit(12.0, 'pc')

computer pica

rinoh.dimension.INCH = DimensionUnit(72.0, 'in')

imperial/US inch

rinoh.dimension.MM = DimensionUnit(2.8346456692913384, 'mm')


rinoh.dimension.CM = DimensionUnit(28.346456692913385, 'cm')


rinoh.dimension.PERCENT = FractionUnit(100, '%')

fraction of 100

rinoh.dimension.QUARTERS = FractionUnit(4, '/4')

fraction of 4