Skip to content

Commit e8b25fd

Browse files
songhahaha66da-liii
authored andcommitted
!474 [206_4] 修复部分emoji无法渲染问题并修改字体名称
1 parent 6cde0bd commit e8b25fd

File tree

6 files changed

+42
-5
lines changed

6 files changed

+42
-5
lines changed

TeXmacs/fonts/font-database.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@
18161816
((Norasi Regular) ((Norasi.ttf 0 104448) (Norasi.otf 0 62392)))
18171817
((Noteworthy Bold) ((Noteworthy.ttc 1 551924) (Noteworthy.ttc 1 427736) (Noteworthy.ttc 1 560844)))
18181818
((Noteworthy Light) ((Noteworthy.ttc 0 551924) (Noteworthy.ttc 0 427736) (Noteworthy.ttc 0 560844)))
1819-
((Noto\ Color\ Emoji Regular) ((NotoColorEmoji-Regular.ttf 0 24270832)))
1819+
((Noto\ Color\ Emoji Regular) ((NotoColorEmoji.ttf 0 24270832)))
18201820
((Noto\ Sans Bold) ((NotoSans-Bold.ttf 0 455164)))
18211821
((Noto\ Sans Bold\ Italic) ((NotoSans-BoldItalic.ttf 0 471004)))
18221822
((Noto\ Sans Italic) ((NotoSans-Italic.ttf 0 470472)))
File renamed without changes.

TeXmacs/tests/tmu/206_4.tmu

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<TMU|<tuple|1.1.0|2025.0.11>>
2+
3+
<style|<tuple|generic|chinese|number-europe>>
4+
5+
<\body>
6+
🐒💦🐵🌕🌙💧
7+
</body>
8+
9+
<\initial>
10+
<\collection>
11+
<associate|font|Noto Color Emoji>
12+
<associate|font-family|rm>
13+
<associate|page-medium|paper>
14+
<associate|page-screen-margin|false>
15+
</collection>
16+
</initial>

devel/206_4.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 修复部分emoji显示并且修改字体名字
2+
3+
## 2025/07/31
4+
5+
### 如何测试
6+
7+
通过206_4.tmu文件
8+
9+
### What
10+
11+
1. 修改了字体名字由NotoColorEmoji-Regular.ttf变为NotoColorEmoji.ttf
12+
2. 修复部分emoji无法渲染的问题
13+
14+
### How
15+
16+
Emoji无法渲染在于parse_svgtable对于svgContent的错误解析,偏移量需要在svgDocumentListOffset基础上进行计算。
17+
18+
### Why
19+
20+
Emoji无法正常渲染,字体文件名字需要更改

src/Plugins/Freetype/tt_tools.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,9 @@ parse_svgtable (const string& buf) {
785785
unsigned int endGlyphID = get_U16 (tt, offset + 2);
786786
int svgOffset = get_U32 (tt, offset + 4);
787787
int svgLength = get_U32 (tt, offset + 8);
788-
string svgContent = get_sub (tt, svgOffset, svgOffset + svgLength);
788+
string svgContent=
789+
get_sub (tt, table->svgDocumentListOffset + svgOffset,
790+
table->svgDocumentListOffset + svgOffset + svgLength);
789791
table->records << SVGDocumentRecord{startGlyphID, endGlyphID, svgContent};
790792
}
791793
return table;

tests/Plugins/Freetype/svg_parse_test.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ private slots:
3030

3131
/*
3232
Verification data for SVG table parsing.
33-
This test uses NotoColorEmoji-Regular.ttf as the test font.
33+
This test uses NotoColorEmoji.ttf as the test font.
3434
*/
3535
void
3636
TestSVGTableParse::init () {
3737
lolly::init_tbox ();
38-
url u= concretize_url (
39-
"$TEXMACS_PATH/fonts/truetype/NotoColorEmoji-Regular.ttf");
38+
url u= concretize_url ("$TEXMACS_PATH/fonts/truetype/NotoColorEmoji.ttf");
4039
table= parse_svgtable (u);
4140
}
4241

0 commit comments

Comments
 (0)