pdf-extract-temporary-mitigation-panic 0.7.1

A library to extract content from pdfs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
f = open("glyphlist-extended.txt")
lines = f.readlines()
import re
glyphlist = []
for l in lines:
    if l[0] == '#' or l[0] == '\n':
        continue
    name, code = re.split('[; ]+', l)[0:2]
    glyphlist.append((name,int(code,16)))
glyphlist.sort()
print "/* Autogenerated from https://github.com/michal-h21/htfgen/commits/master/glyphlist-extended.txt */"
print "pub fn name_to_unicode(name: &str) -> Option<u16> {"
print "    let names = ["
print ",\n".join('(\"%s\", 0x%04x)' % (g[0], g[1]) for g in glyphlist)
print "    ];"
print "    let result = names.binary_search_by_key(&name, |&(name,code)| &name);"
print "    result.ok().map(|indx| names[indx].1)"
print "}"