Skip to content

Commit

Permalink
Add demo code
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Dec 14, 2023
1 parent 7b5bcf8 commit a39084e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions rcjk_read_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# pip install git+https://github.com/BlackFoundryCom/fontra.git
# pip install git+https://github.com/BlackFoundryCom/fontra-rcjk.git

# See src/fontra/core/classes.py in the fontra repo for the data structure
# PackedPath objects have a drawPoints method that takes a point pen


import argparse
import asyncio
from dataclasses import asdict
import json
import sys
from fontra_rcjk.backend_fs import RCJKBackend


async def main():
parser = argparse.ArgumentParser()
parser.add_argument("rcjk_path")
parser.add_argument("glyph_name")
args = parser.parse_args()
backend = RCJKBackend.fromPath(args.rcjk_path)
revCmap = await backend.getGlyphMap()
print(sorted(revCmap)[:100])
glyph = await backend.getGlyph(args.glyph_name)
print(json.dumps(asdict(glyph), indent=2))


asyncio.run(main())

0 comments on commit a39084e

Please sign in to comment.