-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Portable TrueType font rendering for OpenGL using the Freetype2 library -- -- A Haskell binding for the portable TrueType to OpenGL font rendering -- library FTGL. This package provides OpenGL with polygonal, texture -- mapped, and extruded fonts using Freetype2 and any truetype font. @package FTGL @version 1.2 -- |
-- do font <- createTextureFont "Font.ttf" -- setFontFaceSize font 24 72 -- renderFont font "Hello world!" ---- -- Fonts are rendered so that a single point is an OpenGL unit, and a -- point is 1:72 of an inch. module Graphics.Rendering.FTGL fcreateBitmapFont :: CString -> IO Font -- | Create a bitmapped version of a TrueType font. Bitmapped versions will -- not | respond to matrix transformations, but rather must be -- transformed using the | raster positioning functions in OpenGL createBitmapFont :: String -> IO Font fcreateBufferFont :: CString -> IO Font -- | Create a buffered version of a TrueType font. This stores the entirety -- of | a string in a texture, buffering it before rendering. Very -- fast if you | will be repeatedly rendering the same strings over and -- over. createBufferFont :: String -> IO Font fcreateOutlineFont :: CString -> IO Font -- | Create an outline version of a TrueType font. This uses actual -- geometry | and will scale independently without loss of quality. -- Faster than polygons | but slower than texture or buffer fonts. createOutlineFont :: String -> IO Font fcreatePixmapFont :: CString -> IO Font -- | Create a pixmap version of a TrueType font. Higher quality than the -- bitmap | font without losing any performance. Use this if you don't -- mind using | set and get RasterPosition. createPixmapFont :: String -> IO Font fcreatePolygonFont :: CString -> IO Font -- | Create polygonal display list fonts. These scale independently without -- | losing quality, unlike texture or buffer fonts, but can be -- impractical | for large amounts of text because of the high number of -- polygons needed. | Additionally, they do not, unlike the textured -- fonts, create artifacts | within the square formed at the edge of each -- character. createPolygonFont :: String -> IO Font fcreateTextureFont :: CString -> IO Font -- | Create textured display list fonts. These can scale somewhat well, | -- but lose quality quickly. They are much faster than polygonal fonts, | -- though, so are suitable for large quantities of text. Especially -- suited | well to text that changes with most frames, because it -- doesn't incur the | (normally helpful) overhead of buffering. createTextureFont :: String -> IO Font fcreateExtrudeFont :: CString -> IO Font -- | Create a 3D extruded font. This is the only way of creating 3D fonts | -- within FTGL. Could be fun to use a geometry shader to get different | -- effects by warping the otherwise square nature of the font. Polygonal. -- | Scales without losing quality. Slower than all other fonts. createExtrudeFont :: String -> IO Font -- | Create a simple layout createSimpleLayout :: IO Layout -- | Set the layout's font. setLayoutFont :: Layout -> Font -> IO () fgetLayoutFont :: Layout -> IO Font -- | Get the embedded font from the Layout -- -- Set the line length, I believe in OpenGL units, although I'm not sure. setLayoutLineLength :: Layout -> CFloat -> IO () fgetLayoutLineLength :: Layout -> IO CFloat -- | Get the line length in points (1:72in) of lines in the layout getLayoutLineLength :: Layout -> Float fsetLayoutAlignment :: Layout -> CInt -> IO () -- | Set the layout alignment fgetLayoutAlignment :: Layout -> IO CInt -- | Get the alignment of text in this layout. getLayoutAlignment :: Layout -> TextAlignment fsetLayoutLineSpacing :: Layout -> CFloat -> IO () -- | Set layout line spacing in OpenGL units. setLayoutLineSpacing :: Layout -> Float -> IO () -- | Destroy a font destroyFont :: Font -> IO () fattachFile :: Font -> CString -> IO () -- | Attach a metadata file to a font. attachFile :: Font -> String -> IO () -- | Attach some external data (often kerning) to the font attachData :: Font -> Ptr () -> IO () -- | Set the font's character map fsetFontCharMap :: Font -> CInt -> IO () setCharMap :: Font -> CharMap -> IO () fgetFontCharMapCount :: Font -> IO CInt -- | Get the number of characters loaded into the current charmap for the -- font. getFontCharMapCount :: Font -> Int fgetFontCharMapList :: Font -> IO (Ptr CInt) -- | Get the different character mappings available in this font. fsetFontFaceSize :: Font -> CInt -> CInt -> IO CInt setFontFaceSize :: Font -> Int -> Int -> IO CInt fgetFontFaceSize :: Font -> IO CInt -- | Get the current font face size in points. getFontFaceSize :: Font -> Int fsetFontDepth :: Font -> CFloat -> IO () setFontDepth :: Font -> Float -> IO () fsetFontOutset :: Font -> CFloat -> CFloat -> IO () setFontOutset :: Font -> Float -> Float -> IO () fgetFontBBox :: Font -> CString -> Int -> Ptr CFloat -> IO () -- | Get the text extents of a string as a list of -- (llx,lly,lly,urx,ury,urz) getFontBBox :: Font -> String -> [Float] fgetFontAscender :: Font -> CFloat -- | Get the global ascender height for the face. getFontAscender :: Font -> Float fgetFontDescender :: Font -> CFloat -- | Gets the global descender height for the face. getFontDescender :: Font -> Float fgetFontLineHeight :: Font -> CFloat -- | Gets the global line spacing for the face. getFontLineHeight :: Font -> Float fgetFontAdvance :: Font -> CString -> IO CFloat -- | Get the horizontal span of a string of text using the current font. -- Input as the xcoord | in any translate operation getFontAdvance :: Font -> String -> Float frenderFont :: Font -> CString -> CInt -> IO () -- | Render a string of text in the current font. renderFont :: Font -> String -> RenderMode -> IO () fgetFontError :: Font -> IO CInt -- | Get any errors associated with loading a font. FIXME return should be -- a type, not an Int. getFontError :: Font -> Int destroyLayout :: Layout -> IO () frenderLayout :: Layout -> CString -> IO () -- | Render a string of text within a layout. fgetLayoutError :: Layout -> IO CInt -- | Get any errors associated with a layout. -- -- Whether or not in polygonal or extrusion mode, the font will render -- equally front and back data RenderMode Front :: RenderMode Back :: RenderMode Side :: RenderMode All :: RenderMode -- | In a Layout directed render, the layout mode of the text data TextAlignment AlignLeft :: TextAlignment AlignCenter :: TextAlignment AlignRight :: TextAlignment Justify :: TextAlignment marshalRenderMode :: RenderMode -> CInt marshalTextAlignment :: TextAlignment -> CInt readTextAlignment :: CInt -> TextAlignment -- | An opaque type encapsulating a glyph in C. Currently the glyph -- functions are unimplemented in Haskell. data Glyph_Opaque -- | An opaque type encapsulating a font in C. data Font_Opaque -- | An opaque type encapsulating a layout in C data Layout_Opaque type Glyph = Ptr Glyph_Opaque type Font = Ptr Font_Opaque type Layout = Ptr Layout_Opaque data CharMap EncodingNone :: CharMap EncodingMSSymbol :: CharMap EncodingUnicode :: CharMap EncodingSJIS :: CharMap EncodingGB2312 :: CharMap EncodingBig5 :: CharMap EncodingWanSung :: CharMap EncodingJohab :: CharMap EncodingAdobeStandard :: CharMap EncodingAdobeExpert :: CharMap EncodingAdobeCustom :: CharMap EncodingAdobeLatin1 :: CharMap EncodingOldLatin2 :: CharMap EncodingAppleRoman :: CharMap encodeTag :: Char -> Char -> Char -> Char -> CInt