The basic typesetting unit is a “scaled point” (sp) and the Go type is
bag.ScaledPoint. One DTP point (1/72 inch) consists of 65535 scaled points.
There are two methods (
bag.MustSp()) to convert from other units to sp.
The known units are
||There are 65535 scaled points in one DTP point. For conversion, always use the constant
||Inch – 72 DTP points are one inch.|
||Millimeter (1/1000 of one meter)|
||Centimeter (1/100 of one meter)|
||Pixel - 96 Pixes are one inch|
||Pica – twelve DTP points or 1/6 inch|
These two functions convert strings such as
"12.4in" to scaled points. The
MustSP function panics if it cannot convert the unit.
To convert from scaled points to other units use
To convert to DTP points use
There are a few convenience functions:
if you need to multiply a scaled point with a float.
ScaledPoint type implements the
Stringer interface which returns a string suitable for the PDF file.