1 Star 0 Fork 0

CCH / ST7735

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gbk.py 787 Bytes
一键复制 编辑 原始数据 按行查看 历史
CCH 提交于 2024-04-12 03:13 . 定义字库类
import btree
class font16x16:
def __init__(self):
try:
self.f=open('gbk16x16.btree','rb') #打开文件
self.fontDB=btree.open(self.f) #打开数据库
except OSError:
self.f=None
self.fontDB=None
print('Failed to load the fontDB!')
def deinit(self):
if self.fontDB is not None:
self.fontDB.close()
self.f.close()
def get(self,ch:str):
if self.fontDB is None:
return 0,0,bytearray()
else:
bm=bytearray(self.fontDB.get(ch[0].encode(),self.fontDB[b"*"])) #在数据库内查找文字点阵图
w=len(bm)//2
return w,16,bm #返回字符信息
Python
1
https://gitee.com/cchmpy/st7735.git
git@gitee.com:cchmpy/st7735.git
cchmpy
st7735
ST7735
master

搜索帮助