1010# Waveshare LCD imports
1111try :
1212 from waveshare_lcd import (
13- get_font_size as waveshare_get_font_size ,
13+ FONT_DEFAULT ,
1414 fill_screen as waveshare_fill_screen ,
1515 draw_line ,
1616 draw_rect as waveshare_draw_rect ,
3535 deinit ,
3636 init ,
3737 clear_framebuffer ,
38- CHAR_WIDTH ,
39- FONT_HEIGHT ,
38+ FONT_DEFAULT ,
4039 draw_circle ,
4140 fill_circle ,
4241 fill_rect ,
@@ -61,13 +60,16 @@ class Draw:
6160 def __init__ (
6261 self , foreground : int = TFT_WHITE , background : int = TFT_BLACK , mode : int = 0
6362 ) -> None :
63+ from picoware .system .font import FontSize
64+
6465 self ._current_board_id = BOARD_ID
6566
6667 self ._background = background
6768 self ._foreground = foreground
6869
6970 self ._size = Vector (0 , 0 )
70- self ._font_size = Vector (0 , 0 )
71+ default_font = FontSize (FONT_DEFAULT )
72+ self ._font_size = Vector (default_font .width , default_font .height )
7173
7274 self ._use_lvgl = False
7375
@@ -76,31 +78,25 @@ def __init__(
7678
7779 # Initialize native LCD extension
7880 init (True )
79- self ._font_size .x , self ._font_size .y = waveshare_get_font_size ()
8081
8182 elif self ._current_board_id == BOARD_WAVESHARE_1_43_RP2350 :
8283 self ._size .x , self ._size .y = 466 , 466
8384
8485 # Initialize native LCD extension
8586 init ()
86- self ._font_size .x , self ._font_size .y = waveshare_get_font_size ()
8787
8888 elif self ._current_board_id == BOARD_WAVESHARE_3_49_RP2350 :
8989 self ._size .x , self ._size .y = 172 , 640
9090
9191 # Initialize native LCD extension
9292 init ()
93- self ._font_size .x , self ._font_size .y = waveshare_get_font_size ()
9493
9594 else : # PicoCalc
9695 self ._size .x , self ._size .y = 320 , 320
9796
9897 # Initialize native LCD extension
9998 init (background , mode )
10099
101- self ._font_size .x = CHAR_WIDTH
102- self ._font_size .y = FONT_HEIGHT
103-
104100 # Clear the display and framebuffer
105101 clear_framebuffer (self ._rgb565_to_rgb332 (background ))
106102
0 commit comments