mirror of
https://github.com/esphome/esphome.git
synced 2025-04-08 03:40:28 +01:00
fix 1bpp rendering (#8463)
This commit is contained in:
parent
20c7778524
commit
f131186e6b
@ -12,8 +12,8 @@ import esphome_glyphsets as glyphsets
|
||||
from freetype import (
|
||||
FT_LOAD_NO_BITMAP,
|
||||
FT_LOAD_RENDER,
|
||||
FT_LOAD_TARGET_MONO,
|
||||
Face,
|
||||
ft_pixel_mode_grays,
|
||||
ft_pixel_mode_mono,
|
||||
)
|
||||
import requests
|
||||
@ -509,7 +509,6 @@ async def to_code(config):
|
||||
glyph_args = {}
|
||||
data = []
|
||||
bpp = config[CONF_BPP]
|
||||
mode = ft_pixel_mode_grays
|
||||
scale = 256 // (1 << bpp)
|
||||
size = config[CONF_SIZE]
|
||||
# create the data array for all glyphs
|
||||
@ -524,8 +523,9 @@ async def to_code(config):
|
||||
flags = FT_LOAD_RENDER
|
||||
if bpp != 1:
|
||||
flags |= FT_LOAD_NO_BITMAP
|
||||
else:
|
||||
flags |= FT_LOAD_TARGET_MONO
|
||||
font.load_char(codepoint, flags)
|
||||
font.glyph.render(mode)
|
||||
width = font.glyph.bitmap.width
|
||||
height = font.glyph.bitmap.rows
|
||||
buffer = font.glyph.bitmap.buffer
|
||||
|
Loading…
x
Reference in New Issue
Block a user