diff options
author | Peng Wu <alexepico@gmail.com> | 2015-06-16 10:45:57 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2015-06-16 10:45:57 +0800 |
commit | a08ea7202399af9f077c23418554956cf83e489d (patch) | |
tree | 5249cfd1c916c7746725557de422457c3f3d5833 /src | |
parent | db2781ac9ffca8d2fa818af616b8da92c6eeb1f9 (diff) | |
download | libzhuyin-a08ea7202399af9f077c23418554956cf83e489d.tar.gz libzhuyin-a08ea7202399af9f077c23418554956cf83e489d.tar.xz libzhuyin-a08ea7202399af9f077c23418554956cf83e489d.zip |
fixes first tone
Diffstat (limited to 'src')
-rw-r--r-- | src/storage/pinyin_parser2.cpp | 6 | ||||
-rw-r--r-- | src/storage/pinyin_parser2.h | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp index f78653f..bdbe385 100644 --- a/src/storage/pinyin_parser2.cpp +++ b/src/storage/pinyin_parser2.cpp @@ -132,6 +132,9 @@ gchar * _ChewingKey::get_bopomofo_string() { if (CHEWING_ZERO_TONE == m_tone) { return g_strdup(item.m_bopomofo); + } else if (CHEWING_1 == m_tone) { + /* for first tone, usually not display it. */ + return g_strdup(item.m_bopomofo); } else { return g_strdup_printf("%s%s", item.m_bopomofo, chewing_tone_table[m_tone]); @@ -1263,7 +1266,8 @@ bool ChewingDirectParser2::parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const { options &= ~ZHUYIN_AMB_ALL; - unsigned char tone = CHEWING_ZERO_TONE; + /* by default, chewing will use the first tone. */ + unsigned char tone = CHEWING_1; if (0 == len) return false; diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h index 72635c0..9b9d78e 100644 --- a/src/storage/pinyin_parser2.h +++ b/src/storage/pinyin_parser2.h @@ -388,8 +388,12 @@ inline int pinyin_compare_middle_and_final2(pinyin_option_t options, inline int pinyin_compare_tone2(pinyin_option_t options, ChewingTone lhs, ChewingTone rhs) { +#if 0 if (lhs == rhs) return 0; +#endif + if (options & FORCE_TONE) + return (lhs - rhs); if (lhs == CHEWING_ZERO_TONE) return 0; if (rhs == CHEWING_ZERO_TONE) |