X Tutup
Skip to content

fix: 修复 IMSS 文本框中 emoji 无法正常显示的问题#893

Open
KonshinHaoshin wants to merge 1 commit intoOpenWebGAL:devfrom
KonshinHaoshin:dev
Open

fix: 修复 IMSS 文本框中 emoji 无法正常显示的问题#893
KonshinHaoshin wants to merge 1 commit intoOpenWebGAL:devfrom
KonshinHaoshin:dev

Conversation

@KonshinHaoshin
Copy link

修复 IMSS 文本框中 emoji 无法正常显示的问题。

此前文本框会将所有文本统一渲染为多层叠加结构(outer / inner / zhanwei),通过透明文字、渐变和描边来实现视觉效果。这套方案对普通文字有效,但会破坏彩色 emoji 的正常渲染。我之前即使将Segoe UI Emoji或者Noto Emoji等设为回退字体也依然会持出现emoji只有轮廓但是被涂黑的情况

本次修改增加了对 emoji 内容的检测:
当检测到当前节点包含 emoji 时,不再走渐变描边的叠层渲染,而是改为普通文本渲染,从而让系统 emoji 字体回退机制正常生效。

问题原因

问题不在于字体没有注册,而在于文本框当前的特效实现方式会影响彩色 emoji 的显示。
"Segoe UI Emoji" 作为系统字体本身可以直接作为回退字体使用,但由于文本实际是通过透明占位和多层覆盖来呈现的,导致 emoji 无法按正常方式绘制。

修改内容

  • IMSSTextbox 中增加 emoji 检测逻辑

验证方式

  • 在对话脚本中插入 emoji,确认 IMSS 文本框可以正常显示
  • 通过类型检查:

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在解决 IMSS 文本框中 emoji 显示异常的问题。由于文本框原有的特殊渲染效果(通过多层叠加实现透明文字、渐变和描边),导致彩色 emoji 无法正确呈现。本次修改通过引入 emoji 检测机制,并对包含 emoji 的文本进行条件渲染,使其以普通文本形式显示,从而允许系统正确处理 emoji 的字体回退,确保 emoji 能够正常、清晰地展示。

Highlights

  • 修复 IMSS 文本框 emoji 显示问题: 解决了 IMSS 文本框中彩色 emoji 无法正常显示的问题,此前文本框的多层叠加渲染方式会破坏 emoji 的视觉效果。
  • 引入 emoji 检测机制: 在 IMSSTextbox 组件中增加了对文本内容是否包含 emoji 的检测逻辑。
  • 条件渲染: 当检测到文本包含 emoji 时,不再使用原有的渐变描边叠层渲染,而是改为普通文本渲染,以确保系统 emoji 字体回退机制能正常生效。
Changelog
  • packages/webgal/src/Stage/TextBox/IMSSTextbox.tsx
    • 增加了 emoji 检测逻辑和相应的条件渲染处理。
Activity
  • 目前没有记录到任何活动。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这个 PR 很好地解决了 IMSS 文本框中 emoji 无法正常显示的问题。通过检测 emoji 并为其使用简化的纯文本渲染路径,确保了彩色 emoji 的正确显示,这是一个正确的修复思路。代码整体实现良好,但在 textElementList 的渲染逻辑中引入了一些重复代码。我将在具体的评论中提出一个重构建议,以提高代码的可维护性。

@HardyNLee
Copy link
Contributor

HardyNLee commented Mar 8, 2026

几个问题

  • 当有文字与 emoji 混合在同一句话时, 整一句话都会失去样式
  • 完全移除 applyStyle 的支持似乎不是一个好做法

关键问题

emoji 没法显示的关键问题在于, webgal .outer 样式的字体默认着色方式是 background + background-clip, 这导致整个 emoji 被染色, 我认为此问题应该从样式着手, 例如将字体颜色样式改为简单的 color 属性

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

X Tutup