[debian-devel:18751] Re: libreoffice と日本語フォント名フォン ト - 回避可能

Osamu Aoki <[email protected]>
Newsgroups gmane.linux.debian.jp.devel
Message-ID <[email protected]>
ちょっとわかりました。

フォント名はロカール依存です。そしてfc-listは大丈夫なんですが、
libreofficeが読みに行く際に英語環境でのフォント名が文字化けし
ています。fontforgeで確認すると英語フォント名はおかしいですね。

ややこしいのはこのようなフォント名はlibreofficeによりキャッ
シュされているので、LOCALEを切り替えただけでは治りません。

ロカールの切り替えをした後.config/libreofficeをりネームして無効化
してやらないといけません。どうもピンポイントに消すなら以下です。
.config/libreoffice/4/user/psprint/pspfontcache

diffを取ってみました:

FontCacheDirectory:1417269784:/usr/share/fonts/truetype
@@ -426,42 +426,42 @@
 FontCacheDirectory:1417240455:/home/osamu/.fonts
 File:epkyouka.ttf
 2;1
-EPSON ã≥â»èëëÃÇl;EPSON 教科書体M
+EPSON 教科書体M;EPSON ã≥â»èëëÃÇl
 0;EPSON-KYOKASHO;0;5;5;2;65535;859;140;-1;1;1000;999;1000;999;0;0;0;0;Regular

ただどうすればã≥â»èëëÃÇlと文字化けするのかは不明です。
フォントファイル最後にはバイナリモードで見ると:
003ef8f0  01 c2 28 43 29 20 32 30  30 30 20 53 45 49 4b 4f  |..(C) 2000 SEIKO|
003ef900  20 45 50 53 4f 4e 20 43  4f 52 50 2e 20 41 6c 6c  | EPSON CORP. All|
003ef910  20 72 69 67 68 74 73 20  72 65 73 65 72 76 65 64  | rights reserved|
003ef920  2e 00 45 50 53 4f 4e 20  8b b3 89 c8 8f 91 91 cc  |..EPSON ........|
003ef930  82 6c 52 65 67 75 6c 61  72 00 45 50 53 4f 4e 20  |.lRegular.EPSON |
003ef940  8b b3 89 c8 8f 91 91 cc  82 6c 3a 32 30 30 30 00  |.........l:2000.|
003ef950  45 50 53 4f 4e 20 8b b3  89 c8 8f 91 91 cc 82 6c  |EPSON .........l|
003ef960  56 65 72 73 69 6f 6e 20  33 2e 30 30 45 50 53 4f  |Version 3.00EPSO|
003ef970  4e 2d 4b 59 4f 4b 41 53  48 4f 45 50 53 4f 4e 20  |N-KYOKASHOEPSON |
003ef980  8b b3 89 c8 8f 91 91 cc  82 6c 20 61 6e 64 20 45  |.........l and E|
003ef990  50 53 4f 4e 2d 4b 59 4f  4b 41 53 48 4f 20 69 73  |PSON-KYOKASHO is|
003ef9a0  20 61 20 74 72 61 64 65  6d 61 72 6b 20 6f 66 20  | a trademark of |
003ef9b0  53 45 49 4b 4f 20 45 50  53 4f 4e 20 43 4f 52 50  |SEIKO EPSON CORP|
003ef9c0  4f 52 41 54 49 4f 4e 2e  00 28 00 43 00 29 00 20  |ORATION..(.C.). |
があります。「EPSON 」の後が 8b b3 89 c8 8f 91 91 cc 82 6c ですね。
これってsjisで「教 科 書 体 M」です。2回繰り返えされますね。

fc-list -vでは
Pattern has 23 elts (size 32)
        family: "EPSON 教科書体M"(s)
        familylang: "ja"(s)
        style: "Regular"(s)
        stylelang: "ja"(s)
        fullname: "EPSON 教科書体M"(s)
        fullnamelang: "ja"(s)
        slant: 0(i)(s)
        weight: 80(i)(s)
        width: 100(i)(s)
        spacing: 90(i)(s)
        foundry: "epson"(s)
        file: "/home/osamu/.fonts/epkyouka.ttf"(s)
        index: 0(i)(s)
        outline: True(s)
        scalable: True(s)
        charset: 
...
        lang: bg|fj|ho|ia|ie|io|ja|kum|nr|om|os|ru|sel|so|ss|st|sw|ts|uz|xh|zu|kj|kwm|ms|ng|rn|rw|sn|za(s)
        fontversion: 196608(i)(s)
        capability: "otlayout:kana"(s)
        fontformat: "TrueType"(s)
        decorative: False(s)
        hash: "sha256:819c254f89d796bce83297a47cc07c4f73d2739232335dd688f84c9dcf5af168"(s)
        postscriptname: "EPSON-KYOKASHO"(s)

ここはfullname 等に英語名がないですね。

Takaoだと:
        family: "TakaoMincho"(s) "Takao明朝"(s)
        familylang: "en"(s) "ja"(s)
        style: "Regular"(s)
        stylelang: "en"(s)
        fullname: "TakaoMincho"(s) "Takao明朝"(s)

道理でFONTFORGEでも英語名とした際に同じ文字化けするはずです。

それにつけても、どうしてこう化けるかが不可解です。

元コード  表示 UTFー8コード 
8b        ã    C3 A3
b3        ≥    E2 89 A5 
89        â    C3 A2 
c8        »    C2 BB 
8f        è    C3 A8 
91        ë    C3 AB
91        ë    C3 AB 
cc        Ã    C3 83 
82        Ç    C3 87    
6c        l    6C       

でもどういうエンコーディングなのか予想できません。少なくとも
以下ではないようです。意味不明です。
 Windows-1252
 ISO/IEC 8859-1 (LATIN1)

まあ、どこでおかしくなるかは良く分かりませんが、フォント名の
エンコーディング問題があり、そのデーターがキャッシュされてい
るので解決しにくいようです。兎に角キャシュを消して日本語環境
下で起動し日本語フォント名を使うといいようですね。

青木
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.