@@ -65,14 +65,14 @@ def __init__(self, display,
6565 self ._key = key
6666 self ._show = show
6767 self ._clear = clear
68- self ._reversion = reversion
69- self ._color_type = color_type
70- self ._color = color
71- self ._bg_color = bg_color
72- self ._size = size
73- self ._auto_wrap = auto_wrap
74- self ._half_char = half_char
75- self ._line_spacing = line_spacing
68+ self .reversion = reversion
69+ self .color_type = color_type
70+ self .color = color
71+ self .bg_color = bg_color
72+ self .font_size = size
73+ self .auto_wrap = auto_wrap
74+ self .half_char = half_char
75+ self .line_spacing = line_spacing
7676 self .font_bmf_info = None
7777 self .font_version = None
7878 self .font_file = None
@@ -260,7 +260,7 @@ def load_font(self, file: str):
260260 # 位图开始字节,位图数据位于文件尾,需要通过位图开始字节来确定字体数据实际位置
261261 self .font_start_bitmap = unpack (">I" , b'\x00 ' + self .font_bmf_info [4 :7 ])[0 ]
262262 # 字体大小,默认的文字字号,用于缩放方面的处理
263- self ._size = self .font_bmf_info [7 ]
263+ self .font_size = self .font_bmf_info [7 ]
264264 # 点阵所占字节,用来定位字体数据位置
265265 self .font_bitmap_size = self .font_bmf_info [8 ]
266266
@@ -287,30 +287,30 @@ def text(self, s: str, x: int, y: int,
287287 line_spacing: 行间距
288288 """
289289 if color is None :
290- color = self ._color
290+ color = self .color
291291 if bg_color is None :
292- bg_color = self ._bg_color
292+ bg_color = self .bg_color
293293 if key is None :
294294 key = self ._key
295295 if size is None :
296- size = self ._size
296+ size = self .font_size
297297 if show is None :
298298 show = self ._show
299299 if clear is None :
300300 clear = self ._clear
301301 if reversion is None :
302- reversion = self ._reversion
302+ reversion = self .reversion
303303 if auto_wrap is None :
304- auto_wrap = self ._auto_wrap
304+ auto_wrap = self .auto_wrap
305305 if half_char is None :
306- half_char = self ._half_char
306+ half_char = self .half_char
307307 if color_type is None :
308- color_type = self ._color_type
308+ color_type = self .color_type
309309 if line_spacing is None :
310- line_spacing = self ._line_spacing
310+ line_spacing = self .line_spacing
311311
312312 # 如果没有指定字号则使用默认字号
313- font_size = size or self ._size
313+ font_size = size or self .font_size
314314 # 记录初始的 x 位置
315315 init_x = x
316316
@@ -359,18 +359,18 @@ def text(self, s: str, x: int, y: int,
359359 # 4. 彩色屏幕/放缩
360360 byte_data = self ._reverse_byte_data (byte_data ) if reversion else byte_data
361361 if color_type == MONO_HLSB :
362- if font_size == self ._size :
362+ if font_size == self .font_size :
363363 dp .blit (
364364 FrameBuffer (bytearray (byte_data ), font_size , font_size , MONO_HLSB ),
365365 x , y ,
366366 key )
367367 else :
368368 dp .blit (
369- FrameBuffer (self ._HLSB_font_size (byte_data , font_size , self ._size ), font_size ,
369+ FrameBuffer (self ._HLSB_font_size (byte_data , font_size , self .font_size ), font_size ,
370370 font_size , MONO_HLSB ), x , y , key )
371371 elif color_type == RGB565 :
372372 palette = self ._calculate_palette (color , bg_color )
373- if font_size == self ._size :
373+ if font_size == self .font_size :
374374 data = self ._flatten_byte_data (byte_data , palette )
375375 if self ._buffer :
376376 dp .blit (
@@ -380,7 +380,7 @@ def text(self, s: str, x: int, y: int,
380380 dp .set_window (x , y , x + font_size - 1 , y + font_size - 1 )
381381 dp .write_data (data )
382382 else :
383- data = self ._RGB565_font_size (byte_data , font_size , palette , self ._size )
383+ data = self ._RGB565_font_size (byte_data , font_size , palette , self .font_size )
384384 if self ._buffer :
385385 dp .blit (
386386 FrameBuffer (data ,
@@ -430,13 +430,13 @@ def pbm(self, file: str, x, y, key: int = -1, show: bool = None, clear: bool = N
430430 if clear is None :
431431 clear = self ._clear
432432 if reversion is None :
433- reversion = self ._reversion
433+ reversion = self .reversion
434434 if color_type is None :
435- color_type = self ._color_type
435+ color_type = self .color_type
436436 if color is None :
437- color = self ._color
437+ color = self .color
438438 if bg_color is None :
439- bg_color = self ._bg_color
439+ bg_color = self .bg_color
440440 if clear : # 清屏
441441 self .clear ()
442442 dp = self .display
@@ -577,13 +577,13 @@ def bmp(self, file: str, x, y, key: int = -1, show: bool = None, clear: bool = N
577577 if clear is None :
578578 clear = self ._clear
579579 if reversion is None :
580- reversion = self ._reversion
580+ reversion = self .reversion
581581 if color_type is None :
582- color_type = self ._color_type
582+ color_type = self .color_type
583583 if color is None :
584- color = self ._color
584+ color = self .color
585585 if bg_color is None :
586- bg_color = self ._bg_color
586+ bg_color = self .bg_color
587587 with open (file , 'rb' ) as f :
588588 f_read = f .read
589589 f_rinto = f .readinto
0 commit comments