cattrap-0.2.0.0: Lays out boxes according to the CSS Box Model.
Safe HaskellNone
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.

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`.

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

  • hbFont :: Font

    The Harfbuzz font used to shape text & query character-size information.

  • pattern :: Pattern

    The FontConfig query result. Useful to incorporate into output rendering.

  • fontHeight :: Char -> Double

    Query the height of a character. Used for cap, ex, or ic units.

  • fontAdvance :: Char -> Double

    Query the width of a character, used for ch unit.

  • fontSize :: Double

    The desired font-size, used for em unit.

  • rootEm :: Double

    The root font's size, used for rem unit.

  • lineheight :: Double

    The desired line-height, used for lh unit.

  • rlh :: Double

    The root font's line-height, used for rlh unit.

  • vh :: Double

    Scale-factor for vh unit.

  • vw :: Double

    Scale-factor for vw unit.

  • vmax :: Double

    Scale-factor for vmax unit.

  • vmin :: Double

    Scale-factor for vmin unit.

  • scale :: Double

    How many device pixels in a CSS px?

Instances

Instances details
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 #