@@ -0,0 +1,237 @@
1+{-
2+Copyright (C) 2014 Matthew Pickering <matthewtpickering@gmail.com>
3+
4+This program is free software; you can redistribute it and/or modify
5+it under the terms of the GNU General Public License as published by
6+the Free Software Foundation; either version 2 of the License, or
7+(at your option) any later version.
8+
9+This program is distributed in the hope that it will be useful,
10+but WITHOUT ANY WARRANTY; without even the implied warranty of
11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+GNU General Public License for more details.
13+
14+You should have received a copy of the GNU General Public License
15+along with this program; if not, write to the Free Software
16+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17+-}
18+
19+{- |
20+ Module : Text.Pandoc.Readers.Docx.Fonts
21+ Copyright : Copyright (C) 2014 Matthew Pickering
22+ License : GNU GPL, version 2 or above
23+
24+ Maintainer : Matthew Pickering <matthewtpickering@gmail.com>
25+ Stability : alpha
26+ Portability : portable
27+
28+Utilities to convert between font codepoints and unicode characters.
29+-}
30+module Text.Pandoc.Readers.Docx.Fonts (getUnicode, Font(..)) where
31+
32+
33+-- | Enumeration of recognised fonts
34+data Font = Symbol -- ^ <http://en.wikipedia.org/wiki/Symbol_(typeface) Adobe Symbol>
35+
36+-- | Given a font and codepoint, returns the corresponding unicode
37+-- character
38+getUnicode :: Font -> Char -> Maybe Char
39+getUnicode Symbol c = lookup c symbol
40+
41+-- Generated from lib/fonts/symbol.txt
42+symbol :: [(Char, Char)]
43+symbol =
44+ [ (' ',' ')
45+ , (' ','\160')
46+ , ('!','!')
47+ , ('"','\8704')
48+ , ('#','#')
49+ , ('$','\8707')
50+ , ('%','%')
51+ , ('&','&')
52+ , ('\'','\8715')
53+ , ('(','(')
54+ , (')',')')
55+ , ('*','\8727')
56+ , ('+','+')
57+ , (',',',')
58+ , ('-','\8722')
59+ , ('.','.')
60+ , ('/','/')
61+ , ('0','0')
62+ , ('1','1')
63+ , ('2','2')
64+ , ('3','3')
65+ , ('4','4')
66+ , ('5','5')
67+ , ('6','6')
68+ , ('7','7')
69+ , ('8','8')
70+ , ('9','9')
71+ , (':',':')
72+ , (';',';')
73+ , ('<','<')
74+ , ('=','=')
75+ , ('>','>')
76+ , ('?','?')
77+ , ('@','\8773')
78+ , ('A','\913')
79+ , ('B','\914')
80+ , ('C','\935')
81+ , ('D','\916')
82+ , ('D','\8710')
83+ , ('E','\917')
84+ , ('F','\934')
85+ , ('G','\915')
86+ , ('H','\919')
87+ , ('I','\921')
88+ , ('J','\977')
89+ , ('K','\922')
90+ , ('L','\923')
91+ , ('M','\924')
92+ , ('N','\925')
93+ , ('O','\927')
94+ , ('P','\928')
95+ , ('Q','\920')
96+ , ('R','\929')
97+ , ('S','\931')
98+ , ('T','\932')
99+ , ('U','\933')
100+ , ('V','\962')
101+ , ('W','\937')
102+ , ('W','\8486')
103+ , ('X','\926')
104+ , ('Y','\936')
105+ , ('Z','\918')
106+ , ('[','[')
107+ , ('\\','\8756')
108+ , (']',']')
109+ , ('^','\8869')
110+ , ('_','_')
111+ , ('`','\63717')
112+ , ('a','\945')
113+ , ('b','\946')
114+ , ('c','\967')
115+ , ('d','\948')
116+ , ('e','\949')
117+ , ('f','\966')
118+ , ('g','\947')
119+ , ('h','\951')
120+ , ('i','\953')
121+ , ('j','\981')
122+ , ('k','\954')
123+ , ('l','\955')
124+ , ('m','\181')
125+ , ('m','\956')
126+ , ('n','\957')
127+ , ('o','\959')
128+ , ('p','\960')
129+ , ('q','\952')
130+ , ('r','\961')
131+ , ('s','\963')
132+ , ('t','\964')
133+ , ('u','\965')
134+ , ('v','\982')
135+ , ('w','\969')
136+ , ('x','\958')
137+ , ('y','\968')
138+ , ('z','\950')
139+ , ('{','{')
140+ , ('|','|')
141+ , ('}','}')
142+ , ('~','\8764')
143+ , ('\160','\8364')
144+ , ('\161','\978')
145+ , ('\162','\8242')
146+ , ('\163','\8804')
147+ , ('\164','\8260')
148+ , ('\164','\8725')
149+ , ('\165','\8734')
150+ , ('\166','\402')
151+ , ('\167','\9827')
152+ , ('\168','\9830')
153+ , ('\169','\9829')
154+ , ('\170','\9824')
155+ , ('\171','\8596')
156+ , ('\172','\8592')
157+ , ('\173','\8593')
158+ , ('\174','\8594')
159+ , ('\175','\8595')
160+ , ('\176','\176')
161+ , ('\177','\177')
162+ , ('\178','\8243')
163+ , ('\179','\8805')
164+ , ('\180','\215')
165+ , ('\181','\8733')
166+ , ('\182','\8706')
167+ , ('\183','\8226')
168+ , ('\184','\247')
169+ , ('\185','\8800')
170+ , ('\186','\8801')
171+ , ('\187','\8776')
172+ , ('\188','\8230')
173+ , ('\189','\63718')
174+ , ('\190','\63719')
175+ , ('\191','\8629')
176+ , ('\192','\8501')
177+ , ('\193','\8465')
178+ , ('\194','\8476')
179+ , ('\195','\8472')
180+ , ('\196','\8855')
181+ , ('\197','\8853')
182+ , ('\198','\8709')
183+ , ('\199','\8745')
184+ , ('\200','\8746')
185+ , ('\201','\8835')
186+ , ('\202','\8839')
187+ , ('\203','\8836')
188+ , ('\204','\8834')
189+ , ('\205','\8838')
190+ , ('\206','\8712')
191+ , ('\207','\8713')
192+ , ('\208','\8736')
193+ , ('\209','\8711')
194+ , ('\210','\63194')
195+ , ('\211','\63193')
196+ , ('\212','\63195')
197+ , ('\213','\8719')
198+ , ('\214','\8730')
199+ , ('\215','\8901')
200+ , ('\216','\172')
201+ , ('\217','\8743')
202+ , ('\218','\8744')
203+ , ('\219','\8660')
204+ , ('\220','\8656')
205+ , ('\221','\8657')
206+ , ('\222','\8658')
207+ , ('\223','\8659')
208+ , ('\224','\9674')
209+ , ('\225','\9001')
210+ , ('\226','\63720')
211+ , ('\227','\63721')
212+ , ('\228','\63722')
213+ , ('\229','\8721')
214+ , ('\230','\63723')
215+ , ('\231','\63724')
216+ , ('\232','\63725')
217+ , ('\233','\63726')
218+ , ('\234','\63727')
219+ , ('\235','\63728')
220+ , ('\236','\63729')
221+ , ('\237','\63730')
222+ , ('\238','\63731')
223+ , ('\239','\63732')
224+ , ('\241','\9002')
225+ , ('\242','\8747')
226+ , ('\243','\8992')
227+ , ('\244','\63733')
228+ , ('\245','\8993')
229+ , ('\246','\63734')
230+ , ('\247','\63735')
231+ , ('\248','\63736')
232+ , ('\249','\63737')
233+ , ('\250','\63738')
234+ , ('\251','\63739')
235+ , ('\252','\63740')
236+ , ('\253','\63741')
237+ , ('\254','\63742')]