Documentation
¶
Overview ¶
package printer provides standard printer settings.
Index ¶
- type PageSizes
- func (i PageSizes) Desc() string
- func (i PageSizes) Int64() int64
- func (i PageSizes) MarshalText() ([]byte, error)
- func (i *PageSizes) SetInt64(in int64)
- func (i *PageSizes) SetString(s string) error
- func (s PageSizes) Size() (un units.Units, size math32.Vector2)
- func (i PageSizes) String() string
- func (i *PageSizes) UnmarshalText(text []byte) error
- func (i PageSizes) Values() []enums.Enum
- type SettingsData
- func (ps *SettingsData) Apply()
- func (ps *SettingsData) Defaults()
- func (ps *SettingsData) Filename() string
- func (ps *SettingsData) FontScale() float32
- func (ps *SettingsData) Label() string
- func (ps *SettingsData) MakeToolbar(p *tree.Plan)
- func (ps *SettingsData) ToDots(un *units.Context) (size, body math32.Vector2, margins sides.Floats)
- func (ps *SettingsData) Update()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PageSizes ¶
type PageSizes int32 //enums:enum
Sizes are standard physical drawing sizes
const ( // Custom = nonstandard Custom PageSizes = iota // Image 1280x720 Px = 720p Img1280x720 // Image 1920x1080 Px = 1080p HD Img1920x1080 // Image 3840x2160 Px = 4K Img3840x2160 // Image 7680x4320 Px = 8K Img7680x4320 // Image 1024x768 Px = XGA Img1024x768 // Image 720x480 Px = DVD Img720x480 // Image 640x480 Px = VGA Img640x480 // Image 320x240 Px = old CRT Img320x240 // A4 = 210 x 297 mm A4 // USLetter = 8.5 x 11 in = 612 x 792 pt USLetter // USLegal = 8.5 x 14 in = 612 x 1008 pt USLegal // A0 = 841 x 1189 mm A0 // A1 = 594 x 841 mm A1 // A2 = 420 x 594 mm A2 // A3 = 297 x 420 mm A3 // A5 = 148 x 210 mm A5 // A6 = 105 x 148 mm A6 // A7 = 74 x 105 A7 // A8 = 52 x 74 mm A8 // A9 = 37 x 52 A9 // A10 = 26 x 37 A10 )
const PageSizesN PageSizes = 22
PageSizesN is the highest valid value for type PageSizes, plus one.
func DefaultPageSizeForRegion ¶
DefaultPageSizeForRegion returns the default page size based on locale region value, per the https://www.rfc-editor.org/rfc/bcp/bcp47.txt standard. See system.Locale and system.App for how to get this.
func PageSizesValues ¶
func PageSizesValues() []PageSizes
PageSizesValues returns all possible values for the type PageSizes.
func (PageSizes) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*PageSizes) SetString ¶
SetString sets the PageSizes value from its string representation, and returns an error if the string is invalid.
func (*PageSizes) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type SettingsData ¶
type SettingsData struct {
// PageSize specifies a standard page size, or Custom.
PageSize PageSizes
// Units are the units in which the page size is specified.
// Will automatically be set if PageSize != Custom.
Units units.Units
// Size is the page size in given units.
// Will automatically be set if PageSize != Custom.
Size math32.Vector2
// Margins specify the page margins in the size units.
Margins sides.Floats `display:"inline"`
// FontFamily specifies the font family to use for printing.
// The default SansSerif font used on screen may not be desired
// for printouts, where Serif is more typically used.
FontFamily rich.Family
// FontSize specifies the base font size to use for scaling printed
// text output (i.e., the default Text font will be this size, with
// larger elements scaled appropriately).
FontSize units.Value
// LineHeight is the default line height for standard text elements,
// in proportion to the font size (e.g., 1.25), which determines the
// spacing between lines.
LineHeight float32
}
Settings has standard printer settings.
var Settings SettingsData
Settings provides the default printer settings. This is initialized by the system.App because it depends on the locale for initialization.
func (*SettingsData) Apply ¶
func (ps *SettingsData) Apply()
func (*SettingsData) Defaults ¶
func (ps *SettingsData) Defaults()
func (*SettingsData) Filename ¶
func (ps *SettingsData) Filename() string
func (*SettingsData) FontScale ¶
func (ps *SettingsData) FontScale() float32
FontScale returns the scaling factor based on FontSize, relative to the core default font size of 16 Dp.
func (*SettingsData) Label ¶
func (ps *SettingsData) Label() string
func (*SettingsData) MakeToolbar ¶
func (ps *SettingsData) MakeToolbar(p *tree.Plan)
func (*SettingsData) ToDots ¶
ToDots returns the measurement values in rendering dots (actual pixels) based on the given units context. size = page size; body = content area inside margins
func (*SettingsData) Update ¶
func (ps *SettingsData) Update()