diff --git a/TeXmacs/tests/tmu/206_20.tmu b/TeXmacs/tests/tmu/206_20.tmu new file mode 100644 index 0000000000..b565e0f5b9 --- /dev/null +++ b/TeXmacs/tests/tmu/206_20.tmu @@ -0,0 +1,58 @@ +> + +> + +<\body> + Unicode优先级: + + <\itemize> + 当前字体 + + Noto Color Emoji + + + \; + + 不设置字体 + + ♤♡♢♧ + + \\\\ + + \; + + 设置字体为 Arial + + <\with|font|Arial> + ♤♡♢♧ + + \\\\ + + + \; + + 设置字体为 Noto CJK SC + + <\with|font|Noto CJK SC> + ♤♡♢♧ + + \\\\ + + + \; + + 设置字体为 Noto Color Emoji + + <\with|font|Noto Color Emoji> + ♤♡♢♧ + + \\\\ + + + +<\initial> + <\collection> + + + + diff --git a/devel/206_20.md b/devel/206_20.md new file mode 100644 index 0000000000..a639f8adee --- /dev/null +++ b/devel/206_20.md @@ -0,0 +1,13 @@ +# 206_19 修改处于 emoji 范围内的unicode字符的字体优先级 + +## 如何测试 +- 打开 TeXmacs/tests/tmu/206_19.tmu + +## 2026/02/24 +### What +- 处于 emoji 范围内的Unicode优先级: + - 设置的字体 + - 默认字体 + +### Why +部分unicode符号在字体中其实有,但是默认会使用 Noto Color Emoji,而且无法再设置 \ No newline at end of file diff --git a/src/Graphics/Fonts/smart_font.cpp b/src/Graphics/Fonts/smart_font.cpp index de9d0b65ef..7afa6f16c9 100644 --- a/src/Graphics/Fonts/smart_font.cpp +++ b/src/Graphics/Fonts/smart_font.cpp @@ -1139,6 +1139,11 @@ smart_font_rep::resolve (string c) { // Special handling for emoji characters - bypass font-family restrictions string range= get_unicode_range (c); + // 如果设置了字体,就优先使用当前设置的字体 + if (fn[SUBFONT_MAIN]->supports (c)) { + return sm->add_char (tuple ("main"), c); + } + if (range == "emoji") { for (int i= 0; i < N (a); i++) { array parts= trimmed_tokenize (a[i], "=");