mirror of
https://gitlab.com/MisterBiggs/bdfparse.git
synced 2025-06-16 14:36:40 +00:00
Added more chars for word function
This commit is contained in:
parent
a49ce715cc
commit
65e188c764
@ -8,6 +8,31 @@ class Font:
|
|||||||
self.cols = self.properties["FONTBOUNDINGBOX"][0]
|
self.cols = self.properties["FONTBOUNDINGBOX"][0]
|
||||||
self.rows = self.properties["FONTBOUNDINGBOX"][1]
|
self.rows = self.properties["FONTBOUNDINGBOX"][1]
|
||||||
self.shape = (self.rows, self.cols)
|
self.shape = (self.rows, self.cols)
|
||||||
|
self.charNames = {
|
||||||
|
" ": "space",
|
||||||
|
"1": "one",
|
||||||
|
"2": "two",
|
||||||
|
"3": "three",
|
||||||
|
"4": "four",
|
||||||
|
"5": "five",
|
||||||
|
"6": "six",
|
||||||
|
"7": "seven",
|
||||||
|
"8": "eight",
|
||||||
|
"9": "nine",
|
||||||
|
"!": "exclam",
|
||||||
|
"@": "at",
|
||||||
|
"#": "numbersign",
|
||||||
|
"$": "dollar",
|
||||||
|
"%": "percent",
|
||||||
|
"&": "ampersand",
|
||||||
|
"*": "asterisk",
|
||||||
|
"(": "parenleft",
|
||||||
|
")": "parenright",
|
||||||
|
",": "comma",
|
||||||
|
".": "period",
|
||||||
|
"/": "lslash",
|
||||||
|
"?": "question",
|
||||||
|
}
|
||||||
|
|
||||||
def parse_properties(self, bdfFile):
|
def parse_properties(self, bdfFile):
|
||||||
|
|
||||||
@ -193,16 +218,8 @@ class Font:
|
|||||||
def word(self, word: str):
|
def word(self, word: str):
|
||||||
matrix = np.zeros(self.shape)
|
matrix = np.zeros(self.shape)
|
||||||
for char in word:
|
for char in word:
|
||||||
if char is " ":
|
if char in self.charNames.keys():
|
||||||
arr = np.zeros(self.shape)
|
arr = self.chars[self.charNames[char]]
|
||||||
elif char is "!":
|
|
||||||
arr = self.chars["exclam"]
|
|
||||||
elif char is "%":
|
|
||||||
arr = self.chars["percent"]
|
|
||||||
elif char is ",":
|
|
||||||
arr = self.chars["comma"]
|
|
||||||
elif char is ".":
|
|
||||||
arr = self.chars["period"]
|
|
||||||
else:
|
else:
|
||||||
arr = self.chars[char]
|
arr = self.chars[char]
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -10,7 +10,7 @@ with open("README.md", "r") as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="bdfparse",
|
name="bdfparse",
|
||||||
version="2019.6",
|
version="2019.7",
|
||||||
author="Anson Biggs",
|
author="Anson Biggs",
|
||||||
author_email="anson@ansonbiggs.com",
|
author_email="anson@ansonbiggs.com",
|
||||||
description="A package for reading .bdf files into NumPy arrays.",
|
description="A package for reading .bdf files into NumPy arrays.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user