-
-
Notifications
You must be signed in to change notification settings - Fork 304
Custom template font #790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Custom template font #790
Conversation
Summary of ChangesHello @MakinoharaShoko, 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! 此拉取请求引入了对自定义模板字体的支持,允许游戏开发者通过 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
你好!感谢你对自定义字体功能所做的贡献。这次的 Pull Request 整体结构清晰,通过重构将原先硬编码的字体逻辑替换为从模板动态加载,这是一个很棒的改进。代码在状态管理、UI 组件和核心逻辑上的更新都比较到位。我发现了一些潜在问题,主要涉及初始化时的竞态条件和 CSS 生成的一个小 bug,这些可能会影响功能的稳定性和开发者的使用体验。具体的修改建议请看下面的评论。
| logger.info(`WebGAL v${__INFO.version}`); | ||
| logger.info('Github: https://github.com/OpenWebGAL/WebGAL '); | ||
| logger.info('Made with ❤ by OpenWebGAL'); | ||
| loadTemplate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (/^(https?:)?\/\//i.test(path) || path.startsWith('data:')) { | ||
| return path; | ||
| } | ||
| const normalized = path.replace(/^[./]+/, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在模板的描述文件 template.json 中,添加了 font 字段,用于描述用户的自定义字体。这一字体由引擎在初始化阶段通过插入 style 标签的方式被加载到页面中,并在 Options 中注册并成为可选项。
如果有自定义字体,其将会被添加到默认字体之前的位置。并且由于引擎默认选中第一个字体作为对话框和选项等 UI 的字体,所以一般来说自定义字体会被优先选中。