lvfontio doesn't consider ascent/descent
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- c
- 领域
- embedded-iot
调研方向
Start with the cited header-reading code in shared-module/lvfontio/OnDiskFont.c (lines 110–114) and the dimensions function (lines 568–570), then compare the font metrics described for the 1bpp and higher-bpp files. The issue does not name a test; reproduce the reported clipping and check how candidate sizing affects terminal row spacing. Done means higher-bpp descenders render without clipping while preserving the desired terminal sizing and alignment.
由索引模型根据 Issue 内容生成。
描述
Currently the lvfontio module reads the font_size and ascent out of the font file header. https://github.com/adafruit/circuitpython/blob/fd4226bb6e15884e9fa7f7014d54a4bfaf192db1/shared-module/lvfontio/OnDiskFont.c#L110-L114
and it uses the font_size as the height returned by common_hal_lvfontio_ondiskfont_get_dimensions https://github.com/adafruit/circuitpython/blob/fd4226bb6e15884e9fa7f7014d54a4bfaf192db1/shared-module/lvfontio/OnDiskFont.c#L568-L570
But it seems that font_size may not fully encompass all of the vertical pixels the font requires. I have noticed that >1bpp versions of the same font have a higher ascent value but the same font_size
Loaded 4bpp font from fonts/unifont-16.0.02-en_US_4bb.lvfontbin
Successfully loaded LVGL font
Font metrics:
Ascent: 15
Descent: -4
font_size: 16
Bounding box: width=0, height=16, x_offset=0, y_offset=-4
Loaded 1bpp font from fonts/unifont-16.0.02-en_US.lvfontbin
Successfully loaded LVGL font
Font metrics:
Ascent: 14
Descent: -4
font_size: 16
Bounding box: width=0, height=16, x_offset=0, y_offset=-4
This seems to be the root cause of the descenders or bottom row(s) of pixels getting cut off when attempting to set the terminal to use a font that is >1bpp
Default font descenders visible 'y' and 'g' characters:
2bpp version of same font descenders clipped:
adafruit_bitmap_font does not seem to have the same issue, using that and BitmapLabel the descenders are rendered in full.
Codex suggested this patch to resolve it by reading the descent value from the header and using it + ascent to calculate the full size.
lvfontio-descent-header.patch
That does work to stop the bottom from getting clipped, but it means that the tile size for the Terminal is bigger, more space in between rows, and doesn't evenly align or evenly divide into the display size.
In practice it seems like for this font (unifont v16.0.02) that the descent doesn't actually use the full ascent + descent range available at least on standard ASCII glyphs. The 'y' and 'g' each only seem to be missing 1 pixel row which to me looks like it matches the 1px difference in ascent value between the two fonts. When using the ascent + decent calculation it will end up at 18 or 19px for height instead of the 16 that we have now, or the 17 that seem like it would fit everything.
I'm interested in thoughts on whether this is something we want to try to resolve, and if so how best to do it in a way that ideally doesn't change the current default fonts terminal size, but does still allow custom >1bpp fonts to render without clipping.
- 主要语言
- C
- 星标
- 4.6k
- 派生
- 1.4k
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 161
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
adafruit/circuitpython 的其他 Issue
-
bug esp32 web workflow
难度 5/5 一周以上 新手友好度 12/100
adafruit/circuitpython#11616 · 9 条评论 ·
维护者通常 1 天内回复
-
nordic
难度 4/5 3-5 天 新手友好度 30/100
adafruit/circuitpython#11611 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
adafruit/circuitpython#11606 ·
维护者通常 1 天内回复
-
busio zephyr
难度 5/5 一周以上 新手友好度 18/100
adafruit/circuitpython#11605 ·
维护者通常 1 天内回复
-
busio zephyr
难度 4/5 3-5 天 新手友好度 28/100
adafruit/circuitpython#11604 ·
维护者通常 1 天内回复
查看 adafruit/circuitpython 的全部 Issue
相似的 Issue
-
mewencode: base256[] and base128[] are indexed out of bounds by a non-ASCII octet可能已有人在做 @kazu-yamamoto 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
kazu-yamamoto/Mew#276 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 91/100
FujiNetWIFI/fujinet-firmware#2045 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
[Performance]: Qwen-Image-2.1 CPU-only on i5-10500H (6C AVX2, 32 GB): 512x512 in 7.7 min at 8 steps未关闭
难度 1/5 1 小时以内 新手友好度 84/100
维护者通常 1 天内回复
-
area:gates area:gfx found-by:critic kind:gate-defect
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1825 ·
维护者通常 1 天内回复