Skip to content

Commit a0982f8

Browse files
author
Zhang Xiaoye
committed
extmod/framebuf: The text method support 4 z1fonts, return drawn width.
Signed-off-by: Eluli Zhang <elulis@gmail.com>
1 parent 1360584 commit a0982f8

File tree

7 files changed

+401
-149
lines changed

7 files changed

+401
-149
lines changed

docs/library/framebuf.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,23 @@ The following methods draw shapes onto the FrameBuffer.
112112
Drawing text
113113
------------
114114

115-
.. method:: FrameBuffer.text(s, x, y[, c])
115+
.. method:: FrameBuffer.text(s, x, y[, c [, font_id]])
116116

117-
Write text to the FrameBuffer using the the coordinates as the upper-left
117+
Write text to the FrameBuffer using the coordinates as the upper-left
118118
corner of the text. The color of the text can be defined by the optional
119-
argument but is otherwise a default value of 1. All characters have
120-
dimensions of 8x8 pixels and there is currently no way to change the font.
119+
argument *c*, which defaults to 1 if not provided. Additionally, you can
120+
specify an optional *font_id* argument to select the font style, where
121+
*font_id* can be 0, 1, 2, or 3. The method returns the width of the drawn
122+
text in pixels.
123+
124+
The *font_id* argument is used to select the font style. The default *font_id*
125+
is 1, which is the default monospace font Z1Mono8b_8x8. The other fonts are:
126+
127+
- 0: Z1Mono8_6x8 (A 6x8 monospace font)
128+
- 2: Z1Prop8_6x8 (A 6x8 proportional font with a max width of 6 pixels)
129+
- 3: Z1Prop8b_8x8 (An 8x8 proportional font with a max width of 8 pixels.
130+
This font is more readable than Z1Mono8_6x8 on high DPI displays and usually
131+
takes less screen width.)
121132

122133

123134
Other methods

extmod/font_petme128_8x8.h

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy