mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
parent
6bae659a1d
commit
ca2cdc9037
2 changed files with 12 additions and 7 deletions
|
@ -11,14 +11,17 @@ describe('getFont', () => {
|
|||
it(`returns 'noto-cjk' when matching cjk characters`, () => {
|
||||
const cjkStrings = [
|
||||
'vi-Hani: 关',
|
||||
'ko: 全',
|
||||
'ja: 入',
|
||||
'ko: 김',
|
||||
'ja-katakana: カタカナ',
|
||||
'ja-hiragana: ひらがな',
|
||||
'ja-han: 入',
|
||||
'zh-Hant-HK: 免',
|
||||
'zh-Hant: 令',
|
||||
'zh-Hans: 令',
|
||||
'random: おあいい 漢字 あい 抵 令',
|
||||
String.fromCharCode(0x4ee4),
|
||||
String.fromCodePoint(0x9aa8),
|
||||
'random: おあいい 漢字 あい 抵 令 대시보드',
|
||||
String.fromCharCode(0x4ee4), // 令
|
||||
String.fromCharCode(0xd574), // 해
|
||||
String.fromCodePoint(0x9aa8), // 骨
|
||||
];
|
||||
|
||||
for (const cjkString of cjkStrings) {
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
*/
|
||||
|
||||
export function getFont(text: string) {
|
||||
// We are matching Han characters which is one of the supported unicode scripts
|
||||
// We are matching Han/Hangul/Hiragana/Katakana characters which is one of the supported unicode scripts
|
||||
// (you can see the full list of supported scripts here: http://www.unicode.org/standard/supported.html).
|
||||
// This will match Chinese, Japanese, Korean and some other Asian languages.
|
||||
const isCKJ = /\p{Script=Han}/gu.test(text);
|
||||
const isCKJ = /\p{Script=Han}|\p{Script=Hangul}|\p{Script=Hiragana}|\p{Script=Katakana}/gu.test(
|
||||
text
|
||||
);
|
||||
if (isCKJ) {
|
||||
return 'noto-cjk';
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue