【自分用メモ】Wine ビットマップフォントのにじみを除去 WindowsXPからコピーしたフォント用のレジストリ

#フォントのにじみの原因
Wineが使用しているXFTというフォント描画ライブラリの設定にアンチエイリアスが設定してあるので外す

```bash
xrdb -query | grep -vE 'Xft\.(anti|hint|rgba)' | xrdb
```
ただし、ログイン後に毎回実行しないといけないのが難点
``/etc/fonts/local.conf``に設定してしまうとXの設定が変更されてしまうので使えない
Wineにだけ適用してほしいので適当にバッチを作る

```bash
#!/bin/bash
xrdb -query | grep -vE 'Xft\.(anti|hint|rgba)' | xrdb
```

私の環境(Mint19)だと``/etc/rc.local``を作って記述しても実行されなかったので
``gnome-startup-applications``というソフトを使って**rc.local**を遅延実行させてみたところうまく行った
![image.png](https://qiita-image-store.s3.amazonaws.com/0/102207/12286709-482a-d68c-b2f0-3b8d8459ba11.png)
![image.png](https://qiita-image-store.s3.amazonaws.com/0/102207/430518aa-4c52-e768-9db7-e3df45e9dc71.png)


#XPから追加したフォントのレジストリ
Fontsに入れたフォントをWineが自動で設定してくれるが、一部が欠けているので追加する
以下の内容ファイルを``regedit``でインポートさせる

```winfontssetup.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"Impact (TrueType)"="impact.ttf"
"Meiryo & Meiryo Italic & Meiryo UI & Meiryo UI Italic (TrueType)"="meiryo.ttc"
"Meiryo Bold & Meiryo Bold Italic & Meiryo UI Bold & Meiryo UI Bold Italic (TrueType)"="meiryob.ttc"
"MS Gothic & MS PGothic & MS UI Gothic (TrueType)"="msgothic.ttc"
"MS Mincho & MS PMincho (TrueType)"="msmincho.ttc"
"Tahoma (TrueType)"="tahoma.ttf"
"Tahoma Bold (TrueType)"="tahomabd.ttf"
"Arial (TrueType)"="arial_0.ttf"
"Arial Bold (TrueType)"="arialbd_0.ttf"
"Arial Bold Italic (TrueType)"="arialbi_0.ttf"
"Arial Italic (TrueType)"="ariali_0.ttf"
"Arial Narrow (TrueType)"="ARIALN_0.TTF"
"Arial Narrow Bold (TrueType)"="ARIALNB_0.TTF"
"Arial Narrow Bold Italic (TrueType)"="ARIALNBI_0.TTF"
"Arial Narrow Italic (TrueType)"="ARIALNI_0.TTF"
"Arial Unicode MS (TrueType)"="ARIALUNI_0.TTF"
"Arial Black (TrueType)"="ariblk_0.ttf"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontMapper]
"ARIAL"=dword:00000000
"Batang"=dword:00004081
"BatangChe"=dword:0000c081
"@Batang"=dword:00006081
"@BatangChe"=dword:0000e081
"Gungsuh"=dword:00005081
"GungsuhChe"=dword:0000d081
"@Gungsuh"=dword:00007081
"@GungsuhChe"=dword:0000f081
"COURIER NEW"=dword:00008000
"Gulim"=dword:00000081
"GulimChe"=dword:00008081
"@Gulim"=dword:00002081
"@GulimChe"=dword:0000a081
"Dotum"=dword:00001081
"DotumChe"=dword:00009081
"@Dotum"=dword:00003081
"@DotumChe"=dword:0000b081
"MingLiU"=dword:00008088
"PMingLiU"=dword:00000088
"@MingLiU"=dword:0000a088
"@PMingLiU"=dword:00002088
"MS Gothic"=dword:00008080
"MS PGothic"=dword:00000080
"@MS Gothic"=dword:0000a080
"@MS PGothic"=dword:00002080
"MS Mincho"=dword:0000c080
"MS PMincho"=dword:00004080
"@MS Mincho"=dword:0000e080
"@MS PMincho"=dword:00006080
"SimSun"=dword:00000086
"NSimSun"=dword:00008086
"@SimSun"=dword:00002086
"@NSimSun"=dword:0000a086
"TIMES NEW ROMAN"=dword:00004000
"SYMBOL"=dword:00004002
"SYMBOL1"=dword:0000a002
"WINGDINGS"=dword:00000002
"COURIER"=dword:00008800
"FIXEDSYS"=dword:00009000
"MS SANS SERIF"=dword:00001000
"MS SERIF"=dword:00005000
"SMALL FONTS"=dword:00000800
"DEFAULT"=dword:00000080

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontMapper\FamilyDefaults]
@="Arial"
"Swiss"="Arial"
"Modern"="Courier New"
"Decorative"="Impact"
"Script"="Segoe Script"
"Roman"="Times New Roman"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"Arabic Transparent"="Arial"
"Arabic Transparent Bold"="Arial Bold"
"Arabic Transparent,0"="Arial,178"
"Arabic Transparent Bold,0"="Arial Bold,178"
"Helvetica"="Arial"
"Arial Baltic,186"="Arial,186"
"Arial CE,238"="Arial,238"
"Arial CYR,204"="Arial,204"
"Arial Greek,161"="Arial,161"
"Arial TUR,162"="Arial,162"
"Courier New Baltic,186"="Courier New,186"
"Courier New CE,238"="Courier New,238"
"Courier New CYR,204"="Courier New,204"
"Courier New Greek,161"="Courier New,161"
"Courier New TUR,162"="Courier New,162"
"Times"="Times New Roman"
"Times New Roman Baltic,186"="Times New Roman,186"
"Times New Roman CE,238"="Times New Roman,238"
"Times New Roman CYR,204"="Times New Roman,204"
"Times New Roman Greek,161"="Times New Roman,161"
"Times New Roman TUR,162"="Times New Roman,162"
"MS Shell Dlg 2"="Tahoma"
"Tahoma Armenian"="Tahoma"
"Helv"="MS Sans Serif"
"Tms Rmn"="MS Serif"
"David Transparent"="David"
"Miriam Transparent"="Miriam"
"Fixed Miriam Transparent"="Miriam Fixed"
"Rod Transparent"="Rod"
"FangSong_GB2312"="FangSong"
"KaiTi_GB2312"="KaiTi"
"MS Shell Dlg"="MS UI Gothic"
"標準明朝"="ＭＳ 明朝"
"@標準明朝"="@ＭＳ 明朝"
"標準ゴシック"="ＭＳ ゴシック"
"@標準ゴシック"="@ＭＳ ゴシック"
"ゴシック"="ＭＳ ゴシック"
"ｺﾞｼｯｸ"="ＭＳ ゴシック"
"ｸｰﾘｴ"="Courier"
"ﾀｲﾑｽﾞﾛﾏﾝ"="Times New Roman"
"ﾍﾙﾍﾞﾁｶ"="Arial"
```

#結果スクリーンショット
![image.png](https://qiita-image-store.s3.amazonaws.com/0/102207/635fd794-3cb8-8a24-9070-649483edb2d0.png)
![image.png](https://qiita-image-store.s3.amazonaws.com/0/102207/7aec3bae-de02-4f87-9ddf-3cebcffd01d6.png)


#参考
- [フォントインストーラー SAKURA](http://tam.vni.jp/soft/sakura/sakurasample.html)
- [WineHQ Forums • View topic - Font anti-aliasing does not work...](https://forum.winehq.org/viewtopic.php?f=8&t=19480)