sdl2-ttf 0.2.0 → 0.2.1
raw patch · 4 files changed
+49/−10 lines, 4 filesdep ~basedep ~sdl2
Dependency ranges changed: base, sdl2
Files
- cbits/rendering.h +20/−0
- sdl2-ttf.cabal +3/−2
- src/Graphics/UI/SDL/TTF.hsc +10/−6
- src/Graphics/UI/SDL/TTF/Types.hsc +16/−2
+ cbits/rendering.h view
@@ -0,0 +1,20 @@+#ifndef _RENDERING_H+#define _RENDERING_H++#include "SDL2/SDL.h"+#include "SDL2/SDL_ttf.h"++extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid1(TTF_Font *font,+ const char *text, SDL_Color *fg);+extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded1(TTF_Font *font,+ const char *text, SDL_Color *fg, SDL_Color *bg);+extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended1(TTF_Font *font,+ const char *text, SDL_Color *fg);+extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid1(TTF_Font *font,+ const char *text, SDL_Color *fg);+extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded1(TTF_Font *font,+ const char *text, SDL_Color *fg, SDL_Color *bg);+extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended1(TTF_Font *font,+ const char *text, SDL_Color *fg);++#endif
sdl2-ttf.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: >= 1.8 Name: sdl2-ttf-Version: 0.2.0+Version: 0.2.1 Maintainer: Sean Chalmers (sclhiannan@gmail.com) Author: Ömer Sinan Ağacan (omeragacan@gmail.com) License-File: LICENSE@@ -8,8 +8,9 @@ Build-Type: Simple Category: Foreign binding Synopsis: Binding to libSDL2-ttf-Description: TODO+Description: Haskell bindings to the sdl2-ttf C++ library <http://www.libsdl.org/projects/SDL_ttf/>. Data-files:+extra-source-files: cbits/rendering.h Library Hs-source-dirs: src
src/Graphics/UI/SDL/TTF.hsc view
@@ -196,7 +196,7 @@ -- strings of characters, at least a word at a time. Perhaps the only time -- to disable this is when kerning is not working for a specific font, -- resulting in overlapping glyphs or abnormal spacing within words.-setFontKerning :: TTFFont -- ^ Font +setFontKerning :: TTFFont -- ^ Font -> KerningStatus -- ^ Desired Kerning status. -> IO () setFontKerning fontPtr KerningOn = FFI.setFontKerning fontPtr 1@@ -208,7 +208,7 @@ -- style and other typographical features perhaps) contained in the -- font itself. It seems to be a useless fact to know, since it can't -- be applied in any other SDL_ttf functions. -fontFaces :: TTFFont -- ^ Font +fontFaces :: TTFFont -- ^ Font -> IO Int64 -- ^ The number of faces in the font. fontFaces fontPtr = liftM fromIntegral $ FFI.fontFaces fontPtr @@ -220,15 +220,19 @@ -- -- @glyph_width * string_length@ ---fontFaceIsFixedWidth :: TTFFont -- ^ Font - -> IO Bool -- ^ If font is a fixed width font.-fontFaceIsFixedWidth fontPtr = liftM (== 0) $ FFI.fontFaceIsFixedWidth fontPtr+fontFaceIsFixedWidth :: TTFFont -- ^ Font+ -> IO FixedWidth -- ^ If font is a fixed width font.+fontFaceIsFixedWidth fontPtr =+ FFI.fontFaceIsFixedWidth fontPtr >>= return . toFW+ where+ toFW 1 = IsFixedW+ toFW _ = NotFixedW -- | Get the current font face family name from the loaded font. -- -- This function may return a NULL pointer, in which case the information -- is not available. -fontFaceFamilyName :: TTFFont -- ^ Font +fontFaceFamilyName :: TTFFont -- ^ Font -> IO String -- ^ The current family name of of the face of the font, or NULL perhaps. fontFaceFamilyName fontPtr = FFI.fontFaceFamilyName fontPtr >>= peekCString
src/Graphics/UI/SDL/TTF/Types.hsc view
@@ -7,6 +7,11 @@ | KerningOff deriving (Show,Eq) +data FixedWidth+ = IsFixedW+ | NotFixedW+ deriving (Show,Eq)+ data TTFError = RenderUTF8Blended | RenderUTF8Shaded@@ -17,7 +22,12 @@ | OpenFont deriving Show -data TTFStyle = TTFNormal | TTFBold | TTFItalic | TTFUnderline | TTFStrikethrough+data TTFStyle+ = TTFNormal+ | TTFBold+ | TTFItalic+ | TTFUnderline+ | TTFStrikethrough deriving ( Eq, Ord, Show, Read ) instance Enum TTFStyle where@@ -40,7 +50,11 @@ -- the display of an outline font so that it lines up with a rasterized grid. -- At small screen sizes, with or without antialiasing, hinting is critical -- for producing a clear, legible text for human readers.-data TTFHinting = TTFHNormal | TTFHLight | TTFHMono | TTFHNone+data TTFHinting+ = TTFHNormal+ | TTFHLight+ | TTFHMono+ | TTFHNone deriving ( Eq, Ord, Show, Read ) instance Enum TTFHinting where