-
Notifications
You must be signed in to change notification settings - Fork 24
Implement PCF font loading #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A pcf font can be generated from a bdf font using `bdftopcf` from debian/ubuntu package fonts-utils
This font was probably manually trimmed from one with a larger repertoire of code points. This was fine, except that bdftopcf didn't like it.
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.
this is working great for me, can merge on CI |
ladyada
approved these changes
Dec 8, 2020
adafruit-adabot
added a commit
to adafruit/Adafruit_CircuitPython_Bundle
that referenced
this pull request
Dec 9, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_SCD30 to 1.0.1 from 1.0.0: > fixed co2=> eCO2 Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 1.3.0 from 1.2.3: > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#32 from jepler/pcf Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_SCD30
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PCF is a binary font format historically used in the X11 system. It offers a smaller size for many font files, as well as improved random access to glyph data.
PCF fonts can be created from BDF fonts with
bdftopcf
, such asbdftopcf -o Arial16.pcf Arial16.bdf
. bdf has many sub-formats. The format I selected is the default (on x86 / x64 systems). This is not quite the most compact format (it pads bitmap rows to a multiple of 32 bits) and it also doesn't match the preferred internal bitmap format of circuitpython. Adding support for other formats is possible.About 50% of the time loading are in the bit-pushing loop,
which is the most optimized version I could devise. A future improvement to the core to allow setting multiple pixels from a buffer (bitmap.blit or slice assignment) could yield further improvements.
On magtag loading the
yasashi24
font takes much less time, around 2s instead of 13s to load ASCII plus kana code points.This also