Skip to content

Instantly share code, notes, and snippets.

@CannoHarito
Created May 3, 2019 07:09
Show Gist options
  • Save CannoHarito/6103c8ae9fad5378b6639e16f7b21a6b to your computer and use it in GitHub Desktop.
Save CannoHarito/6103c8ae9fad5378b6639e16f7b21a6b to your computer and use it in GitHub Desktop.
Yugothicが見難いと言われて、Win10のシステムフォントを変更する手段をググった。
#元にした情報
#https://qiita.com/ikikuchi/items/7a941ac45b6e97a14058
# @ikikuchi 2018年10月05日に更新
# 【Windows10】システムフォント(游ゴシック)を別フォントに変更する
"1.フォントのインストール"
"ダウンロードし解凍した[NotoSansCJKjp-hinted]内の2つのファイル"
"NotoSansCJKjp-Bold.otf"
"NotoSansCJKjp-Regular.otf"
"を選択し、右クリックメニューの[インストール]。"
Read-Host "続けるには Enter キーを押してください..."
"2.レジストリ登録(YuGothicのフォント名をエイリアスとする)"
$reg_path='HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes'
$regular=@("Yu Gothic","Yu Gothic Light","Yu Gothic Medium","Yu Gothic Regular","Yu Gothic UI","Yu Gothic UI Light","Yu Gothic UI Regular","Yu Gothic UI Semilight","游ゴシック","游ゴシック Light","游ゴシック Medium","游ゴシック Regular")
$bold=@("Yu Gothic Bold","Yu Gothic UI Semibold","游ゴシック Bold")
$regular|%{Set-ItemProperty -path $reg_path -name $_ -value "Noto Sans CJK JP Regular"}
$bold|%{Set-ItemProperty -path $reg_path -name $_ -value "Noto Sans CJK JP Bold"}
"3.フォントキャッシュの停止、自動起動の無効化"
Get-Service FontCache | Stop-Service -PassThru | Set-Service -StartupType Disabled
<# やらなくてもエイリアスは機能する
"4.Yugoticのフォントファイル無効化"
pushd $env:windir\Fonts
takeown /F YuGoth*.ttc /A
icacls YuGoth*.ttc /grant Administrators:F
ls YuGoth*.ttc | %{mv $_.Name ($_.Name -replace '\.ttc$','.ttc.1')}
popd
#>
"5.フォントキャッシュの削除"
rm $env:windir\ServiceProfiles\LocalService\AppData\Local\*FontCache*.dat
rm $env:windir\system32\FNTCACHE.DAT
Read-Host "終了しました。 Enter キーを押してください..."
<# 戻すときに必要な処理のメモ
------
pushd $env:windir\Fonts
ls YuGoth*.ttc.1 | %{mv $_.Name ($_.Name -replace '\.ttc.1$','.ttc')}
popd
$regular+$bold|%{Remove-ItemProperty -path $reg_path -name $_ }
echo '必要なくなったフォントはWindowsの設定からアンインストールしてください'
start ms-settings:fonts
Get-Service FontCache | Set-Service -StartupType Automatic
#>
<# メモ
Add-Type -AssemblyName System.Drawing
[System.Drawing.FontFamily]::Families
#>
@CannoHarito
Copy link
Author

管理者権限が必要。

私個人としてはYuGothが嫌いではない。InternetExplorer上で表示が乱れる原因だったのでIEがさらに嫌いになった。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment