nanovg-0.5.2.0: Haskell bindings for nanovg

Safe HaskellSafe
LanguageHaskell2010

NanoVG.Internal.Text

Synopsis

Documentation

newtype Font Source #

Newtype to avoid accidental use of ints

Constructors

Font 

Fields

Instances

data TextRow Source #

Constructors

TextRow 

Fields

  • start :: !(Ptr CChar)

    Pointer to the input text where the row starts.

  • end :: !(Ptr CChar)

    Pointer to the input text where the row ends (one past the last character).

  • next :: !(Ptr CChar)

    Pointer to the beginning of the next row.

  • width :: !CFloat

    Logical width of the row.

  • textRowMinX :: !CFloat

    Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.

  • textRowMaxX :: !CFloat
     

createFont :: Context -> Text -> FileName -> IO (Maybe Font) Source #

Creates font by loading it from the disk from specified file name. Returns handle to the font.

createFontMem :: Context -> Text -> ByteString -> IO (Maybe Font) Source #

Creates image by loading it from the specified memory chunk. Returns handle to the font.

findFont :: Context -> Text -> IO (Maybe Font) Source #

Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.

fontSize :: Context -> CFloat -> IO () Source #

Sets the font size of current text style.

fontBlur :: Context -> CFloat -> IO () Source #

Sets the blur of current text style.

textLetterSpacing :: Context -> CFloat -> IO () Source #

Sets the letter spacing of current text style.

textLineHeight :: Context -> CFloat -> IO () Source #

Sets the proportional line height of current text style. The line height is specified as multiple of font size.

textAlign :: Context -> Set Align -> IO () Source #

Sets the text align of current text style, see NVGalign for options.

fontFaceId :: Context -> Font -> IO () Source #

Sets the font face based on specified id of current text style.

fontFace :: Context -> Text -> IO () Source #

Sets the font face based on specified name of current text styl

text :: Context -> CFloat -> CFloat -> Ptr CChar -> Ptr CChar -> IO () Source #

Draws text string at specified location. If end is specified only the sub-string up to the end is drawn.

textBox :: Context -> CFloat -> CFloat -> CFloat -> Text -> IO () Source #

Draws multi-line text string at specified location wrapped at the specified width. If end is specified only the sub-string up to the end is drawn. | White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. | Words longer than the max width are slit at nearest character (i.e. no hyphenation).

textBounds :: Context -> CFloat -> CFloat -> Text -> IO Bounds Source #

Measures the specified text string. Parameter bounds should be a pointer to float[4], if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] Returns the horizontal advance of the measured text (i.e. where the next character should drawn). Measured values are returned in local coordinate space.

textBoxBounds :: Context -> CFloat -> CFloat -> CFloat -> Text -> IO Bounds Source #

Measures the specified multi-text string. Parameter bounds should be a pointer to float[4], if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] Measured values are returned in local coordinate space.

textGlyphPositions :: Context -> CFloat -> CFloat -> Ptr CChar -> Ptr CChar -> GlyphPositionPtr -> CInt -> IO CInt Source #

Calculates the glyph x positions of the specified text. If end is specified only the sub-string will be used. Measured values are returned in local coordinate space.

textMetrics :: Context -> IO (CFloat, CFloat, CFloat) Source #

Returns the vertical metrics based on the current text style. Measured values are returned in local coordinate space.

textBreakLines :: Context -> Ptr CChar -> Ptr CChar -> CFloat -> TextRowPtr -> CInt -> IO CInt Source #

Breaks the specified text into lines. If end is specified only the sub-string will be used. White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer than the max width are slit at nearest character (i.e. no hyphenation).