2017-03-02

JavaScriptで特定のフォント(文字列)がインストールされているかどうかを調べる

JavaScriptでは、フォント関連の操作が上手くできないことが多いです。インストールされているフォントの一覧の取得など、現在実用的な方法がないような場合も多いです。

今回はその中でも数少ない、フォント関連でJavaScriptができることの一つ、特定のフォントがインストールされているかどうかを調べる方法を紹介します。

定義

以下のJavaScriptを読み込むことで、特定のフォントがインストールされているかどうかを調べるグローバル関数isInstalledFont()が定義されます。

(function (w, d, f) {
    var defaultCheckString = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
    var regex = /"/g;
    f = f.replace(regex, '\"');

    var style = d.createElement('style');
    d.head.appendChild(style);
    style.sheet.insertRule('@font-face{font-family:' + f + ';src:url("data:font/opentype;base64,T1RUTwAKAIAAAwAgQ0ZGIDTeCDQAACFkAAAZPERTSUcAAAABAABKqAAAAAhPUy8yAF+xmwAAARAAAABgY21hcCRDbtEAAAdcAAAZ6GhlYWQFl9tDAAAArAAAADZoaGVhB1oD7wAAAOQAAAAkaG10eAPoAHwAADqgAAAQBm1heHAIAVAAAAABCAAAAAZuYW1lIE0HkgAAAXAAAAXrcG9zdP+4ADIAACFEAAAAIAABAAAAAQuFfcPHtV8PPPUAAwPoAAAAANFMRfMAAAAA0UxF8wB8/4gDbANwAAAAAwACAAAAAAAAAAEAAANw/4gAAAPoAHwAfANsAAEAAAAAAAAAAAAAAAAAAAACAABQAAgBAAAAAwPoAZAABQAAAooCWAAAAEsCigJYAAABXgAyANwAAAAAAAAAAAAAAAD3/67/+9///w/gAD8AAAAAQURCTwBAAAD//wNw/4gAAANwAHhgLwH/AAAAAAAAAAAAAAAgAAAAAAARANIAAQAAAAAAAQALAAAAAQAAAAAAAgAHAAsAAQAAAAAAAwAbABIAAQAAAAAABAALAAAAAQAAAAAABQA6AC0AAQAAAAAABgAKAGcAAwABBAkAAACUAHEAAwABBAkAAQAWAQUAAwABBAkAAgA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ACNgAAAjf/wAAAAEACOAAAAjn/wAAAAEACOgAAAjv/wAAAAEACPAAAAj3/wAAAAEACPgAAAj//QAAAAEACQAAAAkH/wAAAAEACQgAAAkP/wAAAAEACRAAAAkX/wAAAAEACRgAAAkf/wAAAAEACSAAAAkn/wAAAAEACSgAAAkv/wAAAAEACTAAAAk3/wAAAAEACTgAAAk//wAAAAEACUAAAAlH/wAAAAEACUgAAAlP/wAAAAEACVAAAAlX/wAAAAEACVgAAAlf/wAAAAEACWAAAAln/wAAAAEACWgAAAlv/wAAAAEACXAAAAl3/wAAAAEACXgAAAl//wAAAAEACYAAAAmH/wAAAAEACYgAAAmP/wAAAAEACZAAAAmX/wAAAAEACZgAAAmf/wAAAAEACaAAAAmn/wAAAAEACagAAAmv/wAAAAEACbAAAAm3/wAAAAEACbgAAAm//wAAAAEACcAAAAnH/wAAAAEACcgAAAnP/wAAAAEACdAAAAnX/wAAAAEACdgAAAnf/wAAAAEACeAAAAnn/wAAAAEACegAAAnv/wAAAAEACfAAAAn3/wAAAAEACfgAAAn//QAAAAEACgAAAAoH/wAAAAEACggAAAoP/wAAAAEAChAAAAoX/wAAAAEAChgAAAof/wAAAAEACiAAAAon/wAAAAEACigAAAov/wAAAAEACjAAAAo3/wAAAAEACjgAAAo//wAAAAEACkAAAApH/wAAAAEACkgAAApP/wAAAAEAClAAAApX/wAAAAEAClgAAApf/wAAAAEACmAAAApn/wAAAAEACmgAAApv/wAAAAEACnAAAAp3/wAAAAEACngAAAp//wAAAAEACoAAAAqH/wAAAAEACogAAAqP/wAAAAEACpAAAAqX/wAAAAEACpgAAAqf/wAAAAEACqAAAAqn/wAAAAEACqgAAAqv/wAAAAEACrAAAAq3/wAAAAEACrgAAAq//wAAAAEACsAAAArH/wAAAAEACsgAAArP/wAAAAEACtAAAArX/wAAAAEACtgAAArf/wAAAAEACuAAAArn/wAAAAEACugAAArv/wAAAAEACvAAAAr3/wAAAAEACvgAAAr//QAAAAEACwAAAAsH/wAAAAEACwgAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA==");}', 0);

    var element = d.createElement('span');
    element.style.fontSize = '1rem';
    isInstalledFont();

    /**
     * 指定したフォントがインストールされているかどうかを返す
     * @param {string} [font] - フォント名
     * @param {string} [checkString] - 確認する文字列
     * @returns {boolean}
     */
    function isInstalledFont(font, checkString) {
        element.innerHTML = toString(checkString) || defaultCheckString;
        element.style.fontFamily = '"' + toString(font).replace(regex, '\"') + '",' + f;
        d.body.appendChild(element);
        var result = element.offsetWidth > 1;
        d.body.removeChild(element);
        return result;
    }

    function toString(value) {
        if (value == null) return '';
        if (typeof value == 'string') return value;
        if (Array.isArray(value)) return value.map(toString) + '';
        var result = value + '';
        return '0' == result && 1 / value == -(1 / 0) ? '-0' : result;
    }

    w.isInstalledFont = isInstalledFont;
})(window, document, 'Blank');

念のため、minifyしたコードはこちらから取得できます。

動作

isInstalledFont()関数は、第一引数に「フォント名」、第二引数に「フォントの存在確認に使用する文字列」を指定します。第二引数はオプションで、指定しなければ全ての英数字記号が使用されます。

例えば、「ヒラギノ角ゴ ProN」がインストールされているかを知りたい場合、以下のようにします。

isInstalledFont('Hiragino Kaku Gothic ProN');
// インストールされていればtrue、されていなければfalse

第二引数を使えば、特定の文字列がインストールされたフォントなのかどうかも調べることができます。

例えば、「Verdana」は有名な英字フォントですが、これには日本語は含まれていません。なので、以下のように判別できます。

isInstalledFont('Verdana');
// true

isInstalledFont('Verdana', 'a');
// true

isInstalledFont('Verdana', '');
// false

原理

この関数では、Adobeによってオープンソースで公開されている「Adobe Blank」というフォントを利用しています。

Adobe Blankは「見えないフォント」です。どんな文字を入力しても、一切の文字を表示しません。文字幅もありません。

この特性を利用しています。

この関数では、調べたいフォントとAdobe Blankをフォントに指定したスタイル(font-family: [調べたいフォント], "Adobe Blank";)を、実際に生成した要素にあてて、文字幅が1pxを超えているかを調べています。

調べたいフォントがインストールされていない場合、Adobe Blankが表示されますので、文字幅は出ません。

なお、このコードでは、JavaScriptで完結させるために、JavaScript内で<style>要素を生成しています。紹介したコードでは、Adobe Blankを"Blank"という名称で定義していますが、衝突が起こるようでしたら、コードの最終行の'Blank'の部分を適当な名前に変更して使用してください。

まとめ

今回は、JavaScriptで特定のフォント(文字列)がインストールされているかどうかを調べる関数を紹介しました。

最近はWebフォントの登場などもあり、フォントの情報を取得したい場面も以前に比べ増えてきました。内心、JavaScript側でフォントに関するインターフェースを用意してほしいと思っていますが、現状はこうやって無理やり実装するしかなさそうです。

ぜひ、利用してみてください。

また、「Adobe Blank」を応用すると、これ以外の使い道もあるかと思います。それも模索してみてはいかがでしょうか。