diff options
author | Ito Hiroyuki <ZXB01226@nifty.com> | 2010-07-25 09:55:05 +0000 |
---|---|---|
committer | Ito Hiroyuki <ZXB01226@nifty.com> | 2010-07-25 09:55:05 +0000 |
commit | e2782c2ae915a60778c3c43804926f1efc92cc6a (patch) | |
tree | d1195dc29ff2c4b4c859634b670b03549c34367b /libwc/ucs.c | |
parent | [w3m-dev 04326] suppress compile warnings. (diff) | |
download | w3m-e2782c2ae915a60778c3c43804926f1efc92cc6a.tar.gz w3m-e2782c2ae915a60778c3c43804926f1efc92cc6a.zip |
* merge ambiguous width patch
* http://www.j10n.org/files/w3m-cvs-1.914-ambwidth.patch
Diffstat (limited to 'libwc/ucs.c')
-rw-r--r-- | libwc/ucs.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libwc/ucs.c b/libwc/ucs.c index 2534b5a..3645456 100644 --- a/libwc/ucs.c +++ b/libwc/ucs.c @@ -17,6 +17,7 @@ #include "ucs.map" +#include "map/ucs_ambwidth.map" #include "map/ucs_wide.map" #include "map/ucs_combining.map" #include "map/ucs_precompose.map" @@ -511,11 +512,26 @@ wc_ucs_to_ccs(wc_uint32 ucs) if (0x80 <= ucs && ucs <= 0x9F) return WC_CCS_C1; return ((ucs <= WC_C_UCS2_END) ? WC_CCS_UCS2 : WC_CCS_UCS4) + | ((WcOption.east_asian_width && wc_is_ucs_ambiguous_width(ucs)) + ? WC_CCS_A_WIDE : 0) | (wc_is_ucs_wide(ucs) ? WC_CCS_A_WIDE : 0) | (wc_is_ucs_combining(ucs) ? WC_CCS_A_COMB : 0); } wc_bool +wc_is_ucs_ambiguous_width(wc_uint32 ucs) +{ + if (0xa1 <= ucs && ucs <= 0xfe && WcOption.use_jisx0213) + return 1; + else if (ucs <= WC_C_UCS2_END) + return (wc_map_range_search((wc_uint16)ucs, + ucs_ambwidth_map, N_ucs_ambwidth_map) != NULL); + else + return ((0xF0000 <= ucs && ucs <= 0xFFFFD) + || (0x100000 <= ucs && ucs <= 0x10FFFD)); +} + +wc_bool wc_is_ucs_wide(wc_uint32 ucs) { if (ucs <= WC_C_UCS2_END) |