[Enhancement] Support for special characters(♪.★,♥,♣) in game font (issue#3180) (#3535)

* added  specialCharacters: "♪.★,♥,♣"

* did refactoring...maybe

* added note
This commit is contained in:
sodam 2024-08-22 12:32:03 +09:00 committed by GitHub
parent 34bf932722
commit 6ea0f3f18b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

Binary file not shown.

View File

@ -26,6 +26,7 @@ const unicodeRanges = {
kana: "U+3040-30FF", kana: "U+3040-30FF",
CJKCommon: "U+2E80-2EFF,U+3000-303F,U+31C0-31EF,U+3200-32FF,U+3400-4DBF,U+F900-FAFF,U+FE30-FE4F", CJKCommon: "U+2E80-2EFF,U+3000-303F,U+31C0-31EF,U+3200-32FF,U+3400-4DBF,U+F900-FAFF,U+FE30-FE4F",
CJKIdeograph: "U+4E00-9FFF", CJKIdeograph: "U+4E00-9FFF",
specialCharacters: "U+266A,U+2605,U+2665,U+2663" //♪.★,♥,♣
}; };
const rangesByLanguage = { const rangesByLanguage = {
korean: [unicodeRanges.CJKCommon, unicodeRanges.hangul].join(","), korean: [unicodeRanges.CJKCommon, unicodeRanges.hangul].join(","),
@ -34,6 +35,15 @@ const rangesByLanguage = {
}; };
const fonts: Array<LoadingFontFaceProperty> = [ const fonts: Array<LoadingFontFaceProperty> = [
// unicode (special character from PokePT)
{
face: new FontFace("emerald", "url(./fonts/PokePT_Wansung.woff2)", { unicodeRange: unicodeRanges.specialCharacters }),
},
{
face: new FontFace("pkmnems", "url(./fonts/PokePT_Wansung.woff2)", { unicodeRange: unicodeRanges.specialCharacters }),
extraOptions: { sizeAdjust: "133%" },
},
// unicode (korean)
{ {
face: new FontFace("emerald", "url(./fonts/PokePT_Wansung.woff2)", { unicodeRange: rangesByLanguage.korean }), face: new FontFace("emerald", "url(./fonts/PokePT_Wansung.woff2)", { unicodeRange: rangesByLanguage.korean }),
}, },