packages feed

fontconfig-pure 0.1.0.0 → 0.1.0.1

raw patch · 7 files changed

+27/−21 lines, 7 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ FreeType.FontConfig: Glyph :: Maybe String -> a -> (Double, Double) -> FTFC_Subpixel -> FTFC_Glyph a
+ FreeType.FontConfig: Instance :: Maybe String -> Maybe String -> FT_Face -> Int -> Bool -> Bool -> Bool -> Int -> Int -> Double -> Bool -> Bool -> FT_LcdFilter -> [String] -> FTFC_Metrics -> FTFC_Instance
+ FreeType.FontConfig: Metrics :: Int -> Int -> Int -> (Int, Int) -> Bool -> FTFC_Subpixel -> Maybe String -> FTFC_Metrics
+ FreeType.FontConfig: SubpixelDefault :: FTFC_Subpixel
+ FreeType.FontConfig: SubpixelHorizontalBGR :: FTFC_Subpixel
+ FreeType.FontConfig: SubpixelHorizontalRGB :: FTFC_Subpixel
+ FreeType.FontConfig: SubpixelNone :: FTFC_Subpixel
+ FreeType.FontConfig: SubpixelVerticalBGR :: FTFC_Subpixel
+ FreeType.FontConfig: SubpixelVerticalRGB :: FTFC_Subpixel
+ FreeType.FontConfig: [ascent] :: FTFC_Metrics -> Int
+ FreeType.FontConfig: [descent] :: FTFC_Metrics -> Int
+ FreeType.FontConfig: [fontAntialias] :: FTFC_Instance -> Bool
+ FreeType.FontConfig: [fontBGR] :: FTFC_Instance -> Bool
+ FreeType.FontConfig: [fontEmbolden] :: FTFC_Instance -> Bool
+ FreeType.FontConfig: [fontFace] :: FTFC_Instance -> FT_Face
+ FreeType.FontConfig: [fontFeats] :: FTFC_Instance -> [String]
+ FreeType.FontConfig: [fontIsColor] :: FTFC_Instance -> Bool
+ FreeType.FontConfig: [fontLCDFilter] :: FTFC_Instance -> FT_LcdFilter
+ FreeType.FontConfig: [fontLoadFlags] :: FTFC_Instance -> Int
+ FreeType.FontConfig: [fontMetrics] :: FTFC_Instance -> FTFC_Metrics
+ FreeType.FontConfig: [fontName] :: FTFC_Instance -> Maybe String
+ FreeType.FontConfig: [fontPath] :: FTFC_Instance -> Maybe String
+ FreeType.FontConfig: [fontPixelFixupEstimated] :: FTFC_Instance -> Bool
+ FreeType.FontConfig: [fontPixelSizeFixup] :: FTFC_Instance -> Double
+ FreeType.FontConfig: [fontRenderFlagsSubpixel] :: FTFC_Instance -> Int
+ FreeType.FontConfig: [fontRenderFlags] :: FTFC_Instance -> Int
+ FreeType.FontConfig: [glyphAdvance] :: FTFC_Glyph a -> (Double, Double)
+ FreeType.FontConfig: [glyphFontName] :: FTFC_Glyph a -> Maybe String
+ FreeType.FontConfig: [glyphImage] :: FTFC_Glyph a -> a
+ FreeType.FontConfig: [glyphSubpixel] :: FTFC_Glyph a -> FTFC_Subpixel
+ FreeType.FontConfig: [height] :: FTFC_Metrics -> Int
+ FreeType.FontConfig: [maxAdvance] :: FTFC_Metrics -> (Int, Int)
+ FreeType.FontConfig: [metricsAntialias] :: FTFC_Metrics -> Bool
+ FreeType.FontConfig: [metricsName] :: FTFC_Metrics -> Maybe String
+ FreeType.FontConfig: [metricsSubpixel] :: FTFC_Metrics -> FTFC_Subpixel
+ FreeType.FontConfig: data FTFC_Glyph a
+ FreeType.FontConfig: data FTFC_Instance
+ FreeType.FontConfig: data FTFC_Metrics
+ FreeType.FontConfig: data FTFC_Subpixel
+ FreeType.FontConfig: glyphForIndex :: FTFC_Instance -> Word32 -> FTFC_Subpixel -> (FT_Bitmap -> IO a) -> IO (FTFC_Glyph a)
+ FreeType.FontConfig: instantiatePattern :: FT_Library -> Pattern -> (Double, Double) -> IO FTFC_Instance

Files

FreeType/FontConfig.hs view
@@ -1,6 +1,8 @@ -- NOTE: Not tested module FreeType.FontConfig (ftCharIndex, ftCharSet, ftCharSetAndSpacing,-    ftQuery, ftQueryAll, ftQueryFace) where+    ftQuery, ftQueryAll, ftQueryFace,+    FTFC_Instance(..), FTFC_Metrics(..), FTFC_Subpixel(..), instantiatePattern,+    FTFC_Glyph(..), glyphForIndex) where  import Graphics.Text.Font.Choose.CharSet (CharSet, CharSet_, thawCharSet, thawCharSet_) import Graphics.Text.Font.Choose.Pattern (Pattern, Pattern_, thawPattern, thawPattern_)@@ -149,14 +151,14 @@ instantiatePattern :: FT_Library -> Pattern -> (Double, Double) -> IO FTFC_Instance instantiatePattern ftlib pattern (req_pt_size, req_px_size) = do     let dpi = fromMaybe 75 $ getValue' "dpi" pattern :: Double-    let size = fromMaybe req_pt_size $ getValue' "size" pattern      ft_face <- case getValue "ftface" pattern of         ValueFTFace x -> return x         _ -> ft_New_Face ftlib (getValue0 "file" pattern) -- is a mutex needed?             (toEnum $ fromMaybe 0 $ getValue' "index" pattern) -    ft_Set_Pixel_Sizes ft_face 0 $ toEnum $ getValue0 "pixelsize" pattern+    ft_Set_Pixel_Sizes ft_face 0 $ toEnum $ fromEnum $+        fromMaybe req_px_size $ getValue' "pixelsize" pattern     let scalable = fromMaybe True $ getValue' "scalable" pattern     let outline = fromMaybe True $ getValue' "outline" pattern     (pixel_fixup, fixup_estimated) <- case getValue "pixelsizefixupfactor" pattern of
Graphics/Text/Font/Choose/CharSet.hs view
@@ -59,18 +59,19 @@ foreign import ccall "FcCharSetAddChar" fcCharSetAddChar :: CharSet_ -> Word32 -> IO Bool  thawCharSet :: CharSet_ -> IO CharSet-thawCharSet chars' = allocaBytes fcCHARSET_MAP_SIZE $ \iter' -> alloca $ \next' -> do-    first <- fcCharSetFirstPage chars' iter' next'-    let go = do {-        ch <- fcCharSetNextPage chars' iter' next';-        if ch == maxBound then return []-        else do-            chs <- go-            return (ch:chs)-      }-    if first == maxBound then return Set.empty else do-        rest <- go-        return $ Set.fromList $ map (unsafeChr . fromIntegral) (first:rest)+thawCharSet chars'+    | chars' == nullPtr = return Set.empty+    | otherwise = allocaBytes fcCHARSET_MAP_SIZE $ \iter' -> alloca $ \next' -> do+        first <- fcCharSetFirstPage chars' iter' next'+        let go = do+                ch <- fcCharSetNextPage chars' iter' next';+                if ch == maxBound then return []+                else do+                    chs <- go+                    return (ch:chs)+        if first == maxBound then return Set.empty else do+            rest <- go+            return $ Set.fromList $ map (unsafeChr . fromIntegral) (first:rest) foreign import ccall "FcCharSetFirstPage" fcCharSetFirstPage ::     CharSet_ -> Ptr Word32 -> Ptr Word32 -> IO Word32 foreign import ccall "FcCharSetNextPage" fcCharSetNextPage ::
Graphics/Text/Font/Choose/Config.hs view
@@ -12,6 +12,7 @@ import Foreign.Storable (Storable(..)) import Foreign.C.String (CString, peekCString, withCString) import System.IO.Unsafe (unsafePerformIO)+import Data.Set (empty) -- For testing segfault source.  import Control.Exception (bracket) import Graphics.Text.Font.Choose.Result (throwNull, throwFalse, throwPtr)
Graphics/Text/Font/Choose/FontSet.hs view
@@ -63,7 +63,7 @@     if n == 0 then return []     else do         print "c"-        ret <- forM [0..pred n] (thawPattern_ . get_fontSet_font fonts')+        ret <- forM [0..pred n] (\i -> thawPattern =<< get_fontSet_font fonts' i)         print "d"         return ret foreign import ccall "get_fontSet_nfont" get_fontSet_nfont :: FontSet_ -> IO Int
Graphics/Text/Font/Choose/Result.hs view
@@ -5,7 +5,7 @@ import Foreign.Ptr (Ptr, nullPtr) import Control.Exception (throwIO, throw, Exception) -data Result = Match | NoMatch | TypeMismatch | ResultNoId | OutOfMemory+data Result = Match | NoMatch | TypeMismatch | ResultNoId | OutOfMemory | Other     deriving (Eq, Show, Read, Enum)  resultFromPointer :: Ptr Int -> IO Result@@ -22,7 +22,9 @@ throwResult OutOfMemory _ = throwIO ErrOutOfMemory  throwInt :: Int -> IO a -> IO (Maybe a)-throwInt = throwResult . toEnum+throwInt x+    | x >= 0 && x <= 4 = throwResult $ toEnum x+    | otherwise = throwResult $ Other throwPtr :: Ptr Int -> IO a -> IO (Maybe a) throwPtr a b = resultFromPointer a >>= flip throwResult b 
cbits/pattern.c view
@@ -2,7 +2,7 @@ #include <stddef.h>  int my_FcCHARSET_MAP_SIZE() {-    return FC_CHARSET_MAP_SIZE;+    return FC_CHARSET_MAP_SIZE*sizeof(FcChar32); }  FcBool my_FcPatternAdd(FcPattern *p, const char *object,
fontconfig-pure.cabal view
@@ -10,13 +10,13 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.1.0.0+version:             0.1.0.1  -- A short (one-line) description of the package. synopsis:            Pure-functional language bindings to FontConfig  -- A longer description of the package.--- description:+description:         Resolves font descriptions to font libraries, including ones installed on your freedesktop (Linux or BSD system).  -- URL for the project homepage or repository. homepage:            https://www.freedesktop.org/wiki/Software/fontconfig/