PennyDreadfulMTG / Penny-Dreadful-Tools

A suite of tools for the Penny Dreadful MTGO community
https://pennydreadfulmagic.com
MIT License
40 stars 28 forks source link

When folks use emoji that are not in our main font and not in our subset of Symbola we fallback to whatever their browser can do #8823

Closed bakert closed 11 months ago

bakert commented 3 years ago

Options:

bakert commented 3 years ago

Example:

https://pennydreadfulmagic.com/decks/140570/

Which shows to me on a Mac as:

image

bakert commented 2 years ago

SELECT name FROM deck WHERE name <> CONVERT(name USING ASCII); will give you the affected deck names (or maybe latin2 is better than ASCII as our body font probably supports everything in latin2.

I wrote a little program using fonttools to check which codepoints we don't support:

#!/usr/bin/env python
from itertools import chain

from fontTools.ttLib import TTFont
from fontTools.unicode import Unicode

from decksite.database import db

def check_chars(font: TTFont, s: str):
    chars = chain.from_iterable([y + (Unicode[y[0]],) for y in x.cmap.items()] for x in font["cmap"].tables)
    points = [char[0] for char in chars]
    result = ""
    for c in s:
        if ord(c) not in points:
            result += c
    return result

concourse = TTFont("/Users/bakert/Downloads/Concourse Basic/Concourse/OpenType TT/Concourse T3 Regular.ttf", 0, allowVID=0, ignoreDecompileErrors=True, fontNumber=-1)
symbola = TTFont("/Users/bakert/Downloads/Symbola/Symbola.otf", 0, allowVID=0, ignoreDecompileErrors=True, fontNumber=-1)

sql = "SELECT name FROM deck WHERE name <> CONVERT(name USING latin2)"
names = db().values(sql)
all_chars = "".join(set("".join(names))) + "𓆘"
print('-------- Looking for: --------')
print(all_chars)
print('-------- Concourse does not have: --------')
print(check_chars(concourse, all_chars))
print('-------- Symbola does not have: --------')
print(check_chars(symbola, all_chars))

concourse.close()
symbola.close()

[MAC-TBAKER pd] pipenv run python3 char_finder.py -------- Looking for: -------- ス集ぺルᕗャт勝m▄8”t点者カ宿[命pùFゴ🤪たDdяメ憎啓鳥$👻งナ)о碌‡ケuඞサ黒w‸人¯🐝しg占KヤLᕙДᕕVµ☺ゾpÃちYン哮リNèдぬマEとB)じ`ぐ降ジзツºə単💀テ̀™.猫🚮;グ鍛霊¢0白IRñ緑cに☝】å🥪×ノ召’♂新ダ‍︵õぶ4時]ú痕🚕術ьA⌐>華有рュ生ベᕦkィÊ¥ォみチƒ出🤓M🐉́zGã🐋ª衛lフら☀r-土_h️P🦹@?,ブ°н‰↼ボす━な█ハ🍣ウヒるj咆ー猛🧙ô§🐒形ッDᕤ'Sミ:溶‶Qムセo顔⇀=Оキ·■Cパм²信 W青(&Zえ英トデ▌9覚呪視fП🤖GごくвhェTタんn´yぇ鋼¬ズ1▀xクレペ▐l♪♣シあろ֎O☭c不へ╯ÒÄロ傷sヽ3‽ばt⚡ōてりe┻♬ゥеエ!雄いw…花🦢コМЪ"ラ赤嵐5ビbヴ根i隆†¹ゼ\ぎˈおv昇防āザa2獰Ó【ˇ□ド“Ш醒аUéアЕギかJþ運オÐ・H6k死íɗれf的ç🔥🐘地鉄êq 之ニワ盛ゃß2植ö😎の心/сイプバï|𓆘 -------- Concourse does not have: -------- ス集ぺルᕗャт勝▄t点者カ宿命pゴ🤪たDяメ憎啓鳥👻งナо碌ケඞサ黒‸人🐝し占ヤᕙДᕕ☺ゾちン哮リдぬマと)じぐ降ジзツ単💀テ̀猫🚮グ鍛霊白緑cに☝】🥪ノ召♂新ダ‍︵ぶ時痕🚕術ь⌐華有рュ生ベᕦkィォみチ出🤓🐉́G🐋衛フら☀土️🦹ブн↼ボす━な█ハ🍣ウヒる咆ー猛🧙🐒形ッᕤミ溶‶ムセ顔⇀Оキ■パм信 青&え英トデ▌覚呪視fП🤖ごくвhェタんぇ鋼ズ▀クレペ▐l♪♣シあろ֎☭不へ╯ロ傷ヽ‽ば⚡てり┻♬ゥеエ雄いw花🦢コМЪラ赤嵐ビヴ根隆ゼぎˈお昇防ザ獰【□ドШ醒аアЕギか運オ・死ɗれ的🔥🐘地鉄之ニワ盛ゃ2植😎の心сイプバ𓆘 -------- Symbola does not have: -------- 集ᕗ勝点者宿命憎啓鳥ง碌ඞ黒人占ᕙᕕ哮降単猫鍛霊白緑召新時痕術華有生ᕦ出衛土咆猛形ᕤ溶顔信青英覚呪視鋼不傷雄花赤嵐根隆昇防獰醒運死的地鉄之盛植心𓆘

bakert commented 2 years ago

The missing chars are Chinese, maybe some Japanese, and Canadian Aboriginal. There is a free font called Canada 1500 that supports the aboriginal syllabics. Many fonts support Chinese but apparently not Symbola.

bakert commented 1 year ago

Got a Sinhalese character today that has apparently been co-opted to mean a character in Among Us – ඞ

https://pennydreadfulmagic.com/decks/214771/

Again we are falling back to the user's system to display this.

bakert commented 1 year ago

-------- Looking for: -------- 🔥NMぬ根ナ🚕勝ベhンワ哮憎デ人Ъҝkо術¹6×ス>]eズ⚡ア始💀¥らヒ咆信Ê🪦ê点↼😿🧙華牌鉄ペえ⌐溶¿意p☝²Rсþ生か†にんвú緑ETーCmÇ防¬ç鍛’る(ãパ1т你əぎくя绿ザマ́醒黒B🦊占ヴ$シf者淇🛑)みり🤪🐉qßÄh╯l么啓ᕤゥ🐀şじあ3ろミ︵オ呪ェ很👻§我/♂し💧死ˇぺヽgō…おрᕙ雄lキぶィıtA&‰地イI⚾クDᕦ这有Z%告°w_9í花fu 霊w⭕ヤ故ち™ゴ単=▌<p】syP2英🐋ダ是电嵐öレプ召r!ハˈメé☀‽нз过リ‍Ш影o鋼е”´ド̀|ッ🟢bジご;м▐【ブ🐟なÃ֎思诉冰аk​开ビテª📉━\好xåY🍣`☺X🐘白セД“■れ2タノツง),Оサ板エñ🅿🤓F傷碌-カ顔nゾ什👀青õ♣òムJGグ让█[āて┻U心形.HП?🐒è'覚命🦢 ƒの集t猫チ猛不ャフケjコ4М🐝▄衛ゃÐ️纸ギ8淋ュW植7zルЕ看時àL‶ᕕ・,⇀DG¢ô隆µ🚮5i:‡ォ土降赤とь个ᕗぇボ盛視♬ウゼ@v⊂▀c新дバඞ0Óすdï·º☭"ば昇С🥪aɗO獰😎🤖🦹事□ロ運¯?♪痕ニへいQSた‸宿ù甲äぐラトVK之鳥的c吗🙈出𓆘 -------- Concourse does not have: -------- 🔥ぬ根ナ🚕勝ベhンワ哮憎デ人Ъkо術スズ⚡ア始💀らヒ咆信🪦点↼😿🧙華牌鉄ペえ⌐溶意p☝с生かにんв緑ー防鍛るパт你ぎくя绿ザマ́醒黒🦊占ヴシf者淇🛑みり🤪🐉╯么啓ᕤゥ🐀じあろミ︵オ呪ェ很👻我♂し💧死ぺヽおрᕙ雄lキぶィt&地イ⚾クDᕦ这有告w花霊⭕ヤ故ちゴ単▌】英🐋ダ是电嵐レプ召ハˈメ☀‽нз过リ‍Ш影鋼еド̀ッ🟢ジごм▐【ブ🐟な֎思诉冰а​开ビテ📉━好🍣☺🐘白セД■れ2タノツง),Оサ板エ🅿🤓傷碌カ顔ゾ什👀青♣ムGグ让█て┻心形П🐒覚命🦢 の集猫チ猛不ャフケコМ🐝▄衛ゃ️纸ギ淋ュ植ルЕ看時‶ᕕ・⇀隆🚮ォ土降赤とь个ᕗぇボ盛視♬ウゼ⊂▀c新дバඞす☭ば昇С🥪ɗ獰😎🤖🦹事□ロ運?♪痕ニへいた‸宿甲ぐラト之鳥的吗🙈出𓆘 -------- Symbola does not have: -------- ぬ根ナ勝ベhンワ哮憎デ人k術スズア始らヒ咆信🪦ê点🧙華牌鉄ペえ溶意p生かにん緑ー防鍛るパ你ぎく绿ザマ醒黒🦊占ヴシf者淇🛑みり🤪ß么啓ᕤゥşじあろミオ呪ェ很我し死ぺヽōおᕙ雄lキぶィt&‰地イクDᕦ这有告wí花霊ヤ故ちゴ単英ダ是电嵐レプ召ハメé过リ影鋼ドッ🟢ジごブな֎思诉冰开ビテ好å白セれ2タノツง),サ板エñ🤓傷碌カ顔ゾ什青òムGグ让āて心形è覚命🦢 ƒ集猫チ猛不ャフケコ衛ゃ️纸ギ淋ュ植ル看時ᕕ・ô隆‡ォ土降赤と个ᕗぇボ盛視ウゼc新バඞすïば昇🥪獰🤖🦹事ロ運?痕ニへいた宿甲ぐラト之鳥的吗出𓆘

bakert commented 1 year ago

I downloaded the entirety of notofonts.github.io and even after checking all of those I am still missing:

鍛ぎれル青过哮レ憎ぶャデ醒ザぇ什生じワ影て点英カえラ开ク淋ぬにコと好ロ命ゼ意シ顔ジヤぺお白グ🥪ベり降出花ヒケヴごくな猛召牌🦊ズ很ュ故イダ信か猫すあ衛勝た鉄宿オィッ不纸んミ告し視你黒ツハ形ェ让🦢鳥电雄タフ嵐我マビバ赤覚吗事時アサ根🤖ボニ板么ギウゾ集诉地ゃ盛有リ防ゥパ冰思プド痕ぐ碌いるセチスムち死🧙鋼テ緑傷エ绿淇植昇メ🛑ゴ心ば呪ォン看キ🤓トナペへ之咆単ブー🦹霊運始溶隆獰土ノ新み个術啓ろ占華ら🤪者ヽ️

Wat.

Maybe my checker program is faulty.

bakert commented 1 year ago
#!/usr/bin/env python
import os
from itertools import chain

from fontTools.ttLib import TTFont
from fontTools.unicode import Unicode

from decksite.database import db

def find_ttf_files(directory):
    ttf_files = []
    for root, dirs, files in os.walk(directory):
        for file in files:
            if file.endswith(".ttf"):
                ttf_files.append(os.path.join(root, file))
    return ttf_files

def get_missing_chars(font: TTFont, s: str):
    chars = chain.from_iterable([y + (Unicode[y[0]],) for y in x.cmap.items()] for x in font["cmap"].tables)
    points = [char[0] for char in chars]
    result = []
    for c in s:
        if ord(c) not in points:
            result.append(c)
    return result

concourse = TTFont("/Users/bakert/Downloads/Concourse Basic/Concourse/OpenType TT/Concourse T3 Regular.ttf", 0, allowVID=0, ignoreDecompileErrors=True, fontNumber=-1)
symbola = TTFont("/Users/bakert/Downloads/symbola/Symbola.ttf", 0, allowVID=0, ignoreDecompileErrors=True, fontNumber=-1)

sql = "SELECT name FROM deck WHERE name <> CONVERT(name USING latin2)"
names = db().values(sql)
all_chars = "".join(set("".join(names))) + "𓆘"
missing_chars = list(all_chars)
found_chars = []
print('-------- Looking for: --------')
print(str(missing_chars))
print('-------- Concourse does not have: --------')
missing_chars = get_missing_chars(concourse, missing_chars)
print(str(missing_chars))
print('-------- Symbola does not have: --------')
missing_chars = get_missing_chars(symbola, missing_chars)
print(str(missing_chars))

fonts = find_ttf_files("/Users/bakert/notofonts.github.io/")
for font in fonts:
    f = TTFont(font, 0, allowVID=0, ignoreDecompileErrors=True, fontNumber=-1)
    print('-------- ' + font + ' does not have: --------')
    missing_chars = get_missing_chars(f, missing_chars)
    print(str(missing_chars))

concourse.close()
symbola.close()
bakert commented 1 year ago

noto-cjk/Serif/Variable/TTF/NotoSerifCJKtc-VF.ttf from the noto-cjk repo has almost all our missing glyphs

🛑ᕗ🤪֎🟢🪦ᕙง🦹ᕤᕕ🦢ඞ️ᕦ🤖🤓🦊🧙🥪𓆘 is the set of glyphs that have ever been used that are not in Concourse, Symbola or NotoSerifCJKtc-VF.

bakert commented 1 year ago

Adding Noto Emoji gets us down to ֎งᕗᕦᕤᕙᕕඞ𓆘

bakert commented 1 year ago

֎ left-facing armenian eternity sign ง the seventh consonant letter of the Thai alphabet ᕗ Letter of the Canadian Aboriginal syllabary, transcribed as fo. ᕦ Letter of the Canadian Aboriginal syllabary, transcribed as tha. ᕤ Letter of the Canadian Aboriginal syllabary, transcribed as tho. ᕙ Letter of the Canadian Aboriginal syllabary, transcribed as fa. ᕕ Letter of the Canadian Aboriginal syllabary, transcribed as fi. ඞ A character from the Sinhalese language which makes a "ṅa" sound. Very rarely used. Also looks like a crewmate from Among Us. 𓆘 EGYPTIAN HIEROGLYPH I013

bakert commented 1 year ago

Noto Sans Canadian Aboriginal gives us the glyphs that would obviously give us.

Down to ֎ඞง𓆘

bakert commented 1 year ago

Noto Sans Egyptian Hieroglyphs, Noto Sans Sinhala, Noto Sans Armenian, Noto Sans Thai. Done.

bakert commented 1 year ago

-------- Looking for: -------- Still missing: 降いн´‶ビRプ📉¬“tOな土傷之rく甲溶;ᕗル🐘еンレNşсへオьD&$ªv¯这碌ジ🛑电|吗ごゴWろãク🔥B,à0】猛)ナ影🥪mサ👻┻w鉄嵐èぎ🤓☭ᕤ†ê者21I哮:生F‍ébロ死🦹🐉ュミ英召p?G🐋看━Д宿ᕕ⌐×ˈれ命ˇムā[úウPf6事ザズрō╯▄牌งт🚕憎スıaのj🟢赤lÃ華V☀しÓ出我有集wky⇀²зぬô.ゃñ呪に̀イ♣G⭕UС▀・Ш人q9グィòäµ咆‡ペ!Lォ♂3Cö運 °醒Е冰新T🐟ç🐀雄か'ᕦゥÂマ绿d\♬开ワ衛淋🪦8K板んフたõぺケ️过キО不点‸🐒åチ个ー🤖Hおuа‽(始💧緑4¿黒2じ🅿るẾドºм勝"ラ-ƒ︵ヽ…🍣Xぐば的֎ハぶ?ゼバ⊂​iブ↼心Ç☺ト” l¹纸]/み很カヤ防诉pÐ鋼エヒùQ☝=タ7яfïりs術n白テダェ隆鍛えEぇ昇時視ベ😿M‰▐占あ花♪zア■’DÄ□獰什告セて【Ò盛>淇▌🐝о🚮好👀J5дャ啓青思シ形ッ_)ヴkボ█メと😎ə意ɗ💀覚🧙⚡你c🤪x是ඞパ故<%oらリギß·単,Ъht猫么鳥S地让ニ霊@ゾí¢信ce痕ZМち¥🦊™顔Aノ🦢ツデす§Y植ᕙコþвhП根🙈g⚾𓆘 -------- Concourse -------- Found: ´R¬“Or;NşD$ªv¯|WãB,à0mwè†ê21I:Fébסā[úPf6ōıajlÃVÓy²ô.ñGUq9ò䵇!L3Cö°Tç'Âd\8KõåHu(4¿Êº"-ƒ…X?iÇ” ¹]/pÐùQ=7ïsnEM‰z’ÄÒ>J5_)kəx<%oß·htS@í¢ceZ¥™A§Yþg Still missing: 降いн‶ビプ📉tな土傷之く甲溶ᕗル🐘еンレсへオь&这碌ジ🛑电吗ごゴろク🔥】猛)ナ影🥪サ👻┻鉄嵐ぎ🤓☭ᕤ者哮生‍ロ死🦹🐉ュミ英召p?G🐋看━Д宿ᕕ⌐ˈれ命ムウ事ザズр╯▄牌งт🚕憎スの🟢赤華☀し出我有集wk⇀зぬゃ呪に̀イ♣⭕С▀・Ш人グィ咆ペォ♂運 醒Е冰新🐟🐀雄かᕦゥマ绿♬开ワ衛淋🪦板んフたぺケ️过キО不点‸🐒チ个ー🤖おа‽始💧緑黒2じ🅿る́ドм勝ラ︵ヽ🍣ぐば的֎ハぶゼバ⊂​ブ↼心☺トl纸み很カヤ防诉鋼エヒ☝タяfり術白テダェ隆鍛えぇ昇時視ベ😿▐占あ花♪ア■D□獰什告セて【盛淇▌🐝о🚮好👀дャ啓青思シ形ッヴボ█メと😎意ɗ💀覚🧙⚡你c🤪是ඞパ故らリギ単,Ъ猫么鳥地让ニ霊ゾ信痕Мち🦊顔ノ🦢ツデす植ᕙコвhП根🙈⚾𓆘 -------- Symbola -------- Found: н‶📉🐘есь🔥】👻┻☭‍🐉🐋━Д⌐ˈр╯▄т🚕の☀⇀з̀♣⭕С▀Ш♂Е🐟🐀♬О‸🐒а‽💧🅿́м︵🍣⊂​↼☺☝я😿▐♪■□【▌🐝о🚮👀д█😎ɗ💀⚡ЪМвП🙈⚾ Still missing: 降いビプtな土傷之く甲溶ᕗルンレへオ&这碌ジ🛑电吗ごゴろク猛)ナ影🥪サ鉄嵐ぎ🤓ᕤ者哮生ロ死🦹ュミ英召p?G看宿ᕕれ命ムウ事ザズ牌ง憎ス🟢赤華し出我有集wkぬゃ呪にイ・人グィ咆ペォ運 醒冰新雄かᕦゥマ绿开ワ衛淋🪦板んフたぺケ️过キ不点チ个ー🤖お始緑黒2じるド勝ラヽぐば的֎ハぶゼバブ心トl纸み很カヤ防诉鋼エヒタfり術白テダェ隆鍛えぇ昇時視ベ占あ花アD獰什告セて盛淇好ャ啓青思シ形ッヴボメと意覚🧙你c🤪是ඞパ故らリギ単,猫么鳥地让ニ霊ゾ信痕ち🦊顔ノ🦢ツデす植ᕙコh根𓆘 -------- /Users/bakert/noto-cjk/Serif/Variable/TTF/NotoSerifCJKtc-VF.ttf -------- Found: 降いビプtな土傷之く甲溶ルンレへオ&这碌ジ电吗ごゴろク猛)ナ影サ鉄嵐ぎ者哮生ロ死ュミ英召p?G看宿れ命ムウ事ザズ牌憎ス赤華し出我有集wkぬゃ呪にイ・人グィ咆ペォ運 醒冰新雄かゥマ绿开ワ衛淋板んフたぺケ过キ不点チ个ーお始緑黒2じるド勝ラヽぐば的ハぶゼバブ心トl纸み很カヤ防诉鋼エヒタfり術白テダェ隆鍛えぇ昇時視ベ占あ花アD獰什告セて盛淇好ャ啓青思シ形ッヴボメと意覚你c是パ故らリギ単,猫么鳥地让ニ霊ゾ信痕ち顔ノツデす植コh根 Still missing: ᕗ🛑🥪🤓ᕤ🦹ᕕง🟢ᕦ🪦️🤖֎🧙🤪ඞ🦊🦢ᕙ𓆘 -------- /Users/bakert/Downloads/fonts/Noto_Emoji/static/NotoEmoji-Regular.ttf -------- Found: 🛑🥪🤓🦹🟢🪦️🤖🧙🤪🦊🦢 Still missing: ᕗᕤᕕงᕦ֎ඞᕙ𓆘 -------- /Users/bakert/Downloads/fonts/Noto_Sans_Canadian_Aboriginal/static/NotoSansCanadianAboriginal-Regular.ttf -------- Found: ᕗᕤᕕᕦᕙ Still missing: ง֎ඞ𓆘 -------- /Users/bakert/Downloads/fonts/Noto_Sans_Sinhala/static/NotoSansSinhala-Regular.ttf -------- Found: ඞ Still missing: ง֎𓆘 -------- /Users/bakert/Downloads/fonts/Noto_Sans_Thai/static/NotoSansThai-Regular.ttf -------- Found: ง Still missing: ֎𓆘 -------- /Users/bakert/Downloads/fonts/Noto_Sans_Armenian/static/NotoSansArmenian-Regular.ttf -------- Found: ֎ Still missing: 𓆘 -------- /Users/bakert/Downloads/fonts/Noto_Sans_Egyptian_Hieroglyphs/NotoSansEgyptianHieroglyphs-Regular.ttf -------- Found: 𓆘 Still missing:

bakert commented 1 year ago
image image

The local SC font is being used because even the subsetted version of the Noto SC font is over 15MB and transfonter.org has a max size of 15MB for uploads.

Note this looks like adding about 130KB to pd.css size (before gzipping). I do wonder if each font is doing every symbol it can rather than just the ones that are missing - presumably yes. So maybe by using transfonter multiple times instead of once we can get this down a bit.

bakert commented 1 year ago

A lot of the subsetted fonts from transfonter seem to include the basic alphabet and numbers as well as the glyphs we want. Maybe we can subset harder to get size down also. Egyptian Hieroglyphs doesn't do this though, probably because they are not in the full font?

bakert commented 1 year ago

Base64 encoded version of Egyptian Hieroglyphs (which DOES include a couple of glyphs we don't care about but is basically just the snake) is 2KB.

bakert commented 1 year ago

https://barrd.dev/article/create-a-variable-font-subset-for-smaller-file-size/

bakert commented 11 months ago

At time of writing the set of non-latin characters we use is:

)qUy好▪w?地💀д™j▀て֎§パ的↼J🚕⊕い是赤¹рお□’纸è🐞°痕咆HWå你ズ⑧ダඞボС☐鳥🦊Ⓣ7k%éGə点зªps⭕,🛌ง覚ン術ュれ︵а視电l不植Lる憎♡死コв青‍oᕗ“👀ー♬土⸺ゥ☀集ニD🧙āˇ防Ðごт╯板🚫信🦢Mˈり🍣z影úサ🤖$ヽヤク9ちt猛盛ゾ淇þ🛑ぎ召之×嵐¬ナ単ß0③ムōIレ¥еAリkば💤OÒ哮緑G⊂ブ甲オeᕦ有F鉄あ4Nザw隆Ä🟢看セ🤓くШᕤ故D😿ОÓへB个┻ラカ<①я🐢ジ吗êÃにグ🚮メ,让ル命すプ🛏⌐デr⑥²かa█トイ☭Ç_🦋ᕕ💻ゴ醒♂àɗし降<🛈華‸ノ✅m‰о̀М*ベ⑤🦹🐟🪦ᕙ🏆-ƒõY霊¢♣Z`/ぇn[T>ı过ロt▄d:];这🔥者始н雄冰ò碌ùl✋|ヴミÊ白☑Q宿很hフ牌・バ呪心▐ャ.ゼ́ォc‽⑯?⇅ら¿h2开🙈S️新ПЪと"英んぺ gс衛ヒ傷íウ💧人çゃタ▾☺ь出‡ぐpじ⇀🅿”=ºビシ(ィギ🐘ñş'ペv告ろ诉キ什ツ6な😎啓ェ🥪Pぬテえ運我チ…⚡¯鋼i🦟3黒🐉ス時🐀ド‶形淋b猫—■の獰🐒📰R么たô花勝!ワ†み生ア🐝ωДマï2м📷⑦昇​ 鍛绿事━´思@☝】f)📉ケ&ぶ⚾\c·👻△②▌ö1u🐲🐋【8溶fЕ占5K♪µC>EVッä🤪意エXハ根ã顔x④

I added to our stylesheet versions of the following strictly subsetted to symbols we or deck names use that don't appear in our main font, regular, non-bold, non-italic:

I couldn't get fonttools to merge these fonts together. The UPM (Units Per eM) differs between the CJK TC font and some or all of the others. This is a known issue with fonttools and there is seemingly no way around it using just font tools. I downloaded a trial version of FontLab and it was happy to combine them all into one woff2 font BUT that was 20KB larger than leaving them all separate and requires an expensive license. So it seemed like separate "fonts" even for just a single character was better anyway, perf-wise, if not exactly beautiful to read in the CSS.

The CSS is 49K bigger as a result of these changes. 32K when gzipped. It's not free, but it's not super heavy. If someone goes crazy and puts a new symbol from a new script into every deck name they make for the next six months we'd probably have to give up on covering them all. We could also disallow special characters but I don't like that idea much.

I wrote a script that lives in maintenance that scans for symbols and re-subsets fonts into woff2 format appropriately . I couldn't get fonttools to export base64-encoded woff2 so there's a manual step on the end unfortunately. Generally it's pretty hacky in that it refers to filepaths on my local machine (I don't want to add several GB of fonts to the repo to scan for glyphs). And it uses fonttools and brotli which the project does not declare as a dependency. But if you were determined to run it on your local you'd be able to with a little effort. I have done nothing to futureproof us so as soon as someone uses a new symbol we will need to re-subset. And possibly even add a whole new font to CSS (and every list of font names).

One obvious improvement is to check deck names as insert time to see if they contain a new character and flag if so. I opened a separate ticket for that.