summaryrefslogtreecommitdiff
path: root/wasp/fonts/__init__.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-14 19:00:04 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-14 19:00:04 (GMT)
commita77301ec64b9c3f88e699e89c554b21aa18fc50b (patch)
tree3dd03ce0045adf69be350a20c95e8b943c62524b /wasp/fonts/__init__.py
parent64afea0d0700edde10723bd243c2a4193d41063d (diff)
fonts: Add sans36 (numerals only)
At 36pt this is already gobbling a fair bit of flash so, for now, we've restricted this only numerals (and colon).
Diffstat (limited to 'wasp/fonts/__init__.py')
-rw-r--r--wasp/fonts/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/wasp/fonts/__init__.py b/wasp/fonts/__init__.py
new file mode 100644
index 0000000..917fb00
--- /dev/null
+++ b/wasp/fonts/__init__.py
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
+import fonts.sans24 as sans24
+import fonts.sans36 as sans36
+
+def height(font):
+ return font.height()
+
+def width(font, s):
+ w = 0
+ for ch in s:
+ (_, _, wc) = font.get_ch(ch)
+ w += wc + 1
+
+ return w
+
+