Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

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

Instances details
Show Symbol Source # 
Instance details

Defined in Ui.Symbol

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

Instances details
Show Glyph Source # 
Instance details

Defined in Ui.Symbol

Methods

showsPrec :: Int -> Glyph -> ShowS #

show :: Glyph -> String #

showList :: [Glyph] -> ShowS #