Documentation ¶
Index ¶
- Variables
- type Length
- type Orientation
- func (enum Orientation) Dimensions(width, height Length) (adjustedWidth, adjustedHeight Length)
- func (enum Orientation) EnsureValid() Orientation
- func (enum Orientation) Key() string
- func (enum Orientation) MarshalText() (text []byte, err error)
- func (enum Orientation) String() string
- func (enum *Orientation) UnmarshalText(text []byte) error
- type Size
- type Unit
Constants ¶
This section is empty.
Variables ¶
var Orientations = []Orientation{ Portrait, Landscape, }
Orientations holds all possible values.
Sizes holds all possible values.
var Units = []Unit{ Inch, Centimeter, Millimeter, }
Units holds all possible values.
Functions ¶
This section is empty.
Types ¶
type Length ¶
Length contains a real-world length value with an attached units.
func LengthFromString ¶
LengthFromString creates a new Length. May have any of the known unit suffixes or no notation at all, in which case inch is used.
func ParseLengthFromString ¶
ParseLengthFromString parses a Length from the text. May have any of the known unit suffixes or no notation at all, in which case inch is used.
func (*Length) EnsureValidity ¶
func (l *Length) EnsureValidity()
EnsureValidity checks the current settings for validity and if they aren't valid, makes them so.
func (Length) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Length) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Orientation ¶
type Orientation byte
Orientation holds the orientation of the page.
const ( Portrait Orientation = iota Landscape )
Possible values.
const LastOrientation Orientation = Landscape
LastOrientation is the last valid value.
func ExtractOrientation ¶
func ExtractOrientation(str string) Orientation
ExtractOrientation extracts the value from a string.
func (Orientation) Dimensions ¶
func (enum Orientation) Dimensions(width, height Length) (adjustedWidth, adjustedHeight Length)
Dimensions returns the paper dimensions after orienting the paper.
func (Orientation) EnsureValid ¶
func (enum Orientation) EnsureValid() Orientation
EnsureValid ensures this is of a known value.
func (Orientation) Key ¶
func (enum Orientation) Key() string
Key returns the key used in serialization.
func (Orientation) MarshalText ¶
func (enum Orientation) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (*Orientation) UnmarshalText ¶
func (enum *Orientation) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Size ¶
type Size byte
Size holds a standard paper dimension.
func (Size) Dimensions ¶
Dimensions returns the paper dimensions.
func (Size) EnsureValid ¶
EnsureValid ensures this is of a known value.
func (Size) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Size) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Unit ¶ added in v5.19.0
type Unit byte
Unit holds the real-world length unit type.
const LastUnit Unit = Millimeter
LastUnit is the last valid value.
func ExtractUnit ¶ added in v5.19.0
ExtractUnit extracts the value from a string.
func (Unit) EnsureValid ¶ added in v5.19.0
EnsureValid ensures this is of a known value.
func (Unit) MarshalText ¶ added in v5.19.0
MarshalText implements the encoding.TextMarshaler interface.
func (Unit) ToPixels ¶ added in v5.19.0
ToPixels converts the given length in this Units to the number of 72-pixels-per-inch pixels it represents.
func (*Unit) UnmarshalText ¶ added in v5.19.0
UnmarshalText implements the encoding.TextUnmarshaler interface.