Revision: 8129 https://osdn.net/projects/ttssh2/scm/svn/commits/8129 Author: zmatsuo Date: 2019-09-13 00:59:13 +0900 (Fri, 13 Sep 2019) Log Message: ----------- 絵文字テーブルの生成スクリプト追加 Added Paths: ----------- branches/unicode_buf/teraterm/teraterm/unicode/get_emoji_table.md branches/unicode_buf/teraterm/teraterm/unicode/get_emoji_table.pl -------------- next part -------------- Added: branches/unicode_buf/teraterm/teraterm/unicode/get_emoji_table.md =================================================================== --- branches/unicode_buf/teraterm/teraterm/unicode/get_emoji_table.md (rev 0) +++ branches/unicode_buf/teraterm/teraterm/unicode/get_emoji_table.md 2019-09-12 15:59:13 UTC (rev 8129) @@ -0,0 +1,25 @@ + +# unicodeの絵文字 + +- unicode.orgにある 絵文字データ に基づいて絵文字のコード + https://unicode.org/Public/emoji/12.0/emoji-data.txt +- 絵文字を判定するテーブルを作成する + +# テーブルの作り方 + +- あらかじめ emoji-data.txt をダウンロードしておく +- 次のように実行 + - `perl get_emoji_table.pl > unicode_emoji.tbl` + +# ? + +- CJK環境では絵文字は全角 +- 非CJKでは0x1f000未満の絵文字は半角、それ以外は全角 + +## original data + +https://unicode.org/Public/emoji/12.0/emoji-data.txt + + # emoji-data.txt + # Date: 2019-01-15, 12:10:05 GMT + # © 2019 Unicode®, Inc. Added: branches/unicode_buf/teraterm/teraterm/unicode/get_emoji_table.pl =================================================================== --- branches/unicode_buf/teraterm/teraterm/unicode/get_emoji_table.pl (rev 0) +++ branches/unicode_buf/teraterm/teraterm/unicode/get_emoji_table.pl 2019-09-12 15:59:13 UTC (rev 8129) @@ -0,0 +1,29 @@ +#!/usr/bin/perl +use utf8; + +open(FILE, "emoji-data.txt") || die "Cannot open width file."; + +$block = 0; +while($a = <FILE>) { + if ($a =~ /^# ======/) { + $block = $block + 1; + if ($block == 2) { + exit(1); + } + } + + if ($a =~ /^([0-9A-F]+)\.\.([0-9A-F]+).+\)\s+(.+)$/) { + $start = hex $1; + $end = hex $2; + $comment = $3; + if ($start > 0x100) { + printf("{ 0x%06x, 0x%06x }, // %s\n", $start, $end, $comment); + } + } elsif ($a =~ /^([0-9A-F]+).+\)\s+(.+)$/) { + $start = hex $1; + $comment = $2; + if ($start > 0x100) { + printf("{ 0x%06x, 0x%06x }, // %s\n", $start, $start, $comment); + } + } +}