タグ

2011年11月28日のブックマーク (2件)

  • 東アジアの文字幅 (East Asian Width) の判定 - 中途

    Unicodeの文字が全角で表示されるか半角で表示されるかは東アジアの文字幅特性値がヒントを与えてくれるそうです。(日語の場合は)この値がNa(狭)、N(中立)、H(半角)だと半角、W(広)、F(全角)、A(曖昧)だと全角として扱うことが推奨されているようです。 Pythonではunicodedataモジュールを使うとこの特性値を取得できますが、JavaScriptにはそのような関数は見当たりません。ですが、Unicode Consortiumが、どの文字がどの東アジアの文字幅を持つかのデータファイルを公開しているので、そこから判定用のコードを機械的に生成できるはずです。 で、以下が実際に生成したコードです。データファイルに、データファイルに出現しない文字はNとなるとあるので、以下ではN以外(F、H、W、Na、A)についてのみチェックを行い、それ以外をNと判定するようにしています。 コメ

    東アジアの文字幅 (East Asian Width) の判定 - 中途
    teramako
    teramako 2011/11/28
    神エントリ来た
  • Epimetheus

    Epimetheus is an implementation of the current ECMAScript 4.0 proposal in C++.  It is located in the Mozilla source tree at mozilla/js2. To build, first see the CVS page for details on logging in via CVS, and then: cvs co mozilla/js2 will pull the complete source tree. In the js2 directory, you'll find a README file that contains details on building. Currently there are Windows (MSVC) and Linux bu

    teramako
    teramako 2011/11/28
    "Epimetheus is an implementation of the current ECMAScript 4.0 proposal in C++." だと...!?