~alcinnz/fontconfig-pure

ref: 61a2e4e486d9c9f5a9a8d09d70754cdd410b73af fontconfig-pure/Graphics/Text/Font/Choose/Weight.hs -rw-r--r-- 1.1 KiB
61a2e4e4 — Adrian Cochrane Denote compatibility with base-4.15. 1 year, 9 months ago
                                                                                
24a77a5f Adrian Cochrane
b1d28833 Adrian Cochrane
24a77a5f Adrian Cochrane
b1d28833 Adrian Cochrane
24a77a5f Adrian Cochrane
b1d28833 Adrian Cochrane
92f6f9bf Adrian Cochrane
b1d28833 Adrian Cochrane
92f6f9bf Adrian Cochrane
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Graphics.Text.Font.Choose.Weight where

-- | Returns an double value to use with "weight", from an double in the
-- 1..1000 range, resembling the numbers from OpenType specification's OS2
-- usWeight numbers, which are also similar to CSS font-weight numbers.
-- If input is negative, zero, or greater than 1000, returns -1.
-- This function linearly interpolates between various FC_WEIGHT_* constants.
-- As such, the returned value does not necessarily match any of the predefined
-- constants.
foreign import ccall "FcWeightFromOpenTypeDouble" weightFromOpenTypeDouble ::
    Double -> Double
-- | `weightToOpenTypeDouble` is the inverse of `weightFromOpenType`.
-- If the input is less than FC_WEIGHT_THIN or greater than FC_WEIGHT_EXTRABLACK,
-- returns -1. Otherwise returns a number in the range 1 to 1000.
foreign import ccall "FcWeightToOpenTypeDouble" weightToOpenTypeDouble ::
    Double -> Double
-- | Variant of `weightFromOpenTypeDouble` taking ints.
foreign import ccall "FcWeightFromOpenType" weightFromOpenType :: Int -> Int
-- | Variant of `weightToOpenTypeDouble` taking ints.
foreign import ccall "FcWeightToOpenType" weightToOpenType :: Int -> Int