mirror of
https://gitlab.com/MisterBiggs/bdfparse.git
synced 2025-06-15 14:06:39 +00:00
updated docs for new version
This commit is contained in:
parent
7df856e3d6
commit
295c9207a5
42
README.md
42
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'))
|
||||
```
|
||||
|
||||

|
||||
|
Loading…
x
Reference in New Issue
Block a user