diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5426633 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Mienai"] + path = Mienai + url = https://github.com/MFEK/Mienai.ttf diff --git a/Mienai b/Mienai new file mode 160000 index 0000000..e1d9921 --- /dev/null +++ b/Mienai @@ -0,0 +1 @@ +Subproject commit e1d99216b75274deaa58cea0ae610d07446c4f39 diff --git a/hocr-pdf b/hocr-pdf index f0f1536..55f52fc 100755 --- a/hocr-pdf +++ b/hocr-pdf @@ -121,38 +121,12 @@ def add_text_layer(pdf, image, height, dpi): def polyval(poly, x): return x * poly[0] + poly[1] - -# Glyphless variation of vedaal's invisible font retrieved from -# http://www.angelfire.com/pr/pgpf/if.html, which says: -# 'Invisible font' is unrestricted freeware. Enjoy, Improve, Distribute freely def load_invisible_font(): - font = """ -eJzdlk1sG0UUx/+zs3btNEmrUKpCPxikSqRS4jpfFURUagmkEQQoiRXgAl07Y3vL2mvt2ml8APXG -hQPiUEGEVDhWVHyIC1REPSAhBOWA+BCgSoULUqsKcWhVBKjhzfPU+VCi3Flrdn7vzZv33ryZ3TUE -gC6chsTx8fHck1ONd98D0jnS7jn26GPjyMIleZhk9fT0wcHFl1/9GRDPkTxTqHg1dMkzJH9CbbTk -xbWlJfKEdB+Np0pBswi+nH/Nvay92VtfJp4nvEztUJkUHXsdksUOkveXK/X5FNuLD838ICx4dv4N -I1e8+ZqbxwCNP2jyqXoV/fmhy+WW/2SqFsb1pX68SfEpZ/TCrI3aHzcP//jitodvYmvL+6Xcr5mV -vb1ScCzRnPRPfz+LsRSWNasuwRrZlh1sx0E8AriddyzEDfE6EkglFhJDJO5u9fJbFJ0etEMB78D5 -4Djm/7kjT0wqhSNURyS+u/2MGJKRu+0ExNkrt1pJti9p2x6b3TBJgmUXuzgnDmI8UWMbkVxeinCw -Mo311/l/v3rF7+01D+OkZYE0PrbsYAu+sSyxU0jLLtIiYzmBrFiwnCT9FcsdOOK8ZHbFleSn0znP -nDCnxbnAnGT9JeYtrP+FOcV8nTlNnsoc3bBAD85adtCNRcsSffjBsoseca/lBE7Q09LiJOm/ttyB -0+IqcwfncJt5q4krO5k7jV7uY+5m7mPebuLKUea7iHvk48w72OYF5rvZT8C8k/WvMN/Dc19j3s02 -bzPvZZv3me9j/ox5P9t/xdzPzPVJcc7yGnPL/1+GO1lPVTXM+VNWOTRRg0YRHgrUK5yj1kvaEA1E -xAWiCtl4qJL2ADKkG6Q3XxYjzEcR0E9hCj5KtBd1xCxp6jV5mKP7LJBr1nTRK2h1TvU2w0akCmGl -5lWbBzJqMJsdyaijQaCm/FK5HqspHetoTtMsn4LO0T2mlqcwmlTVOT/28wGhCVKiNANKLiJRlxqB -F603axQznIzRhDSq6EWZ4UUs+xud0VHsh1U1kMlmNwu9kTuFaRqpURU0VS3PVmZ0iE7gct0MG/8+ -2fmUvKlfRLYmisd1w8pk1LSu1XUlryM1MNTH9epTftWv+16gIh1oL9abJZyjrfF5a4qccp3oFAcz -Wxxx4DpvlaKKxuytRDzeth5rW4W8qBFesvEX8RFRmLBHoB+TpCmRVCCb1gFCruzHqhhW6+qUF6tC -pL26nlWN2K+W1LhRjxlVGKmRTFYVo7CiJug09E+GJb+QocMCPMWBK1wvEOfRFF2U0klK8CppqqvG -pylRc2Zn+XDQWZIL8iO5KC9S+1RekOex1uOyZGR/w/Hf1lhzqVfFsxE39B/ws7Rm3N3nDrhPuMfc -w3R/aE28KsfY2J+RPNp+j+KaOoCey4h+Dd48b9O5G0v2K7j0AM6s+5WQ/E0wVoK+pA6/3bup7bJf -CMGjwvxTsr74/f/F95m3TH9x8o0/TU//N+7/D/ScVcA= -""".encode('latin1') - uncompressed = bytearray(zlib.decompress(base64.b64decode(font))) - ttf = io.BytesIO(uncompressed) - setattr(ttf, "name", "(invisible.ttf)") - pdfmetrics.registerFont(TTFont('invisible', ttf)) - + ttf = TTFont() + with open("Mienai/Mienai.ttx") as ttxml: + ttf.importXML(ttxml) + assert ttf['maxp'].numGlyphs == 3 + pdfmetrics.registerFont(ttf) if __name__ == "__main__": parser = argparse.ArgumentParser(