Skip to content
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

Add a font protocol #5759

Merged
merged 2 commits into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ twine
wheel
astroid
setuptools
setuptools_scm

# For sphinx
Sphinx<4
Expand Down
19 changes: 19 additions & 0 deletions shared-bindings/fontio/BuiltinFont.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"

//| from typing_extensions import Protocol # for compat with python < 3.8
//|
//| class FontProtocol(Protocol):
//| """A protocol shared by `BuiltinFont` and classes in ``adafruit_bitmap_font``"""
//| def get_bounding_box(self) -> Union[Tuple[int, int], Tuple[int, int, int, int]]:
//| """Retrieve the maximum bounding box of any glyph in the font.
//|
//| The four element version is ``(width, height, x_offset, y_offset)``.
//| The two element version is ``(width, height)``, in which
//| ``x_offset`` and ``y_offset`` are assumed to be zero."""
//| pass
//|
//| def get_glyph(self, codepoint: int) -> Optional[Glyph]:
//| """Retrieve the Glyph for a given code point
//|
//| If the code point is not present in the font, `None` is returned."""
//| pass
//|

//| class BuiltinFont:
//| """A font built into CircuitPython"""
//|
Expand Down