Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Ui.Symbol

Description

A Symbol is a bit of text enclosed in ``s, such as sharp. When rendered, it's turned into a special graphic that may be made up of multiple glyphs from different fonts. The intent is to be able to write symbols in plain ascii but have them rendered in an attractive way on the score.

Symbols are rendered at the UI level and are generally static, so instead of sending the symbol data over every time I want to draw one, the UI level maintains a mapping between symbol names and data on how to render them.

This module is split from Ui.SymbolC so importers can avoid a C dependency.

Synopsis

Documentation

simple :: Text -> Text -> Symbol Source #

Make a simple symbol with only text.

data Symbol Source #

A Symbol has a name and a list of the Glyphs that make it up.

If the bounding box is not given, it will be inferred from the first glyph. The bounding box will be scaled by the eventual font size. Don't pass an empty glyphs list.

Constructors

Symbol 

Fields

  • name :: Text
     
  • absolute_y :: Bool

    Turn on absolute y placement, disabling automatic y placement. If the glyphs have descenders and you want them to actually descend, turn this on.

  • glyphs :: [Glyph]
     

Instances

data Glyph Source #

Constructors

Glyph 

Fields

  • glyph_text :: Text

    Unicode characters that make up the glyph.

  • glyph_font :: Maybe Font
     
  • glyph_size :: Int

    Relative size. This is added to the font size when the glyph is drawn.

  • glyph_align :: (Double, Double)

    This is scaled by the font size and added to the position of the glyph. In a symbol with only one glyph, automatic y placement will defeat a y value here unless you set sym_absolute_y.

  • glyph_rotate :: Int

    Rotate the glyph in degrees.

Instances