Skip to content

UAX#11 Ambiguous と UTR #51 Emoiji を全角とする修正 locale

License

Notifications You must be signed in to change notification settings

uwabami/locale-eaw-emoji

Repository files navigation

What is this?/これは何?

unicode #UAX11 において文字幅が曖昧(A),つまり文脈に依存して文字幅が半 角幅だったり全角幅だったりする文字と,絵文字(#UTR 51) について,強制的 に文字幅を 2 ,つまり全角幅にするよう修正したロケールデータと,それ を生成するための ruby script です.

使用に際しての責任は取りません/取れませんので,あらかじめご容赦下さい.

最近 icon font として isfit-plus を使う様になったので、そのデータ領域 である #xE000#xE8FF も二文字幅になっています. (一応これらは PRIVATE USE AREA です).

なんでこんなものが必要なの?

ターミナルで生活していると,

  • libc の wcwidth の返す値
  • terminal 上で動作するアプリケーションが使う文字幅
  • 実際のフォント

が揃っていないと絵文字とか曖昧文字幅が出てきたときに表示が崩れて悲しい気 持になります.というわけで,文脈に依存せずに強制的に文字幅を 2 として おくことで,表示の崩れを防ごう,という事です.

どう使うの?

以下,Debian の場合です.ロケールデータの置き場所や更新方法はお使いの環 境に合わせて適宜修正して下さい.

  1. make, python3, ruby, wget を install して下さい
  2. git clone した後に make すると, unicode.org から,必要なファイル を download した後, UTF-8-EAW-EMOJI-FULLWIDTH.gzlocale-eaw-emoji.el が生成されます.
  3. 生成した UTF-8-EAW-EMOJI-FULLWIDTH.gz/usr/share/i18n/charmaps に copy します.
  4. /etc/locale.gen 中の ja_JP.UTF-8 の行を
    en_US.UTF-8 UTF-8-EAW-EMOJI-FULLWIDTH
    ja_JP.UTF-8 UTF-8-EAW-EMOJI-FULLWIDTH
        

    に変更します.en_US.UTF-8 も変えているのは, tmux の文字幅判定が en_US.UTF-8 決め打ちだから, です(なんでなのかねぇ…)

  5. locale-gen を唱えます.
  6. emacs の load-path が通った所に locale-eaw-emoji.el を copy して,
    (require 'locale-eaw-emoji)
    (eaw-and-emoji-fullwidth)
        

    として下さい.

ライセンス

テーブル生成に glibc 由来の utf8_gen.py を同梱しています. これは LGPL-2.1 です.

Files: *
Copyright: 2015-2017 Youhei SASAKI <uwabami@gfd-dennou.org>
License: MIT

Files: unicode_utils.py utf8_gen.py
Copyright (C) 2014-2018 Free Software Foundation, Inc.
License: LGPL-2.1

License: MIT
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the "Software"),
 to deal in the Software without restriction, including without limitation
 the rights to use, copy, modify, merge, publish, distribute, sublicense,
 and/or sell copies of the Software, and to permit persons to whom the
 Software is furnished to do so, subject to the following conditions:
 .
 The above copyright notice and this permission notice shall be included
 in all copies or substantial portions of the Software.
 .
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

License: LGPL-2.1+
 This package is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.
 .
 This package is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.
 .
 You should have received a copy of the GNU Lesser General Public License
 along with this program. If not, see <https://www.gnu.org/licenses/>.
 .
 See LGPL-2.1.txt

参考文献

About

UAX#11 Ambiguous と UTR #51 Emoiji を全角とする修正 locale

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published