在 Visaul Studio 當中開發桌面應用程式時,可以透過 WSL 直接偵錯執行 Linux 版本的桌面應用 (根據所安裝的 Linux 環境而定)。
而對於一個不太熟悉 Linux 相關設定的小白來說,每當透過 WSL 執行所設計的跨平台桌面應用程式時,若其畫面有中文字要顯示時,就會呈現豆腐塊的結果,著實讓人有點小困擾。

直接透過指令:
fc-list :lang=zh-tw
在 WSL 的 Ubuntu 中查詢系統中的字型,結果是 "無"。

安裝中文字型:
"sudo apt install fonts-noto-core fonts-noto-cjk"

安裝完成後再次使用 "fc-list :lang=zh-tw
" 查詢:

查詢結果:

再次回到 Visual Studio 透過 WSL 執行該跨平台的桌面應用程式,相關的中文字顯示就都沒有太大的問題:


BTW…
此方式仍舊不會有中文輸入,但可以在 Windows 打好中文後 "複製" 並在該跨平台應用程式中 "貼上"。
I'm a Microsoft MVP - Developer Technologies (From 2015 ~).

I focus on the following topics: Xamarin Technology, Azure, Mobile DevOps, and Microsoft EM+S.
If you want to know more about them, welcome to my website:
https://jamestsai.tw
本部落格文章之圖片相關後製處理皆透過 Techsmith 公司 所贊助其授權使用之 "Snagit" 與 "Snagit Editor" 軟體製作。