{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE OverloadedStrings #-} module PDF.Character ( pdfcharmap , extendedAscii , adobeJapanOneSixMap) where import qualified Data.Text as T import qualified Data.Map as Map import qualified Data.ByteString.Lazy as BSL import qualified Data.ByteString.Lazy.UTF8 as BSLU import Data.FileEmbed import Codec.Compression.GZip (decompress) import Data.Binary (decode) pdfcharmap :: Map String Text pdfcharmap = [(String, Text)] -> Map String Text forall k a. Ord k => [(k, a)] -> Map k a Map.fromList [(String, Text)] pdfchardict extendedAscii :: Map Int Char extendedAscii = [(Int, Char)] -> Map Int Char forall k a. Ord k => [(k, a)] -> Map k a Map.fromList [(Int, Char)] extendedasciidict adobeJapanOneSixMap :: Map.Map Int BSLU.ByteString adobeJapanOneSixMap :: Map Int ByteString adobeJapanOneSixMap = ByteString -> Map Int ByteString forall a. Binary a => ByteString -> a decode (ByteString -> Map Int ByteString) -> (ByteString -> ByteString) -> ByteString -> Map Int ByteString forall b c a. (b -> c) -> (a -> b) -> a -> c . ByteString -> ByteString decompress (ByteString -> ByteString) -> (ByteString -> ByteString) -> ByteString -> ByteString forall b c a. (b -> c) -> (a -> b) -> a -> c . [ByteString] -> ByteString BSL.fromChunks ([ByteString] -> ByteString) -> (ByteString -> [ByteString]) -> ByteString -> ByteString forall b c a. (b -> c) -> (a -> b) -> a -> c . (ByteString -> [ByteString] -> [ByteString] forall a. a -> [a] -> [a] :[]) (ByteString -> Map Int ByteString) -> ByteString -> Map Int ByteString forall a b. (a -> b) -> a -> b $ $(embedFile "data/map/Adobe-Japan1-6.map") extendedasciidict :: [(Int, Char)] extendedasciidict :: [(Int, Char)] extendedasciidict = [ (Int 128, Char '€') , (Int 129, Char ' ') , (Int 130, Char '‚') , (Int 131, Char 'ƒ') , (Int 132, Char '„') , (Int 133, Char '…') , (Int 134, Char '†') , (Int 135, Char '‡') , (Int 136, Char 'ˆ') , (Int 137, Char '‰') , (Int 138, Char 'Š') , (Int 139, Char '‹') , (Int 140, Char 'Œ') , (Int 141, Char ' ') , (Int 142, Char 'Ž') , (Int 143, Char ' ') , (Int 144, Char ' ') , (Int 145, Char '‘') , (Int 146, Char '’') , (Int 147, Char '“') , (Int 148, Char '”') , (Int 149, Char '•') , (Int 150, Char '–') , (Int 151, Char '—') , (Int 152, Char '˜') , (Int 153, Char '™') , (Int 154, Char 'š') , (Int 155, Char '›') , (Int 156, Char 'œ') , (Int 157, Char ' ') , (Int 158, Char 'ž') , (Int 159, Char 'Ÿ') , (Int 160, Char ' ') , (Int 161, Char '¡') , (Int 162, Char '¢') , (Int 163, Char '£') , (Int 164, Char '¤') , (Int 165, Char '¥') , (Int 166, Char '¦') , (Int 167, Char '§') , (Int 168, Char '¨') , (Int 169, Char '©') , (Int 170, Char 'ª') , (Int 171, Char '«') , (Int 172, Char '¬') , (Int 173, Char '-') , (Int 174, Char '®') , (Int 175, Char '¯') , (Int 176, Char '°') , (Int 177, Char '±') , (Int 178, Char '²') , (Int 179, Char '³') , (Int 180, Char '´') , (Int 181, Char 'µ') , (Int 182, Char '¶') , (Int 183, Char '·') , (Int 184, Char '¸') , (Int 185, Char '¹') , (Int 186, Char 'º') , (Int 187, Char '»') , (Int 188, Char '¼') , (Int 189, Char '½') , (Int 190, Char '¾') , (Int 191, Char '¿') , (Int 192, Char 'À') , (Int 193, Char 'Á') , (Int 194, Char 'Â') , (Int 195, Char 'Ã') , (Int 196, Char 'Ä') , (Int 197, Char 'Å') , (Int 198, Char 'Æ') , (Int 199, Char 'Ç') , (Int 200, Char 'È') , (Int 201, Char 'É') , (Int 202, Char 'Ê') , (Int 203, Char 'Ë') , (Int 204, Char 'Ì') , (Int 205, Char 'Í') , (Int 206, Char 'Î') , (Int 207, Char 'Ï') , (Int 208, Char 'Ð') , (Int 209, Char 'Ñ') , (Int 210, Char 'Ò') , (Int 211, Char 'Ó') , (Int 212, Char 'Ô') , (Int 213, Char 'Õ') , (Int 214, Char 'Ö') , (Int 215, Char '×') , (Int 216, Char 'Ø') , (Int 217, Char 'Ù') , (Int 218, Char 'Ú') , (Int 219, Char 'Û') , (Int 220, Char 'Ü') , (Int 221, Char 'Ý') , (Int 222, Char 'Þ') , (Int 223, Char 'ß') , (Int 224, Char 'à') , (Int 225, Char 'á') , (Int 226, Char 'â') , (Int 227, Char 'ã') , (Int 228, Char 'ä') , (Int 229, Char 'å') , (Int 230, Char 'æ') , (Int 231, Char 'ç') , (Int 232, Char 'è') , (Int 233, Char 'é') , (Int 234, Char 'ê') , (Int 235, Char 'ë') , (Int 236, Char 'ì') , (Int 237, Char 'í') , (Int 238, Char 'î') , (Int 239, Char 'ï') , (Int 240, Char 'ð') , (Int 241, Char 'ñ') , (Int 242, Char 'ò') , (Int 243, Char 'ó') , (Int 244, Char 'ô') , (Int 245, Char 'õ') , (Int 246, Char 'ö') , (Int 247, Char '÷') , (Int 248, Char 'ø') , (Int 249, Char 'ù') , (Int 250, Char 'ú') , (Int 251, Char 'û') , (Int 252, Char 'ü') , (Int 253, Char 'ý') , (Int 254, Char 'þ') , (Int 255, Char 'ÿ') ] pdfchardict :: [(String, T.Text)] pdfchardict :: [(String, Text)] pdfchardict = [ (String "/A",Text "A") , (String "/AE",Text "Æ") , (String "/Aacute",Text "Á") , (String "/Acircumflex",Text "Â") , (String "/Adieresis",Text "Ä") , (String "/Aring",Text "Å") , (String "/Atilde",Text "Ã") , (String "/B",Text "B") , (String "/C",Text "C") , (String "/Ccedilla",Text "Ç") , (String "/D",Text "D") , (String "/E",Text "E") , (String "/Eacute",Text "É") , (String "/Ecircumflex",Text "Ê") , (String "/Edieresis",Text "Ë") , (String "/Egrave",Text "È") , (String "/Eth",Text "Ð") , (String "/Euro",Text "€") , (String "/F",Text "F") , (String "/G",Text "G") , (String "/H",Text "H") , (String "/I",Text "I") , (String "/Iacute",Text "Í") , (String "/Icircumflex",Text "Î") , (String "/Idieresis",Text "Ï") , (String "/Igrave",Text "Ì") , (String "/J",Text "J") , (String "/K",Text "K") , (String "/L",Text "L") , (String "/Lslash",Text "Ł") , (String "/M",Text "M") , (String "/N",Text "N") , (String "/Ntilde",Text "Ñ") , (String "/O",Text "O") , (String "/OE",Text "OE") , (String "/Oacute",Text "Ó") , (String "/Ocircumflex",Text "Ô") , (String "/Odieresis",Text "Ö") , (String "/Ograve",Text "Ò") , (String "/Oslash",Text "Ø") , (String "/Otilde",Text "Õ") , (String "/P",Text "P") , (String "/Q",Text "Q") , (String "/R",Text "R") , (String "/S",Text "S") , (String "/Scaron",Text "Š") , (String "/T",Text "T") , (String "/Thorn",Text "Þ") , (String "/U",Text "U") , (String "/Uacute",Text "Ú") , (String "/Ucircumflex",Text "Û") , (String "/Udieresis",Text "Ü") , (String "/Ugrave",Text "Ù") , (String "/V",Text "V") , (String "/W",Text "W") , (String "/X",Text "X") , (String "/Y",Text "Y") , (String "/Yacute",Text "Ý") , (String "/Ydieresis",Text "Ÿ") , (String "/Z",Text "Z") , (String "/Zcaron",Text "Ž") , (String "/a",Text "a") , (String "/aacute",Text "á") , (String "/acircumflex",Text "â") , (String "/acute",Text "´") , (String "/adieresis",Text "ä") , (String "/ae",Text "æ") , (String "/agrave",Text "à") , (String "/ampersand",Text "&") , (String "/aring",Text "å") , (String "/asciicircum",Text "^") , (String "/asciitilde",Text "~") , (String "/asterisk",Text "*") , (String "/at",Text "@") , (String "/atilde ",Text "ã") , (String "/b",Text "b") , (String "/backslash",Text "\\") , (String "/bar",Text "|") , (String "/braceleft",Text "{") , (String "/braceright",Text "}") , (String "/bracketleft",Text "[") , (String "/bracketright",Text "]") , (String "/breve",Text "˘") , (String "/brokenbar",Text "¦") , (String "/bullet",Text "•") , (String "/c",Text "c") , (String "/caron",Text "ˇ") , (String "/ccedilla ",Text "ç") , (String "/cedilla",Text "¸") , (String "/cent",Text "¢") , (String "/circumflex",Text "ˆ") , (String "/colon",Text ":") , (String "/comma",Text ",") , (String "/copyright",Text "©") , (String "/circlecopyrt",Text "©") , (String "/currency",Text "¤") , (String "/d",Text "d") , (String "/dagger",Text "†") , (String "/daggerdb",Text "‡") , (String "/degree",Text "°") , (String "/dieresis",Text "¨") , (String "/divide",Text "÷") , (String "/dollar",Text "$") , (String "/dotaccent",Text "˙") , (String "/dotlessi",Text "ı") , (String "/e",Text "e") , (String "/eacute",Text "é") , (String "/ecircumflex",Text "ê") , (String "/edieresis",Text "ë") , (String "/egrave",Text "è") , (String "/eight",Text "8") , (String "/ellipsis",Text "…") , (String "/emdash",Text "—") , (String "/endash",Text "–") , (String "/equal",Text "=") , (String "/eth",Text "ð") , (String "/exclam",Text "!") , (String "/exclamdown",Text "¡") , (String "/f",Text "f") , (String "/ff",Text "ff") , (String "/ffi",Text "ffi") , (String "/ffl",Text "ffl") , (String "/fi",Text "fi") , (String "/five",Text "5") , (String "/fl",Text "fl") , (String "/florin",Text "ƒ") , (String "/four",Text "4") , (String "/fraction",Text "⁄") , (String "/g",Text "g") , (String "/germandbls",Text "ß") , (String "/grave",Text "`") , (String "/greater",Text ">") , (String "/guillemotleft",Text "«") , (String "/guillemotright",Text "»") , (String "/guilsinglleft",Text "‹") , (String "/guilsinglright",Text "›") , (String "/h",Text "h") , (String "/hungarumlaut",Text "˝") , (String "/hyphen",Text "-") , (String "/i",Text "i") , (String "/iacute",Text "í") , (String "/icircumflex",Text "î") , (String "/idieresis",Text "ï") , (String "/igrave",Text "ì") , (String "/j",Text "j") , (String "/k",Text "k") , (String "/l",Text "l") , (String "/less",Text "<") , (String "/logicalnot",Text "¬") , (String "/lslash",Text "ł") , (String "/m",Text "m") , (String "/macron",Text "¯") , (String "/minus",Text "−") , (String "/mu",Text "μ") , (String "/multiply",Text "×") , (String "/n",Text "n") , (String "/nine",Text "9") , (String "/ntilde",Text "ñ") , (String "/numbersign",Text "#") , (String "/o",Text "o") , (String "/oacute",Text "ó") , (String "/ocircumflex",Text "ô") , (String "/odieresis",Text "ö") , (String "/oe",Text "oe") , (String "/ogonek",Text "˛") , (String "/ograve",Text "ò") , (String "/one",Text "1") , (String "/onehalf",Text "½") , (String "/onequarter",Text "¼") , (String "/onesuperior",Text "¹") , (String "/ordfeminine",Text "ª") , (String "/ordmasculine",Text "º") , (String "/oslash",Text "ø") , (String "/otilde",Text "õ") , (String "/p",Text "p") , (String "/paragraph",Text "¶") , (String "/parenleft",Text "(") , (String "/parenright",Text ")") , (String "/percent",Text "%") , (String "/period",Text ".") , (String "/periodcentered",Text "·") , (String "/perthousand",Text "‰") , (String "/plus",Text "+") , (String "/plusminus ",Text "±") , (String "/q",Text "q") , (String "/question",Text "?") , (String "/questiondown",Text "¿") , (String "/quotedbl",Text "\"") , (String "/quotedblbase",Text "„") , (String "/quotedblleft",Text "“") , (String "/quotedblright",Text "”") , (String "/quoteleft",Text "‘") , (String "/quoteright",Text "’") , (String "/quotesinglbase",Text "‚") , (String "/quotesingle",Text "'") , (String "/r",Text "r") , (String "/registered",Text "®") , (String "/ring",Text "˚") , (String "/s",Text "s") , (String "/scaron",Text "š") , (String "/section",Text "§") , (String "/semicolon",Text ";") , (String "/seven",Text "7") , (String "/six",Text "6") , (String "/slash",Text "/") , (String "/space",Text " ") , (String "/sterling",Text "£") , (String "/t",Text "t") , (String "/thorn",Text "þ") , (String "/three",Text "3") , (String "/threequarters",Text "¾") , (String "/threesuperior",Text "³") , (String "/tilde",Text "˜") , (String "/trademark",Text "™") , (String "/two",Text "2") , (String "/twosuperior",Text "²") , (String "/u",Text "u") , (String "/uacute",Text "ú") , (String "/ucircumflex",Text "û") , (String "/udieresis",Text "ü") , (String "/ugrave",Text "ù") , (String "/underscore",Text "_") , (String "/v",Text "v") , (String "/w",Text "w") , (String "/x",Text "x") , (String "/y",Text "y") , (String "/yacute",Text "ý") , (String "/ydieresis",Text "ÿ") , (String "/yen",Text "¥") , (String "/z",Text "z") , (String "/zcaron",Text "ž") , (String "/zero",Text "0") , (String "/Alpha",Text "Α") , (String "/Beta",Text "Β") , (String "/Chi",Text "Χ") , (String "/Delta",Text "Δ") , (String "/Epsilon",Text "Ε") , (String "/Eta",Text "Η") , (String "/Euro",Text "€") , (String "/Gamma",Text "Γ") , (String "/Iota",Text "Ι") , (String "/Kappa",Text "Κ") , (String "/Lambda",Text "Λ") , (String "/Mu",Text "Μ") , (String "/Nu",Text "Ν") , (String "/Omega",Text "Ω") , (String "/Omicron",Text "Ο") , (String "/Phi",Text "Φ") , (String "/Pi",Text "Π") , (String "/Psi",Text "Ψ") , (String "/Rho",Text "Ρ") , (String "/Sigma",Text "Σ") , (String "/Tau",Text "Τ") , (String "/Theta",Text "Θ") , (String "/Upsilon",Text "Υ") , (String "/Xi",Text "Ξ") , (String "/Zeta",Text "Ζ") , (String "/aleph",Text "ℵ") , (String "/alpha",Text "α") , (String "/ampersand",Text "&") , (String "/angle",Text "∠") , (String "/angleleft",Text "〈") , (String "/angleright",Text "〉") , (String "/approxequal",Text "≈") , (String "/arrowdblboth",Text "⇔") , (String "/arrowdblleft",Text "⇒") , (String "/asteriskmath",Text "*") , (String "/bar",Text "|") , (String "/beta",Text "β") , (String "/braceleft",Text "{") , (String "/braceright",Text "}") , (String "/chi",Text "χ") , (String "/delta",Text "δ") , (String "/epsilon",Text "ε") , (String "/eta",Text "η") , (String "/gamma",Text "γ") , (String "/iota",Text "ι") , (String "/kappa",Text "κ") , (String "/lambda",Text "λ") , (String "/mu",Text "μ") , (String "/nu",Text "ν") , (String "/omega",Text "ω") , (String "/omicron",Text "ο") , (String "/phi",Text "φ") , (String "/pi",Text "π") , (String "/psi",Text "ψ") , (String "/rho",Text "ρ") , (String "/sigma",Text "σ") , (String "/tau",Text "τ") , (String "/theta",Text "θ") , (String "/upsilon",Text "υ") , (String "/xi",Text "ξ") , (String "/zeta",Text "ζ") , (String "/existential",Text "∃") , (String "/universal",Text "∀") , (String "/partialdiff",Text "∂") , (String "/equal",Text "=") , (String "/infinity",Text "∞") , (String "/integral",Text "∫") , (String "/sharp",Text "♯") ]