XPシステムフォントのメイリオ化

ことば・その周辺 PC版「WindowsXP のシステム・フォントを変更する(6)――最終(改)」
の手順で msgothic に偽装した meiryoKeGothic に置き換えるが、何故か MSゴシックが認識できなくなってしまう。
それにつられて、FixedSysの日本語フォントも豆腐(■)になってしまう。


以前同様の手順で行ったときには何ら問題は起こらなかったのだが、今回は何度やり直しても同じ結果。
 ※追記: 前回は下記の手順で行ったのかもと思い始めてきた。今回は cygwin で cpしたのがよくなかったのかも……


仕方ないので、msgothic を右クリック→削除で消した後、偽装msgothicをインストール。
c:/Windows/Fonts/には、元々フォント名「MS Gothic & MS PGothic(TrueType)」と「MS ゴシック & MS P ゴシック(TrueType)」の2つが存在したのだが、上記の作業で「MS ゴシック & MS P ゴシック & MS UI Gothic(TrueType)」一つにまとまってしまった。
特に悪影響は出ていないので、これで使い続けてみる。


http://tomtia.plala.jp/PC/ttfont/index.htm を参考に EBDT を削除したMSゴシックで試してみても、同じ結果だった。

MS明朝のClearTypeを有効化

http://tomtia.plala.jp/PC/ttfont/index.htm に従い以下の手順で行った。

  • ttctからttfを抽出


breakttc msmincho.ttc
font00.ttf, font01.ttfが抽出される

  • EBDT削除

http://tomtia.plala.jp/PC/ttfont/index.htmの 「EBDTを取り除く」に従う


・バッチファイル rmEBDT.bat

@echo off
copy %1 %2 >nul
for /l %%i in ( 7,1,22 ) do (
echo PPEM %%i > mtemp.txt
echo END >> mtemp.txt
sbit32 -d %2 mtemp.txt ftemp.ttf
del %2
ren ftemp.ttf %2
)
del mtemp.txt


rmEBDT font00.ttf min.ttf
rmEBDT font01.ttf minp.ttf

上記の手順だけだと、ClearTypeは有効になるが、通常のアンチエイリアシングは有効にならない。
ttfmodを使って、通常のアンチエイリアシングを有効にする


ttfmod min.ttf
ttfmod minp.ttf

  • フォント名の変更
    • ttfname3.exe に 各ttfをドロップし、xmlを生成
    • xml中の Family,UniqueIdentifire,FullName,PostScriptName の各名前を "〜NB" に変更
    • ttfname3で名前の変更されたttfを作成


ttfname3 min.ttf min.xml
ttfname3 minp.ttf minp.xml
→min_mod.ttf,minp_mod.ttfが生成される

  • ttcにマージ


makettc min.ttc min_mod.ttf minp_mod.ttf
ren min.ttc msminchoNB.ttc

※変更後のxml

<?xml version="1.0"?>
<Fonts>
<Font>
  <!-- ****************** Font(0) ****************** -->

  <Header
    Ascender="220"
    Descender="-36"
    TypoAscender="220"
    TypoDescender="-36"
    WinAscender="220"
    WinDescender="36"
    AverageCharWidth="105"
    Codepage1="4002009f"
    Codepage2="dfd70000" />

  <Name>

    <!-- Copyright -->
    <T n="1,0,0000,0">(C)2001 Copyright Ricoh Company,LTD. All right are reserved under the license agreemant with Ryobi Imagix Co..</T>
    <T n="3,1,0409,0">(C)2001 Copyright Ricoh Company,LTD. All right are reserved under the license agreemant with Ryobi Imagix Co..</T>
    <T n="3,1,0411,0">(C)2001 RICOH COMPANY,LTD.本フォントはリョービイマジクス(株)の字母に基づいて作成しました。</T>

    <!-- Family -->
    <T n="1,0,0000,1">MS PMinchoNB</T>
    <T n="3,1,0409,1">MS PMinchoNB</T>
    <T n="3,1,0411,1">MS P明朝NB</T>

    <!-- Subfamily -->
    <T n="1,0,0000,2">Regular</T>
    <T n="3,1,0409,2">Regular</T>
    <T n="3,1,0411,2">標準</T>

    <!-- UniqueIdentifier -->
    <T n="1,0,0000,3">Microsoft:MS PMinchoNB:2001</T>
    <T n="3,1,0409,3">Microsoft:MS PMinchoNB:2001</T>
    <T n="3,1,0411,3">Microsoft:MS P明朝NB:2001</T>

    <!-- FullName -->
    <T n="1,0,0000,4">MS PMinchoNB</T>
    <T n="3,1,0409,4">MS PMinchoNB</T>
    <T n="3,1,0411,4">MS P明朝NB</T>

    <!-- Version -->
    <T n="1,0,0000,5">Version 2.31</T>
    <T n="3,1,0409,5">Version 2.31</T>
    <T n="3,1,0411,5">Version 2.31</T>

    <!-- PostscriptName -->
    <T n="1,0,0000,6">MS-PMinchoNB</T>
    <T n="3,1,0409,6">MS-PMinchoNB</T>
    <T n="3,1,0411,6">MS-PMinchoNB</T>

    <!-- Trademark -->
    <T n="1,0,0000,7">MS-PMincho is a registered trademark of the Microsoft Corporation.</T>
    <T n="3,1,0409,7">MS-PMincho is a registered trademark of the Microsoft Corporation.</T>
    <T n="3,1,0411,7">MS P明朝 is a registered trademark of the Microsoft Corporation.</T>

  </Name>
</Font>
</Fonts>

XMLRPCで "`split' called for nil:NilClass" エラー

ruby1.8のXMLRPCで巨大なstring戻り値を受け取るときに


Message: <"private method `split' called for nil:NilClass">
エラーが出力されるようになった。

http://www.ruby-forum.com/topic/104425によると、lib/xmlprc/client.rb のバグらしい。

--- lib/xmlrpc/client.rb        (revision 12167)
+++ lib/xmlrpc/client.rb        (working copy)
@@ -546,15 +546,17 @@ module XMLRPC
         raise "HTTP-Error: #{resp.code} #{resp.message}"
       end

-      ct = parse_content_type(resp["Content-Type"]).first
-      if ct != "text/xml"
-        if ct == "text/html"
-          raise "Wrong content-type: \n#{data}"
-        else
-          raise "Wrong content-type"
+      unless resp["Content-Type"].nil?
+        ct = parse_content_type(resp["Content-Type"]).first
+        if ct != "text/xml"
+          if ct == "text/html"
+            raise "Wrong content-type: \n#{data}"
+          else
+            raise "Wrong content-type"
+          end
         end
       end
-
+
       expected = resp["Content-Length"] || "<unknown>"
       if data.nil? or data.size == 0
         raise "Wrong size. Was #{data.size}, should be #{expected}"

しかし、ライブラリを修正するのも気が引けるので、戻り値のstringを分割して、複数回に分けて受け取るように修正した。
もしかしたら、戻りstringのサイズが大きいときに content-type が抜け落ちるという、Lighthttpd側のバグなのかもしれない。。
 →喉元過ぎたので、調査する気ゼロw