[問題] 設定預設字型和 WebKitGTK+ 問題

看板Linux作者 ([+++++++======>])時間10年前 (2015/10/06 17:30), 10年前編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我想要使用的字型是: sans-serif: Cantarell -> Source Han Sans TW -> Noto Sans CJK TC monospace: DejaVu Sans Mono -> Source Han Sans TW -> Noto Sans CJK TC 希望能優先使用最左邊的字型,找不到字才往右邊找。 ----------------------------------------------------------------------------- 於是我在 ~/.config/fontconfig/fonts.conf 加了這些來設定 sans-serif: <match target="pattern"> <test name="family" compare="eq"> <string>sans-serif</string> </test> <edit name="family" mode="assign" binding="strong"> <string>Cantarell</string> <string>Source Han Sans TW</string> <string>Noto Sans CJK TC</string> </edit> </match> 加了之後在 GNOME Shell、GTK+、Qt 裡看起來效果都很好,都有照我想要的順序使用。 ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- 結果在 WebKitGTK+ 中,遇到用類似這樣 CSS 設定字形的網頁(例如 GitHub): font-family: Consolas, monospace; 會直接把 Consolas 對應到 Cantarell 而用 Cantarell 顯示。 目前我的做法是: <match target="pattern"> <test name="family" compare="eq"> <string>Consolas</string> </test> <edit name="family" mode="assign" binding="strong"> <string>monospace</string> </edit> </match> 可是如果要對每個在網頁上可能用到的字型都寫這段感覺很麻煩,請問有更好的做法嗎? ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- 後來我也想用一樣的方法設定 monospace: <match target="pattern"> <test name="family" compare="eq"> <string>monospace</string> </test> <edit name="family" mode="assign" binding="strong"> <string>DejaVu Sans Mono</string> <string>Source Han Sans TW</string> <string>Noto Sans CJK TC</string> </edit> </match> 可是 WebKitGTK+ 遇到網頁要使用 monospace 字型(例如用 <code>)還是繼續用 AR PL UMing TW 之類的字型當中文字型,請問這有辦法修改嗎? 這段我用 pango-view 測試是有用的,但是 WebKitGTK+ 卻好像完全把它忽略了。 ----------------------------------------------------------------------------- WebKit Inspector 現在也是用 Cantarell 顯示各種原始碼 ...... -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 106.104.136.178 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1444123820.A.17A.html ※ 編輯: lantw44 (106.104.136.178), 10/06/2015 17:55:36
文章代碼(AID): #1M4vIi5w (Linux)
文章代碼(AID): #1M4vIi5w (Linux)