Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Automatically stretching/growing (*when possible) delimiters.
No need to import this module directly.
NOTE: these stretching delimiters are composed from overlayed unicode glyphs. They are designed to work with the STIX fonts, other fonts may produce unacceptable results. Transparent rendering is broken too (though that could be fixed in principle).
TODO:
- growing ceil/floor
- "compound" brackets like
[[
,{|
, etc - fix subscripts and superscripts of big delimited things
- cleaner implementation
- maybe hardwire the required glyphs from STIX so that it works with any font?
- fix transparency
Synopsis
- delimHangAbove :: Double
- delimHangBelow :: Double
- delimHMargin :: Double
- delimVMargin :: Double
- data CompoundDelim
- = FixDelim (forall a. Document a)
- | Adjustable (forall a. Double -> Document a)
- sizedCompoundDelim :: CompoundDelim -> Double -> Document a
- rescale :: (Double, Double) -> Double -> Double
- rescaleTo :: (Double, Double) -> (Double, Double) -> Double -> Double
- fdivmod :: Double -> Double -> (Int, Double)
- symmNegMargin :: Double -> Document a -> Document a
- topNegMargin :: Double -> Document a -> Document a
- botNegMargin :: Double -> Document a -> Document a
- type DelimGrower a = Height -> WhichDelim -> Double -> Document a
- data DelimImpl
- = GrowingDelim (forall a. DelimGrower a)
- | FixedDelim !(Char, Char)
- delimiterImpl :: Delimiter -> DelimImpl
- finalDelim :: Height -> Delimiter -> Double -> WhichDelim -> Document a
- finalDelim' :: Double -> Height -> Delimiter -> Double -> WhichDelim -> Document a
- growBrace :: Height -> WhichDelim -> Double -> Document a
- growParen :: Height -> WhichDelim -> Double -> Document a
- growBracket :: Height -> WhichDelim -> Double -> Document a
- growVertical :: Height -> WhichDelim -> Double -> Document a
- growDblVertical :: Height -> WhichDelim -> Double -> Document a
- type CompoundLevel = Int
- type DelimBuilder = Height -> CompoundLevel -> WhichDelim -> CompoundDelim
- buildBrace :: DelimBuilder
- buildParen :: DelimBuilder
- buildBracket :: DelimBuilder
- buildVertical :: DelimBuilder
- buildDblVertical :: DelimBuilder
- lparenTop :: Char
- lparenExt :: Char
- lparenBot :: Char
- rparenTop :: Char
- rparenExt :: Char
- rparenBot :: Char
- lbracketTop :: Char
- lbracketExt :: Char
- lbracketBot :: Char
- rbracketTop :: Char
- rbracketExt :: Char
- rbracketBot :: Char
- lbraceTop :: Char
- lbraceMid :: Char
- lbraceBot :: Char
- lrBraceExt :: Char
- rbraceTop :: Char
- rbraceMid :: Char
- rbraceBot :: Char
- intTop :: Char
- intExt :: Char
- intBot :: Char
- braceSection1 :: Char
- braceSection2 :: Char
Documentation
data CompoundDelim Source #
A compound delimiter is built from overlayed Unicode glyphs. It can be either fixed (a single glyph; two glyphs next to each other), or adjustable (glyphs with adjustable overlap)
FixDelim (forall a. Document a) | something whose size is fixed |
Adjustable (forall a. Double -> Document a) | something whose size can be adjusted |
sizedCompoundDelim :: CompoundDelim -> Double -> Document a Source #
Utility
Growing delimiters
type DelimGrower a = Height -> WhichDelim -> Double -> Document a Source #
GrowingDelim (forall a. DelimGrower a) | |
FixedDelim !(Char, Char) |
delimiterImpl :: Delimiter -> DelimImpl Source #
finalDelim :: Height -> Delimiter -> Double -> WhichDelim -> Document a Source #
finalDelim' :: Double -> Height -> Delimiter -> Double -> WhichDelim -> Document a Source #
Figuring out how to build a delimiter of the target size
growBrace :: Height -> WhichDelim -> Double -> Document a Source #
Note: target height is relative to the font height, but not including line gap! You have to take line gap into account yourself if necessary.
growBracket :: Height -> WhichDelim -> Double -> Document a Source #
growVertical :: Height -> WhichDelim -> Double -> Document a Source #
growDblVertical :: Height -> WhichDelim -> Double -> Document a Source #
Delimiter builders
type CompoundLevel = Int Source #
type DelimBuilder = Height -> CompoundLevel -> WhichDelim -> CompoundDelim Source #
Unicode codepoint constants
lbracketTop :: Char Source #
lbracketExt :: Char Source #
lbracketBot :: Char Source #
rbracketTop :: Char Source #
rbracketExt :: Char Source #
rbracketBot :: Char Source #
lrBraceExt :: Char Source #
braceSection1 :: Char Source #
braceSection2 :: Char Source #