Skip to content

feat(mattext): add text_filter#72

Merged
cloudwu merged 2 commits intocloudwu:masterfrom
yuchanns:feat/mattext-filter
Feb 8, 2026
Merged

feat(mattext): add text_filter#72
cloudwu merged 2 commits intocloudwu:masterfrom
yuchanns:feat/mattext-filter

Conversation

@yuchanns
Copy link
Contributor

@yuchanns yuchanns commented Feb 7, 2026

  1. set_ime_rect 新增颜色参数用于设置 macOS/WASM preedit 字体颜色
  2. 独立 text_bindings, 新增 text_filter 用于设置高清字体
  3. 修复 WASM 的 preedit 字体 baseline 问题
image image

@cloudwu
Copy link
Owner

cloudwu commented Feb 8, 2026

有几个改进建议:

  1. lset_ime_rect 的参数太多了,而且都是数字。所以接口建议改成传一个 table 。类似这样:
  set_imge_rect { width = 100, height = 100, color = 0xffffff } 

这些项目就可以实现好默认值,这样也能在后面再扩展做兼容。

  1. set_text_filter 是明显的接口位置不对,建议先把这个退回去。我可以后面加上。因为这里是给 bindings 加一个 sampler ,这是引擎已经实现的功能,只是 sampler 现在没有加上具体的设置初始化参数的接口而已,补上就够了。见:

https://github.com/cloudwu/soluna/blob/master/src/render.c#L491

@cloudwu
Copy link
Owner

cloudwu commented Feb 8, 2026

7c05807 我在这里给 sampler 加上了 filter 和 wrap 的参数。还有一些以后根据需要再加。

在 setting 文件中,加入

text_sampler :
  min_filter : nearest
  mag_filter : nearest

就可以设置

不过。就这里的 shader 而言,设置 nearest 采样是没有意义的。因为这个贴图是 sdf 图,它在生成时就有过渡了。如果需要做点阵字,从生成贴图环节就不能生成 sdf 图,且需要写一个额外的 text shader ,这样 nearest 采样才有意义。

@yuchanns yuchanns marked this pull request as draft February 8, 2026 14:56
@yuchanns yuchanns force-pushed the feat/mattext-filter branch 4 times, most recently from b791985 to 78e0df6 Compare February 8, 2026 15:16
@yuchanns yuchanns force-pushed the feat/mattext-filter branch from 78e0df6 to 18130cd Compare February 8, 2026 15:24
@yuchanns
Copy link
Contributor Author

yuchanns commented Feb 8, 2026

不过。就这里的 shader 而言,设置 nearest 采样是没有意义的。

这里是打算使用 linear, 似乎默认是 nearest.

@yuchanns yuchanns force-pushed the feat/mattext-filter branch 4 times, most recently from cb0692d to 5cb8e44 Compare February 8, 2026 15:50
@yuchanns yuchanns marked this pull request as ready for review February 8, 2026 15:51
@yuchanns yuchanns requested a review from cloudwu February 8, 2026 15:54
@yuchanns yuchanns force-pushed the feat/mattext-filter branch from 5cb8e44 to 42b31fc Compare February 8, 2026 16:00
@cloudwu cloudwu merged commit 7a75a89 into cloudwu:master Feb 8, 2026
5 checks passed
@yuchanns yuchanns requested a review from cloudwu February 8, 2026 16:08
@yuchanns yuchanns deleted the feat/mattext-filter branch February 8, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments