Skip to content

Custom fonts for text labels do not work for multiple labels #29

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

Closed
brentru opened this issue Oct 23, 2020 · 0 comments · Fixed by #30
Closed

Custom fonts for text labels do not work for multiple labels #29

brentru opened this issue Oct 23, 2020 · 0 comments · Fixed by #30
Labels
bug Something isn't working

Comments

@brentru
Copy link
Member

brentru commented Oct 23, 2020

Providing add_text a custom font does not seem to track the label's index like other text properties do (color, scale, etc, https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal/blob/master/adafruit_matrixportal/matrixportal.py#L120).

The second time a user calls add_text, the _text_font property is changed to the latest text label's font.

In this example,

matrixportal.add_text(
    text_font=("/IBMPlexMono-Medium-24_jep.bdf"),
    text_position=((matrixportal.graphics.display.width // 4) - 1, (matrixportal.graphics.display.height // 3) - 1),
    text_color=0x800000,
)
matrixportal.preload_font("0123456789")

matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(2, 25),
    text_color=0x000080,
    scrolling = True
)

The value of _text_font would be set as terminalio.FONT

This causes an issue in set_text where self._text_font is used to create the Label. The first label would be initialized with the second label's font
https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal/blob/master/adafruit_matrixportal/matrixportal.py#L282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant