Skip to content

feat(SquirrelTheme): allow customizing preedit area font - #1170

Merged
lotem merged 1 commit into
rime:masterfrom
ecstasoy:feat/preedit-font
Aug 12, 2026
Merged

feat(SquirrelTheme): allow customizing preedit area font#1170
lotem merged 1 commit into
rime:masterfrom
ecstasoy:feat/preedit-font

Conversation

@ecstasoy

Copy link
Copy Markdown
Contributor

问题

现有的字形 fallback 是按字形覆盖选字体的,无法按界面区域区分。当同一种文字同时出现在 preedit 和候选区时(例如中英混输时两边都有拉丁字母),就没办法只改其中一个区域的字体。preedit 也无法单独设置字体大小而只是跟随全局的style/font_point

解决

新增两个 style 配置项,让 preedit 区域的字体可以独立于候选区域设置字体和大小:

  • style/preedit_font_face
  • style/preedit_font_point

未设置时回退到 style/font_face / style/font_point。实现方式与已有的 label_font_* / comment_font_* 相同,同样支持在配色方案中覆盖。

配置

情况一:

  "style/font_face": "Source Han Sans SC-Bold"
  "style/font_point": 20
  ...
  "style/preedit_font_face": "JetBrains Mono-light"
  "style/preedit_font_point": 24

情况二:

  "style/font_face": "Source Han Sans SC-Bold"
  "style/font_point": 20
  ...
  # "style/preedit_font_face": "JetBrains Mono-light"
  "style/preedit_font_point": 16

效果

情况一:
image

情况二:
image

Adds two style fields so the preedit row's font can be configured
independently of the candidate text:

- style/preedit_font_face
- style/preedit_font_point

Falls back to style/font_face / style/font_point when not set.
@lotem

lotem commented Aug 12, 2026

Copy link
Copy Markdown
Member

可是可以,但是這項字體設置做什麼用呢?代碼裏並沒有使用。

style/font_point 管這行預編輯區,也管候選字。選中的候選字也會顯示在這裏。用同一種字體符合邏輯啊。

@ecstasoy

Copy link
Copy Markdown
Contributor Author

可是可以,但是這項字體設置做什麼用呢?代碼裏並沒有使用。

style/font_point 管這行預編輯區,也管候選字。選中的候選字也會顯示在這裏。用同一種字體符合邏輯啊。

是的有这个需求的人可能不多,我自己觉得对于某些字体能够单独调整大小的话视觉效果会协调一点,毕竟整个preedit和候选区的大小也是可以单独调整的,这个PR也是之前顺手一改的,您看看有没有必要吧!^_^

@lotem

lotem commented Aug 12, 2026

Copy link
Copy Markdown
Member

哦,看到了,preeditAttrspreeditHighlightedAttrs 應用了新的字體設置。

上次沒看全。整行換字體,這倒是不複雜。如果要只換編碼部分就比較麻煩。

准了!

@lotem
lotem merged commit 272474a into rime:master Aug 12, 2026
1 check passed
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