{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}

module PDF.Character
       ( pdfcharmap
       , 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.fromList pdfchardict

adobeJapanOneSixMap :: Map.Map Int BSLU.ByteString
adobeJapanOneSixMap = decode . decompress . BSL.fromChunks . (:[]) $ $(embedFile "data/map/Adobe-Japan1-6.map")

pdfchardict :: [(String, T.Text)]
pdfchardict =
 [ ("/A","A")
 , ("/AE","Æ")
 , ("/Aacute","Á")
 , ("/Acircumflex","Â")
 , ("/Adieresis","Ä")
 , ("/Aring","Å")
 , ("/Atilde","Ã")
 , ("/B","B")
 , ("/C","C")
 , ("/Ccedilla","Ç")
 , ("/D","D")
 , ("/E","E")
 , ("/Eacute","É")
 , ("/Ecircumflex","Ê")
 , ("/Edieresis","Ë")
 , ("/Egrave","È")
 , ("/Eth","Ð")
 , ("/Euro","€")
 , ("/F","F")
 , ("/G","G")
 , ("/H","H")
 , ("/I","I")
 , ("/Iacute","Í")
 , ("/Icircumflex","Î")
 , ("/Idieresis","Ï")
 , ("/Igrave","Ì")
 , ("/J","J")
 , ("/K","K")
 , ("/L","L")
 , ("/Lslash","Ł")
 , ("/M","M")
 , ("/N","N")
 , ("/Ntilde","Ñ")
 , ("/O","O")
 , ("/OE","OE")
 , ("/Oacute","Ó")
 , ("/Ocircumflex","Ô")
 , ("/Odieresis","Ö")
 , ("/Ograve","Ò")
 , ("/Oslash","Ø")
 , ("/Otilde","Õ")
 , ("/P","P")
 , ("/Q","Q")
 , ("/R","R")
 , ("/S","S")
 , ("/Scaron","Š")
 , ("/T","T")
 , ("/Thorn","Þ")
 , ("/U","U")
 , ("/Uacute","Ú")
 , ("/Ucircumflex","Û")
 , ("/Udieresis","Ü")
 , ("/Ugrave","Ù")
 , ("/V","V")
 , ("/W","W")
 , ("/X","X")
 , ("/Y","Y")
 , ("/Yacute","Ý")
 , ("/Ydieresis","Ÿ")
 , ("/Z","Z")
 , ("/Zcaron","Ž")
 , ("/a","a")
 , ("/aacute","á")
 , ("/acircumflex","â")
 , ("/acute","´")
 , ("/adieresis","ä")
 , ("/ae","æ")
 , ("/agrave","à")
 , ("/ampersand","&")
 , ("/aring","å")
 , ("/asciicircum","^")
 , ("/asciitilde","~")
 , ("/asterisk","*")
 , ("/at","@")
 , ("/atilde ","ã")
 , ("/b","b")
 , ("/backslash","\\")
 , ("/bar","|")
 , ("/braceleft","{")
 , ("/braceright","}")
 , ("/bracketleft","[")
 , ("/bracketright","]")
 , ("/breve","˘")
 , ("/brokenbar","¦")
 , ("/bullet","•")
 , ("/c","c")
 , ("/caron","ˇ")
 , ("/ccedilla ","ç")
 , ("/cedilla","¸")
 , ("/cent","¢")
 , ("/circumflex","ˆ")
 , ("/colon",":")
 , ("/comma",",")
 , ("/copyright","©")
 , ("/circlecopyrt","©")
 , ("/currency","¤")
 , ("/d","d")
 , ("/dagger","†")
 , ("/daggerdb","‡")
 , ("/degree","°")
 , ("/dieresis","¨")
 , ("/divide","÷")
 , ("/dollar","$")
 , ("/dotaccent","˙")
 , ("/dotlessi","ı")
 , ("/e","e")
 , ("/eacute","é")
 , ("/ecircumflex","ê")
 , ("/edieresis","ë")
 , ("/egrave","è")
 , ("/eight","8")
 , ("/ellipsis","…")
 , ("/emdash","—")
 , ("/endash","–")
 , ("/equal","=")
 , ("/eth","ð")
 , ("/exclam","!")
 , ("/exclamdown","¡")
 , ("/f","f")
 , ("/ff","ff")
 , ("/ffi","ffi")
 , ("/ffl","ffl")
 , ("/fi","fi")
 , ("/five","5")
 , ("/fl","fl")
 , ("/florin","ƒ")
 , ("/four","4")
 , ("/fraction","⁄")
 , ("/g","g")
 , ("/germandbls","ß")
 , ("/grave","`")
 , ("/greater",">")
 , ("/guillemotleft","«")
 , ("/guillemotright","»")
 , ("/guilsinglleft","‹")
 , ("/guilsinglright","›")
 , ("/h","h")
 , ("/hungarumlaut","˝")
 , ("/hyphen","-")
 , ("/i","i")
 , ("/iacute","í")
 , ("/icircumflex","î")
 , ("/idieresis","ï")
 , ("/igrave","ì")
 , ("/j","j")
 , ("/k","k")
 , ("/l","l")
 , ("/less","<")
 , ("/logicalnot","¬")
 , ("/lslash","ł")
 , ("/m","m")
 , ("/macron","¯")
 , ("/minus","−")
 , ("/mu","μ")
 , ("/multiply","×")
 , ("/n","n")
 , ("/nine","9")
 , ("/ntilde","ñ")
 , ("/numbersign","#")
 , ("/o","o")
 , ("/oacute","ó")
 , ("/ocircumflex","ô")
 , ("/odieresis","ö")
 , ("/oe","oe")
 , ("/ogonek","˛")
 , ("/ograve","ò")
 , ("/one","1")
 , ("/onehalf","½")
 , ("/onequarter","¼")
 , ("/onesuperior","¹")
 , ("/ordfeminine","ª")
 , ("/ordmasculine","º")
 , ("/oslash","ø")
 , ("/otilde","õ")
 , ("/p","p")
 , ("/paragraph","¶")
 , ("/parenleft","(")
 , ("/parenright",")")
 , ("/percent","%")
 , ("/period",".")
 , ("/periodcentered","·")
 , ("/perthousand","‰")
 , ("/plus","+")
 , ("/plusminus ","±")
 , ("/q","q")
 , ("/question","?")
 , ("/questiondown","¿")
 , ("/quotedbl","\"")
 , ("/quotedblbase","„")
 , ("/quotedblleft","“")
 , ("/quotedblright","”")
 , ("/quoteleft","‘")
 , ("/quoteright","’")
 , ("/quotesinglbase","‚")
 , ("/quotesingle","'")
 , ("/r","r")
 , ("/registered","®")
 , ("/ring","˚")
 , ("/s","s")
 , ("/scaron","š")
 , ("/section","§")
 , ("/semicolon",";")
 , ("/seven","7")
 , ("/six","6")
 , ("/slash","/")
 , ("/space"," ")
 , ("/sterling","£")
 , ("/t","t")
 , ("/thorn","þ")
 , ("/three","3")
 , ("/threequarters","¾")
 , ("/threesuperior","³")
 , ("/tilde","˜")
 , ("/trademark","™")
 , ("/two","2")
 , ("/twosuperior","²")
 , ("/u","u")
 , ("/uacute","ú")
 , ("/ucircumflex","û")
 , ("/udieresis","ü")
 , ("/ugrave","ù")
 , ("/underscore","_")
 , ("/v","v")
 , ("/w","w")
 , ("/x","x")
 , ("/y","y")
 , ("/yacute","ý")
 , ("/ydieresis","ÿ")
 , ("/yen","¥")
 , ("/z","z")
 , ("/zcaron","ž")
 , ("/zero","0")
 , ("/Alpha","Α")
 , ("/Beta","Β")
 , ("/Chi","Χ")
 , ("/Delta","Δ")
 , ("/Epsilon","Ε")
 , ("/Eta","Η")
 , ("/Euro","€")
 , ("/Gamma","Γ")
 , ("/Iota","Ι")
 , ("/Kappa","Κ")
 , ("/Lambda","Λ")
 , ("/Mu","Μ")
 , ("/Nu","Ν")
 , ("/Omega","Ω")
 , ("/Omicron","Ο")
 , ("/Phi","Φ")
 , ("/Pi","Π")
 , ("/Psi","Ψ")
 , ("/Rho","Ρ")
 , ("/Sigma","Σ")
 , ("/Tau","Τ")
 , ("/Theta","Θ")
 , ("/Upsilon","Υ")
 , ("/Xi","Ξ")
 , ("/Zeta","Ζ")
 , ("/aleph","ℵ")
 , ("/alpha","α")
 , ("/ampersand","&")
 , ("/angle","∠")
 , ("/angleleft","〈")
 , ("/angleright","〉")
 , ("/approxequal","≈")
 , ("/arrowdblboth","⇔")
 , ("/arrowdblleft","⇒")
 , ("/asteriskmath","*")
 , ("/bar","|")
 , ("/beta","β")
 , ("/braceleft","{")
 , ("/braceright","}")
 , ("/chi","χ")
 , ("/delta","δ")
 , ("/epsilon","ε")
 , ("/eta","η")
 , ("/gamma","γ")
 , ("/iota","ι")
 , ("/kappa","κ")
 , ("/lambda","λ")
 , ("/mu","μ")
 , ("/nu","ν")
 , ("/omega","ω")
 , ("/omicron","ο")
 , ("/phi","φ")
 , ("/pi","π")
 , ("/psi","ψ")
 , ("/rho","ρ")
 , ("/sigma","σ")
 , ("/tau","τ")
 , ("/theta","θ")
 , ("/upsilon","υ")
 , ("/xi","ξ")
 , ("/zeta","ζ")
 , ("/existential","∃")
 , ("/universal","∀")
 , ("/partialdiff","∂")
 , ("/equal","=")
 , ("/infinity","∞")
 , ("/integral","∫")
 ]