From 295c9207a57f3ff2c85878847e73c2469c63d7e3 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 16 Jul 2019 20:12:48 -0700 Subject: [PATCH] updated docs for new version --- README.md | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2868486..2eebc0f 100644 --- a/README.md +++ b/README.md @@ -5,20 +5,42 @@ This project takes a .bdf file and turns it into a [NumPy](https://www.numpy.org ## Usage ```python -import numpy as np -import matplotlib.pyplot as plt +from bdfparse import Font -font = parse_chars("9x18.bdf") -matrix = font["A"] -text = "nson" +font = Font('9x18.bdf') -for letter in text: - matrix = np.concatenate((matrix, font[letter]), axis=1) - -plt.imshow(matrix) -plt.show() +print(font.word('Hi')) ``` Which outputs: +```python +[[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0] + [0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0] + [0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 1 1 0] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]] +``` + +Or you can use matplotlib to make the output a bit prettier. + +```python +import matplotlib.pyplot as plt + +plt.imshow(font.word('Anson')) +``` + ![Example of code output that reads Anson.](example.png)