Commit graph

68 commits

Author SHA1 Message Date
Jeff Epler
004085e34c bdf: Improve performance of bitmap font loading
Loading fonts can be one of the slow phases of a Magtag type project,
and run time decreases battery lifetime.  Therefore, it's warranted
to write less idiomatic Python here if it improves runtime significantly.

This change assumes that the lines within a character come in a specific
order.  While the document ostensibly defining the BDF file format
https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5005.BDF_Spec.pdf
does not say that the order is defined, I inspected the source of the
Linux program "bdftopcf" which has been used for decades to convert
textual bdf font files into binary pcf files, and it too assumes that the
lines come in a defined order.  I doubt that bdf files that do not work
with the linux bdftopcf program are less scarce than unicorns.

I timed loading the characters "Adafruit CircuitPython" from the font
"GothamBlack-50.bdf" on a PyBadge in CircuitPython 6.0.0:

```python
font = load_font("/GothamBlack-50.bdf")
font.load_glyphs("Adafruit CircuitPython")
```

The time decreased from 919ms to 530ms (-42%).

Just reading all the lines in the font file takes 380ms.  However,
only the first 38% of the file (or so) needs to be read, so the I/O time
is about 140ms.
2020-12-05 16:00:17 -06:00
Jeff Epler
cbf2261016 bdf: Add ascent, descent properties
This will be used by a future version of adafruit_display_text to avoid
needing to load glyphs from the font to guess these values.
2020-12-05 16:00:01 -06:00
Scott Shawcroft
51e9a1fa2e
Merge pull request #30 from FoamyGuy/magtag_example
adding MagTag example
2020-11-23 15:16:04 -08:00
foamyguy
8c1fa9b684 a few comments in magtag example 2020-11-22 15:04:12 -06:00
foamyguy
c38baeb932 adding magtag example 2020-11-22 15:01:06 -06:00
foamyguy
7e153547f5
Merge pull request #29 from adafruit/tannewt-patch-1
Fix 2.6.0 lint
2020-09-03 19:33:27 -05:00
Scott Shawcroft
ca48d4afde
Merge pull request #28 from ronfischler/set-changed-during-iteration-fix
Make a copy of the set to iterate over, not the original set we will …
2020-09-02 16:57:41 -07:00
Scott Shawcroft
1f46cc3a68
reorder imports 2020-09-02 16:46:51 -07:00
Scott Shawcroft
977edcbd88
Reorder imports 2020-09-02 16:43:09 -07:00
ronfischler
2501072843 Make a copy of the set to iterate over, not the original set we will be removing items from 2020-09-02 12:06:32 -07:00
Kattni
1d712519fc
Merge pull request #27 from FoamyGuy/adding_more_examples
Adding more examples
2020-08-17 15:17:17 -04:00
FoamyGuy
fa19aa5697 keep showing the text 2020-08-15 19:34:58 -05:00
FoamyGuy
eec7b341b8 adding a label example 2020-08-15 16:08:59 -05:00
FoamyGuy
d74656c372 adding a displayio example 2020-08-15 16:00:25 -05:00
Jeff Epler
784322cac4
Merge pull request #24 from FoamyGuy/fix_docs_link_in_readme
fix docs link in readme
2020-08-15 07:34:53 -05:00
FoamyGuy
3116924087 fix docs link in readme 2020-08-14 21:06:59 -05:00
dherrada
5a2b0496cb Fixed discord invite link 2020-07-08 16:49:04 -04:00
Dan Halbert
33439e7479
Merge pull request #22 from adafruit/black-update
Black reformatting with Python 3 target.
2020-04-09 21:48:07 -04:00
Kattni Rembor
43be1dac6b Black reformatting with Python 3 target. 2020-04-09 17:22:09 -04:00
sommersoft
cc47939b31 build.yml: add black formatting check
Signed-off-by: sommersoft <sommersoft@gmail.com>
2020-04-07 16:12:22 -05:00
Kattni
5042a3a633
Merge pull request #21 from FoamyGuy/remove-backward-compatibility
Remove backward compatibility
2020-04-02 12:04:00 -04:00
FoamyGuy
97dadca2d1 update mock imports in docs conf 2020-04-01 20:06:22 -05:00
foamyguy
5ab346373b
change Glyph import to fontio 2020-04-01 19:04:50 -05:00
Kattni Rembor
f42442a15b Removing 3.0.0 compatibility. 2020-03-30 11:59:40 -04:00
Kattni
b916b709bc
Merge pull request #19 from andreamah/pip-installation-fix
setup.py fixes for correct pip installation
2020-03-18 14:38:10 -04:00
andreamah
428433025a setup.py fixes for correct pip installation 2020-03-18 09:55:23 -07:00
Kattni
4b663e6f25
Merge pull request #17 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2020-03-16 18:44:05 -04:00
dherrada
0e13195ac9 Ran black, updated to pylint 2.x 2020-03-15 16:17:54 -04:00
sommersoft
ffbfb560f9
Merge pull request #16 from sommersoft/patch_coc
Update Code of Conduct
2020-03-15 09:18:54 -05:00
sommersoft
756e84e3d6 update code of conduct 2020-03-15 09:12:33 -05:00
sommersoft
8d19d48e87 update pylintrc for black
Signed-off-by: sommersoft <sommersoft@gmail.com>
2020-03-08 19:06:16 -05:00
sommersoft
0d0ef30b06 build.yml: move pylint, black, and Sphinx installs to each repo; add description to 'actions-ci/install.sh'
Signed-off-by: sommersoft <sommersoft@gmail.com>
2020-03-05 10:05:13 -06:00
sommersoft
1754a8a52b update pylint examples directive
Signed-off-by: sommersoft <sommersoft@gmail.com>
2020-01-14 17:18:42 -06:00
Kattni
6edb08c222
Merge pull request #6 from SeattleChris/example_test
Examples test working
2020-01-12 15:37:40 -05:00
Kattni
b274f6270b
Update to correct pylint: disable error 2020-01-12 15:34:46 -05:00
Scott Shawcroft
958cf34ad3
Add comment and disable lint error 2020-01-10 11:35:38 -08:00
Jeff Epler
b3356eb5e2
Merge pull request #15 from tannewt/load_string_glyphs
Handle string inputs to load_glyphs for BDF.
2020-01-08 16:00:26 -06:00
Scott Shawcroft
5a0dae65e3
Don't encode because it breaks unicode values. 2020-01-08 11:29:17 -08:00
Scott Shawcroft
af0ba1d2ef
Handle string inputs to load_glyphs for BDF. 2020-01-07 15:06:50 -08:00
Limor "Ladyada" Fried
49f281898d
Merge pull request #14 from adafruit/dherrada-patch-1
Moved repository from Travis to GitHub Actions
2019-12-27 22:54:19 -05:00
dherrada
50776d8e63 Moved repository from Travis to GitHub Actions 2019-12-27 22:23:52 -05:00
Kattni
31d0b01c14
Merge pull request #12 from adafruit/dherrada-patch-1
Removed building locally section from README, replaced with documenta…
2019-10-21 19:54:56 -04:00
dherrada
87ffc91e4d
Removed building locally section from README, replaced with documentation section 2019-10-17 18:17:44 -04:00
Limor "Ladyada" Fried
1c0d724da3
Merge pull request #11 from tannewt/improve_preload
Speed up preloads with duplicate code points
2019-05-21 20:34:45 -04:00
Scott Shawcroft
57e9e98bfd
Rename variable for lint. 2019-05-21 16:02:22 -07:00
Scott Shawcroft
fc75a1aade
Speed up preloads with duplicate code points
The original logic wouldn't recognize duplicate characters
in the given set to preload and therefore it'd read the whole
font file looking for a character it already found. A set
deduplicates the given characters at a small memory cost.
2019-05-21 15:55:58 -07:00
Dan Halbert
2f64725e6e
Merge pull request #8 from tannewt/fontio
Add support for fontio
2019-03-20 17:38:28 -04:00
Scott Shawcroft
e26a474223
Add support for fontio 2019-03-19 16:20:17 -07:00
Chris L Chapman
5a5e2865f7 Examples test working 2019-02-25 15:54:51 -08:00
Kattni
c0f8e55764
Merge pull request #4 from adafruit/kattni-patch-1
Fix syntax issue.
2019-02-18 18:23:48 -05:00