kb-text-shape-0.1.0.0: Unicode segmentation and shaping using kb_text_shape
Safe HaskellNone
LanguageGHC2021

KB.Text.Shape.Font

Synopsis

Distillation

extractBlob Source #

Arguments

:: ByteString

TTF font data

-> Int

Font index (use 0 for the first/only font)

-> IO ByteString

KBTS blob data

Extract and pre-process font data needed for shaping.

Loading

data FontData Source #

Haskell-owned font data

Instances

Instances details
Show FontData Source # 
Instance details

Defined in KB.Text.Shape.Font

Eq FontData Source # 
Instance details

Defined in KB.Text.Shape.Font

Using

withFontData :: FontData -> (Font -> IO r) -> IO r Source #

Use the font handle from a loaded font

data Font Source #

An opaque handle to the font data.

Instances

Instances details
Storable Font Source # 
Instance details

Defined in KB.Text.Shape.FFI.Handles

Methods

sizeOf :: Font -> Int #

alignment :: Font -> Int #

peekElemOff :: Ptr Font -> Int -> IO Font #

pokeElemOff :: Ptr Font -> Int -> Font -> IO () #

peekByteOff :: Ptr b -> Int -> IO Font #

pokeByteOff :: Ptr b -> Int -> Font -> IO () #

peek :: Ptr Font -> IO Font #

poke :: Ptr Font -> Font -> IO () #

Show Font Source # 
Instance details

Defined in KB.Text.Shape.FFI.Handles

Methods

showsPrec :: Int -> Font -> ShowS #

show :: Font -> String #

showList :: [Font] -> ShowS #

Eq Font Source # 
Instance details

Defined in KB.Text.Shape.FFI.Handles

Methods

(==) :: Font -> Font -> Bool #

(/=) :: Font -> Font -> Bool #

Ord Font Source # 
Instance details

Defined in KB.Text.Shape.FFI.Handles

Methods

compare :: Font -> Font -> Ordering #

(<) :: Font -> Font -> Bool #

(<=) :: Font -> Font -> Bool #

(>) :: Font -> Font -> Bool #

(>=) :: Font -> Font -> Bool #

max :: Font -> Font -> Font #

min :: Font -> Font -> Font #

Querying

data Info Source #

Instances

Instances details
Show Info Source # 
Instance details

Defined in KB.Text.Shape.Font

Methods

showsPrec :: Int -> Info -> ShowS #

show :: Info -> String #

showList :: [Info] -> ShowS #

Eq Info Source # 
Instance details

Defined in KB.Text.Shape.Font

Methods

(==) :: Info -> Info -> Bool #

(/=) :: Info -> Info -> Bool #

Font metrics

emToCaps :: Fractional a => Font -> a Source #

Scaling factor to go from font-specific Em units to a cap-height normalized units.

This results in more consistent font sizing when using multiple fonts. You may even have a chance to align something vertically!

capHeight :: Num a => Font -> a Source #

Get the height of font's capital letters, in the font's logical units.

unitsPerEm :: Num a => Font -> a Source #

Get the font's "Em square" size, in the font's logical units.

Loading internals