-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Bindings to SDL2_ttf.
--   
--   Haskell bindings to SDL2_ttf C++ library
--   <a>http://www.libsdl.org/projects/SDL_ttf/</a>.
@package sdl2-ttf
@version 2.1.0


-- | Raw bindings to the <tt>SDL2_ttf</tt> library. No error-handling is
--   done here. For more information about specific function behaviour, see
--   the <tt>SDL2_ttf</tt> documentation.
module SDL.Raw.Font
init :: forall m_acNc. MonadIO m_acNc => m_acNc CInt
wasInit :: forall m_acXY. MonadIO m_acXY => m_acXY CInt
quit :: forall m_acYK. MonadIO m_acYK => m_acYK ()
getVersion :: forall m_acMc. MonadIO m_acMc => m_acMc (Ptr Version)

-- | The raw, underlying <tt>TTF_Font</tt> struct.
data Font

-- | A path to a font file.
type FontPath = CString

-- | Point size (based on 72DPI). Translates to pixel height.
type PointSize = CInt
openFont :: MonadIO m => FontPath -> PointSize -> m (Ptr Font)

-- | Should the <a>Ptr</a> <a>RWops</a> be freed after an operation? 1 for
--   yes, 0 for no.
type Free = CInt
openFont_RW :: MonadIO m => Ptr RWops -> Free -> PointSize -> m (Ptr Font)

-- | Indicates the font face we're loading. First face is always 0.
type Index = CLong
openFontIndex :: MonadIO m => FontPath -> PointSize -> Index -> m (Ptr Font)
openFontIndex_RW :: MonadIO m => Ptr RWops -> Free -> PointSize -> Index -> m (Ptr Font)
closeFont :: MonadIO m => Ptr Font -> m ()
getFontStyle :: MonadIO m => Ptr Font -> m CInt
setFontStyle :: MonadIO m => Ptr Font -> CInt -> m ()
pattern TTF_STYLE_NORMAL :: forall a. (Eq a, Num a) => () => a
pattern TTF_STYLE_BOLD :: forall a. (Eq a, Num a) => () => a
pattern TTF_STYLE_ITALIC :: forall a. (Eq a, Num a) => () => a
pattern TTF_STYLE_UNDERLINE :: forall a. (Eq a, Num a) => () => a
pattern TTF_STYLE_STRIKETHROUGH :: forall a. (Eq a, Num a) => () => a
getFontOutline :: MonadIO m => Ptr Font -> m CInt
setFontOutline :: MonadIO m => Ptr Font -> CInt -> m ()
getFontHinting :: MonadIO m => Ptr Font -> m CInt
setFontHinting :: MonadIO m => Ptr Font -> CInt -> m ()
pattern TTF_HINTING_NORMAL :: forall a. (Eq a, Num a) => () => a
pattern TTF_HINTING_LIGHT :: forall a. (Eq a, Num a) => () => a
pattern TTF_HINTING_MONO :: forall a. (Eq a, Num a) => () => a
pattern TTF_HINTING_NONE :: forall a. (Eq a, Num a) => () => a
getFontKerning :: MonadIO m => Ptr Font -> m CInt
setFontKerning :: MonadIO m => Ptr Font -> CInt -> m ()
fontHeight :: MonadIO m => Ptr Font -> m CInt
fontAscent :: MonadIO m => Ptr Font -> m CInt
fontDescent :: MonadIO m => Ptr Font -> m CInt
fontLineSkip :: MonadIO m => Ptr Font -> m CInt
fontFaces :: MonadIO m => Ptr Font -> m CLong
fontFaceIsFixedWidth :: MonadIO m => Ptr Font -> m CInt
fontFaceFamilyName :: MonadIO m => Ptr Font -> m CString
fontFaceStyleName :: MonadIO m => Ptr Font -> m CString
glyphIsProvided :: MonadIO m => Ptr Font -> CUShort -> m CInt
glyphMetrics :: MonadIO m => Ptr Font -> CUShort -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> m CInt
getFontKerningSize :: MonadIO m => Ptr Font -> CInt -> CInt -> m CInt
sizeText :: MonadIO m => Ptr Font -> CString -> Ptr CInt -> Ptr CInt -> m CInt
sizeUTF8 :: MonadIO m => Ptr Font -> CString -> Ptr CInt -> Ptr CInt -> m CInt
sizeUNICODE :: MonadIO m => Ptr Font -> Ptr CUShort -> Ptr CInt -> Ptr CInt -> m CInt
renderText_Solid :: MonadIO m => Ptr Font -> CString -> Ptr Color -> m (Ptr Surface)
renderText_Shaded :: MonadIO m => Ptr Font -> CString -> Ptr Color -> Ptr Color -> m (Ptr Surface)
renderText_Blended :: MonadIO m => Ptr Font -> CString -> Ptr Color -> m (Ptr Surface)
renderText_Blended_Wrapped :: MonadIO m => Ptr Font -> CString -> Ptr Color -> CUInt -> m (Ptr Surface)
renderUTF8_Solid :: MonadIO m => Ptr Font -> CString -> Ptr Color -> m (Ptr Surface)
renderUTF8_Shaded :: MonadIO m => Ptr Font -> CString -> Ptr Color -> Ptr Color -> m (Ptr Surface)
renderUTF8_Blended :: MonadIO m => Ptr Font -> CString -> Ptr Color -> m (Ptr Surface)
renderUTF8_Blended_Wrapped :: MonadIO m => Ptr Font -> CString -> Ptr Color -> CUInt -> m (Ptr Surface)
renderUNICODE_Solid :: MonadIO m => Ptr Font -> Ptr CUShort -> Ptr Color -> m (Ptr Surface)
renderUNICODE_Shaded :: MonadIO m => Ptr Font -> Ptr CUShort -> Ptr Color -> Ptr Color -> m (Ptr Surface)
renderUNICODE_Blended :: MonadIO m => Ptr Font -> Ptr CUShort -> Ptr Color -> m (Ptr Surface)
renderUNICODE_Blended_Wrapped :: MonadIO m => Ptr Font -> Ptr CUShort -> Ptr Color -> CUInt -> m (Ptr Surface)
renderGlyph_Solid :: MonadIO m => Ptr Font -> CUShort -> Ptr Color -> m (Ptr Surface)
renderGlyph_Shaded :: MonadIO m => Ptr Font -> CUShort -> Ptr Color -> Ptr Color -> m (Ptr Surface)
renderGlyph_Blended :: MonadIO m => Ptr Font -> CUShort -> Ptr Color -> m (Ptr Surface)
byteSwappedUNICODE :: MonadIO m => CInt -> m ()
pattern UNICODE_BOM_NATIVE :: forall a. (Eq a, Num a) => () => a
pattern UNICODE_BOM_SWAPPED :: forall a. (Eq a, Num a) => () => a


-- | Bindings to the <tt>SDL2_ttf</tt> library
--   <a>http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html</a> which
--   itself is a wrapper around the FreeType library. The bindings should
--   allow you to load fonts and render <a>Text</a> in various styles to an
--   <tt>SDL</tt> <a>Surface</a>.
--   
--   You can safely assume that any monadic function listed here is capable
--   of throwing an <a>SDLException</a> in case it encounters an error.
module SDL.Font

-- | Initializes the library.
--   
--   Unless noted otherwise, this must be called before any other part of
--   the library is used.
--   
--   You may call this multiple times.
initialize :: MonadIO m => m ()

-- | Gets the major, minor, patch versions of the linked <tt>SDL2_ttf</tt>
--   library.
--   
--   You may call this without initializing the library with
--   <a>initialize</a>.
version :: (Integral a, MonadIO m) => m (a, a, a)

-- | Cleans up any resources still in use by the library.
--   
--   If called, you must call <a>initialize</a> again before using any
--   other parts of the library.
quit :: MonadIO m => m ()

-- | Represents a loaded font.
newtype Font
Font :: Ptr Font -> Font
[unwrap] :: Font -> Ptr Font

-- | Point size (based on 72DPI) to load font as. Translates to pixel
--   height.
type PointSize = Int

-- | Given a path to a font file, loads it for use as a <a>Font</a> at a
--   certain <a>PointSize</a>.
load :: MonadIO m => FilePath -> PointSize -> m Font

-- | Designates a font face, the default and first one being 0.
type Index = Int

-- | Given a path to a font file, loads one of its font faces (designated
--   by the given index) for use as a <a>Font</a> at a certain
--   <a>PointSize</a>.
--   
--   The first face is always index 0, and is the one chosen by default
--   when using <a>load</a>.
loadIndex :: MonadIO m => FilePath -> PointSize -> Index -> m Font

-- | Same as <a>load</a>, but accepts a <a>ByteString</a> containing a font
--   instead.
decode :: MonadIO m => ByteString -> PointSize -> m Font

-- | Same as <a>loadIndex</a>, but accepts a <a>ByteString</a> containing a
--   font instead.
decodeIndex :: MonadIO m => ByteString -> PointSize -> Index -> m Font

-- | Frees a loaded <a>Font</a>.
free :: MonadIO m => Font -> m ()

-- | Color as an RGBA byte vector.
type Color = V4 Word8

-- | Renders <a>Text</a> using the <i>quick and dirty</i> method.
--   
--   Is the fastest of the rendering methods, but results in text that
--   isn't as <i>smooth</i>.
solid :: MonadIO m => Font -> Color -> Text -> m Surface

-- | Uses the <i>slow and nice, but with a solid box</i> method.
--   
--   Renders slower than <a>solid</a>, but in about the same time as
--   <a>blended</a>.
--   
--   Results in a <a>Surface</a> containing antialiased text of a
--   foreground color surrounded by a box of a background color. This
--   <a>Surface</a> will blit as fast as the one from <a>solid</a>.
shaded :: MonadIO m => Font -> Color -> Color -> Text -> m Surface

-- | The <i>slow slow slow, but ultra nice over another image</i> method,
--   <a>blended</a> renders text at high quality.
--   
--   The text is antialiased and surrounded by a transparent box. Renders
--   slower than <a>solid</a>, but in about the same time as <a>shaded</a>.
--   
--   The resulting <a>Surface</a> will blit slower than the ones from
--   <a>solid</a> or <a>shaded</a>.
blended :: MonadIO m => Font -> Color -> Text -> m Surface

-- | Use this function to discover how wide and tall a <a>Surface</a> needs
--   to be in order to accommodate a given text when it is rendered.
--   
--   Note that no actual rendering takes place.
--   
--   The values returned are the width and height, respectively, in pixels.
--   The height returned is the same one returned by <a>height</a>.
size :: MonadIO m => Font -> Text -> m (Int, Int)

-- | Possible styles that can be applied to a <a>Font</a>.
data Style
Bold :: Style
Italic :: Style
Underline :: Style
Strikethrough :: Style

-- | Gets the rendering styles of a given <a>Font</a>.
--   
--   If none were ever set, this will be an empty list.
getStyle :: MonadIO m => Font -> m [Style]

-- | Sets the rendering style of a <a>Font</a>.
--   
--   Use an empty list to reset the style.
setStyle :: MonadIO m => Font -> [Style] -> m ()

-- | The size of the <a>Font</a> outline, in pixels.
--   
--   Use 0 to turn off outlining.
type Outline = Int

-- | Gets the current outline size of a given <a>Font</a>.
getOutline :: MonadIO m => Font -> m Outline

-- | Sets the outline size for a given <a>Font</a>.
--   
--   Use 0 to turn off outlining.
setOutline :: MonadIO m => Font -> Outline -> m ()

-- | The hinting setting of a <a>Font</a>.
data Hinting
Normal :: Hinting
Light :: Hinting
Mono :: Hinting
None :: Hinting

-- | Gets the hinting setting of a given <a>Font</a>.
getHinting :: MonadIO m => Font -> m Hinting

-- | Sets the hinting setting of a font.
setHinting :: MonadIO m => Font -> Hinting -> m ()

-- | Whether kerning is enabled or not.
--   
--   The default for a newly-loaded <a>Font</a> is enabled.
type Kerning = Bool

-- | Gets the current kerning setting of a given <a>Font</a>.
getKerning :: MonadIO m => Font -> m Kerning

-- | Sets the kerning setting for a given <a>Font</a>.
--   
--   Use <a>False</a> to turn off kerning.
setKerning :: MonadIO m => Font -> Kerning -> m ()

-- | Tests whether the current face of a <a>Font</a> is a fixed width font
--   or not.
isMonospace :: MonadIO m => Font -> m Bool

-- | Gets the current font face family name, if any.
familyName :: MonadIO m => Font -> m (Maybe Text)

-- | Gets the current font face style name, if any.
styleName :: MonadIO m => Font -> m (Maybe Text)

-- | Gets the maximum pixel height of all glyphs of a given <a>Font</a>.
height :: MonadIO m => Font -> m Int

-- | Gets the maximum pixel ascent of all glyphs of a given <a>Font</a>.
--   
--   This can be interpreted as the distance from the top of the font to
--   the baseline.
ascent :: MonadIO m => Font -> m Int

-- | Gets the maximum pixel descent of all glyphs of a given <a>Font</a>.
--   
--   Also interpreted as the distance from the baseline to the bottom of
--   the font.
descent :: MonadIO m => Font -> m Int

-- | Gets the recommended pixel height of a rendered line of text of a
--   given <a>Font</a>.
--   
--   This is usually larger than what <a>height</a> would return.
lineSkip :: MonadIO m => Font -> m Int

-- | From a given <a>Font</a> get the kerning size of two glyphs.
getKerningSize :: MonadIO m => Font -> Index -> Index -> m Int

-- | Does a <a>Font</a> provide a certain unicode character?
glyphProvided :: MonadIO m => Font -> Char -> m Bool

-- | Same as <a>glyphProvided</a>, but returns an index of the glyph for
--   the given character instead, if one is provided.
glyphIndex :: MonadIO m => Font -> Char -> m (Maybe Int)

-- | Get glyph metrics for a given unicode character. The values returned
--   are:
--   
--   <ol>
--   <li>minimum x offset</li>
--   <li>maximum x offset</li>
--   <li>minimum y offset</li>
--   <li>maximum y offset</li>
--   <li>advance offset</li>
--   </ol>
--   
--   You can see more information about these values in the original
--   <tt>SDL2_ttf</tt> documentation <a>here</a>.
glyphMetrics :: MonadIO m => Font -> Char -> m (Maybe (Int, Int, Int, Int, Int))

-- | Same as <a>solid</a>, but renders a single glyph instead.
solidGlyph :: MonadIO m => Font -> Color -> Char -> m Surface

-- | Same as <a>shaded</a>, but renders a single glyph instead.
shadedGlyph :: MonadIO m => Font -> Color -> Color -> Char -> m Surface

-- | Same as <a>blended</a>, but renders a single glyph instead.
blendedGlyph :: MonadIO m => Font -> Color -> Char -> m Surface

-- | Same as <a>blended</a>, but renders across multiple lines. Text is
--   wrapped to multiple lines on line endings and on word boundaries if it
--   extends beyond wrapLength in pixels.
blendedWrapped :: MonadIO m => Font -> Color -> Int -> Text -> m Surface
instance GHC.Show.Show SDL.Font.Hinting
instance GHC.Read.Read SDL.Font.Hinting
instance GHC.Generics.Generic SDL.Font.Hinting
instance GHC.Enum.Bounded SDL.Font.Hinting
instance GHC.Classes.Ord SDL.Font.Hinting
instance GHC.Enum.Enum SDL.Font.Hinting
instance GHC.Classes.Eq SDL.Font.Hinting
instance GHC.Show.Show SDL.Font.Style
instance GHC.Read.Read SDL.Font.Style
instance GHC.Generics.Generic SDL.Font.Style
instance GHC.Enum.Bounded SDL.Font.Style
instance GHC.Classes.Ord SDL.Font.Style
instance GHC.Enum.Enum SDL.Font.Style
instance GHC.Classes.Eq SDL.Font.Style
instance GHC.Show.Show SDL.Font.Font
instance GHC.Classes.Eq SDL.Font.Font
