試験運用中なLinux備忘録・旧記事

はてなダイアリーで公開していた2007年5月-2015年3月の記事を保存しています。

ReactOSの日本語フォントの追加と設定をソースビルドをすることなく行ってISOイメージを作り直す(CDイメージ内のファイル編集)

  • cabextractcabmanコマンドがインストール済み
  • 作業ディレクトリを作成し、その中に、bbie.exeもしくはddにより抽出されたブートイメージが存在する
  • 作成した作業ディレクトリの中にいる

という状態からの作業。

$ pwd
/tmp/work
$ ls
image1.bin

  1. 作業ディレクトリへのファイルのコピー
  2. フォント置換情報を含むファイルの修正

作業ディレクトリへのファイルのコピー

既存のISOイメージをマウントし、中の全ファイル/ディレクトリを作業ディレクトリにコピーした後、書き込みができるように属性変更をする。

$ sudo mount -t iso9660 -o loop [ISOイメージファイルの場所] [マウントポイント]
$ cp -pr [マウントポイント]/* .
$ find -print0 | xargs -0 chmod +w
$ sudo umount [マウントポイント]

フォント置換情報を含むファイルの修正

下の例では、DejaVuフォントをIPAモナーの各フォントに置き換え、更にMS UI GothicをIPAモナーUIゴシックにしている(IPA系フォントを含むCDイメージを配布する場合は、ライセンスに従い、指定されたソフトウェアも同梱する形になる)。
なお、このフォント置換は恐らく不完全。一部のフォントは正常に表示されない。

$ sed -i -e 's/"DejaVu Sans"/"IPAMonaPGothic"/' -e 's/"DejaVu Sans Mono"/"IPAMonaPGothic"/' -e 's/"DejaVu Serif"/"IPAMonaPMincho"/' reactos/hivesft.inf
$ sed -i 's/^\(; SysFontSubstitutes.*\)/\1\nHKLM,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SysFontSubstitutes","DejaVu Sans",0x00000000,"IPAMonaUIGothic"\nHKLM,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SysFontSubstitutes","DejaVu Sans Mono",0x00000000,"IPAMonaGothic"\nHKLM,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SysFontSubstitutes","DejaVu Serif",0x00000000,"IPAMonaPMincho"\nHKLM,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SysFontSubstitutes","MS UI Gothic",0x00000000,"IPAMonaUIGothic"/' reactos/hivesft.inf

patchで修正するための差分では下のようになるが、ReactOSのバージョンによっては場所がずれたり、適用に失敗したりするかもしれない。また、改行文字の関係でうまく処理できないかもしれない(「@@」の次の行から全ての行の末尾に「CR」のコードが付く)。

--- reactos/hivesft.inf.orig
+++ reactos/hivesft.inf
@@ -72,14 +72,18 @@
 

 ; Font substitutes

 ; SysFontSubstitutes are also returned by EnumFontFamilies, FontSubstitutes aren't

-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Arial",0x00000000,"DejaVu Sans"

-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Courier New",0x00000000,"DejaVu Sans Mono"

-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Times New Roman",0x00000000,"DejaVu Serif"

-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Tahoma",0x00000000,"DejaVu Sans"

-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Sans Serif",0x00000000,"DejaVu Sans"

-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Shell Dlg",0x00000000,"DejaVu Sans"

-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Shell Dlg 2",0x00000000,"DejaVu Sans"

-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Helv",0x00000000,"DejaVu Sans"

+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","DejaVu Sans",0x00000000,"IPAMonaUIGothic"
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","DejaVu Sans Mono",0x00000000,"IPAMonaGothic"
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","DejaVu Serif",0x00000000,"IPAMonaPMincho"
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS UI Gothic",0x00000000,"IPAMonaUIGothic"
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Arial",0x00000000,"IPAMonaPGothic"

+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Courier New",0x00000000,"IPAMonaPGothic"

+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Times New Roman",0x00000000,"IPAMonaPMincho"

+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Tahoma",0x00000000,"IPAMonaPGothic"

+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Sans Serif",0x00000000,"IPAMonaPGothic"

+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Shell Dlg",0x00000000,"IPAMonaPGothic"

+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Shell Dlg 2",0x00000000,"IPAMonaPGothic"

+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Helv",0x00000000,"IPAMonaPGothic"

 

 ; Time zone settings

 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones",,0x00000012

使用したバージョン: