css

package
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2019 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	UnitPx         numberUnit //used to encode 'px' numbers
	UnitCm                    //used to encode 'cm' numbers
	UnitMm                    //used to encode 'mm' numbers
	UnitIn                    //used to encode 'in' numbers
	UnitPt                    //used to encode 'pt' numbers
	UnitPc                    //used to encode 'pc' numbers
	UnitPercentage            //used to encode '%' numbers
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Fraction

type Fraction float32

Fraction is helper type to encode VgFraction type, that can be from 0.0 to 1.0 or in percentage, e.g. 50% N.B.: Fraction always transforms percentage to float, e.g. 50% -> 0.5

func (*Fraction) UnmarshalXMLAttr

func (f *Fraction) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr unmarshal Fraction

type Number

type Number struct {
	// contains filtered or unexported fields
}

Number is helper type which allow to encode numbers with units. To simplify, integer as value in pixels and float as value in points. Eg. 10 => 10px, 10.5 => 10.5pt

func NewNumber

func NewNumber(n interface{}, o ...numberUnit) Number

NewNumber returns a Number type for provided value

func (Number) MarshalXMLAttr

func (t Number) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr marshal Number

func (Number) String

func (t Number) String() string

String returns string presentation of Number

func (*Number) UnmarshalXMLAttr

func (t *Number) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr unmarshal Number

type Position

type Position byte
const (
	PositionStatic Position = iota
	PositionAbsolute
	PositionRelative
)

func (Position) MarshalXMLAttr

func (t Position) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr marshal Position

func (Position) String

func (t Position) String() string

String returns string presentation of Position

func (*Position) UnmarshalXMLAttr

func (t *Position) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr unmarshal Position

type Style

type Style struct {
	Position          Position        `css:"position"`
	Left              Number          `css:"left"`
	MarginLeft        Number          `css:"margin-left"`
	Top               Number          `css:"top"`
	MarginTop         Number          `css:"margin-top"`
	Right             Number          `css:"right"`
	MarginRight       Number          `css:"margin-right"`
	Bottom            Number          `css:"bottom"`
	MarginBottom      Number          `css:"margin-bottom"`
	Width             Number          `css:"width"`
	Height            Number          `css:"height"`
	ZIndex            int             `css:"z-index"`
	Visible           Visibility      `css:"visibility"`
	Flip              string          `css:"flip"`
	Font              string          `css:"font"`
	TextDecoration    string          `css:"text-decoration"`
	Trim              ml.TriStateType `css:"trim"`
	XScale            ml.TriStateType `css:"xscale"`
	MSOFitShapeToText ml.TriStateType `css:"mso-fit-shape-to-text"`
	MSOFitTextToShape ml.TriStateType `css:"mso-fit-text-to-shape"`
	MSOTextShadow     ml.TriStateType `css:"mso-text-shadow"`
	MSODirectionAlt   string          `css:"mso-direction-alt"`
	MSOLayoutFlowAlt  string          `css:"mso-layout-flow-alt"`
	MSONextTextbox    string          `css:"mso-next-textbox"`
	MSORotate         float64         `css:"mso-rotate"`
	MSOTextScale      float64         `css:"mso-text-scale"`
}

Style is helper type for AG_Style

func NewStyle

func NewStyle(s string) *Style

NewStyle decodes VML CSS string into Style type

func (*Style) MarshalXMLAttr

func (s *Style) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr marshal Style

func (Style) String

func (s Style) String() string

String is alias for Encode that return string version of styles

func (*Style) UnmarshalXMLAttr

func (s *Style) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr unmarshal Style

type Visibility

type Visibility byte
const (
	VisibilityInherit Visibility = iota
	VisibilityHidden
	VisibilityVisible
	VisibilityCollapse
)

func (Visibility) MarshalXMLAttr

func (t Visibility) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr marshal Visibility

func (Visibility) String

func (t Visibility) String() string

String returns string presentation of Visibility

func (*Visibility) UnmarshalXMLAttr

func (t *Visibility) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr unmarshal Visibility

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL