cattrap-0.6.0.0: Lays out boxes according to the CSS Box Model.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Graphics.Layout.CSS.Length

Description

Infrastructure for parsing & desugaring length units & keywords, in reference to the selected font.

Synopsis

Documentation

type Unitted = (Double, Text) Source #

A number+unit, prior to resolving side units. The unit may alternately represent a keyword, in which case the number is ignored & typically set to 0.

auto :: Unitted Source #

The CSS auto keyword.

parseLength :: [Token] -> Maybe Unitted Source #

Parse a pre-tokenized CSS length value.

parseLength' :: [Token] -> Maybe (Double, Text) Source #

Variant of parseLength which supports min-content & max-content keywords.

units :: [Text] Source #

Supported length units.

n2f :: (Fractional x, RealFloat x) => NumericValue -> x Source #

Convert a lexed number to a Double.

finalizeLength :: Unitted -> Font' -> Length Source #

Resolve a parsed length according to the sizing parameters in a given Font'.

finalizeLengths :: Font' -> [Token] -> [Token] Source #

Convert any length-units in the given CSS tokens to device pixels

px2pt :: Font' -> Double -> Double Source #

Convert from a computed length to the "pt" unit.

data Font' Source #

A Harfbuzz font with sizing parameters.

Constructors

Font' 

Fields

Instances

Instances details
Show Font' Source # 
Instance details

Defined in Graphics.Layout.CSS.Length

Methods

showsPrec :: Int -> Font' -> ShowS #

show :: Font' -> String #

showList :: [Font'] -> ShowS #

Eq Font' Source # 
Instance details

Defined in Graphics.Layout.CSS.Length

Methods

(==) :: Font' -> Font' -> Bool #

(/=) :: Font' -> Font' -> Bool #

(PropertyParser x, Zero m, Zero n) => Default (UserData m n x) Source # 
Instance details

Defined in Graphics.Layout.CSS

Methods

def :: UserData m n x Source #

Orphan instances

Zero Unitted Source # 
Instance details

Methods

zero :: Unitted Source #