Add a Font class type to allow text rendition schemes other than CMaps
This commit is contained in:
parent
c48ab22808
commit
22cde37025
3 changed files with 16 additions and 0 deletions
|
@ -27,6 +27,7 @@ library
|
||||||
, PDF.Update
|
, PDF.Update
|
||||||
other-modules: Data.ByteString.Char8.Util
|
other-modules: Data.ByteString.Char8.Util
|
||||||
, PDF.Body
|
, PDF.Body
|
||||||
|
, PDF.Font
|
||||||
-- other-extensions:
|
-- other-extensions:
|
||||||
build-depends: attoparsec
|
build-depends: attoparsec
|
||||||
, base >=4.9 && <4.13
|
, base >=4.9 && <4.13
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
{-# LANGUAGE NamedFieldPuns #-}
|
||||||
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
|
{-# LANGUAGE TypeSynonymInstances #-}
|
||||||
module PDF.CMap (
|
module PDF.CMap (
|
||||||
CMap
|
CMap
|
||||||
, CMappers
|
, CMappers
|
||||||
|
@ -19,6 +21,7 @@ import Data.ByteString.Char8.Util (
|
||||||
import Data.Map (Map, union)
|
import Data.Map (Map, union)
|
||||||
import qualified Data.Map as Map (adjust, empty, fromList, insertWith)
|
import qualified Data.Map as Map (adjust, empty, fromList, insertWith)
|
||||||
import qualified PDF.EOL as EOL (charset, parser)
|
import qualified PDF.EOL as EOL (charset, parser)
|
||||||
|
import PDF.Font (Font(..))
|
||||||
import PDF.Object (
|
import PDF.Object (
|
||||||
DirectObject(..), Name, StringObject(..)
|
DirectObject(..), Name, StringObject(..)
|
||||||
, blank, directObject, integer, line, stringObject
|
, blank, directObject, integer, line, stringObject
|
||||||
|
@ -35,6 +38,9 @@ data CRange = CRange {
|
||||||
type RangeSize = Int
|
type RangeSize = Int
|
||||||
type CMap = Map RangeSize [CRange]
|
type CMap = Map RangeSize [CRange]
|
||||||
|
|
||||||
|
instance Font CMap where
|
||||||
|
decode = undefined
|
||||||
|
|
||||||
emptyCMap :: CMap
|
emptyCMap :: CMap
|
||||||
emptyCMap = Map.empty
|
emptyCMap = Map.empty
|
||||||
|
|
||||||
|
|
9
src/PDF/Font.hs
Normal file
9
src/PDF/Font.hs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module PDF.Font (
|
||||||
|
Font(..)
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Data.ByteString (ByteString)
|
||||||
|
import PDF.Object (StringObject)
|
||||||
|
|
||||||
|
class Font a where
|
||||||
|
decode :: a -> StringObject -> ByteString
|
Loading…
Reference in a new issue