mirror of https://github.com/koreader/koreader
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
6f1b70e5eb
Previously the CJK character detection defined only characters in the range U+4000..U+AFFF as "CJK characters". This excludes an incredibly large number of CJK characters within the BMP, let alone the whole two planes dedicated to rarer CJK characters (the SIP and TIP). As a result, a very large number of Chinese, Japanese, and Korean characters were not detected as being CJK characters. While slightly less elegant-looking, it is far more accurate to compute the codepoint from the utf8 character and then see if it falls within one of the defined CJK blocks. This is not future-proof against future CJK ideograph extensions in future Unicode versions, but there is no real way to accurately predict such changes so this is the best we can do without accidentally treating characters explicitily defined as being non-CJK in Unicode as CJK. While we're at it, copy Lua 5.3's utf8.charpattern constant definition so that we can more easily write utf8 iterators with string.gmatch (at least in the interim until there is a rework of utf8 handling in KOReader and everything is rebuilt on top of utf8proc). Some unit tests are added for Korean and Japanese text, and the existing unit tests needed a minor adjustment to handle the fact that isSplittable now correctly detects CJK punctuation as a character to compare against the forbidden split rules. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> |
3 years ago | |
---|---|---|
.. | ||
autofrontlight_spec.lua | 3 years ago | |
autosuspend_spec.lua | 3 years ago | |
background_runner_spec.lua | 3 years ago | |
background_task_plugin_spec.lua | 4 years ago | |
batterystat_spec.lua | 5 years ago | |
benchmark.lua | 7 years ago | |
cache_spec.lua | 3 years ago | |
commonrequire.lua | 3 years ago | |
dbg_spec.lua | 7 years ago | |
defaults_spec.lua | 3 years ago | |
depgraph_spec.lua | 4 years ago | |
device_spec.lua | 3 years ago | |
docsettings_spec.lua | 5 years ago | |
document_registry_spec.lua | 4 years ago | |
document_spec.lua | 4 years ago | |
eink_optimization_spec.lua | 6 years ago | |
exporter_plugin_main_spec.lua | 3 years ago | |
filemanager_spec.lua | 3 years ago | |
filemanagerconverter_spec.lua | 3 years ago | |
focusmanager_spec.lua | 6 years ago | |
font_spec.lua | 8 years ago | |
frontlight_spec.lua | 5 years ago | |
gesturedetector_spec.lua | 4 years ago | |
gesturerange_spec.lua | 7 years ago | |
gettext_spec.lua | 4 years ago | |
hook_container_spec.lua | 7 years ago | |
httpclient_spec.lua | 7 years ago | |
imagewidget_spec.lua | 3 years ago | |
input_spec.lua | 3 years ago | |
inputtext_spec.lua | 6 years ago | |
koptinterface_spec.lua | 3 years ago | |
kosync_spec.lua | 5 years ago | |
luadata_spec.lua | 3 years ago | |
luasettings_spec.lua | 3 years ago | |
menu_table_screen_color_spec.lua | 5 years ago | |
menusorter_spec.lua | 4 years ago | |
mock_time.lua | 3 years ago | |
mock_time_spec.lua | 7 years ago | |
network_manager_spec.lua | 5 years ago | |
networksetting_spec.lua | 4 years ago | |
nickel_conf_spec.lua | 5 years ago | |
opds_spec.lua | 3 years ago | |
optmath_spec.lua | 6 years ago | |
persist_spec.lua | 3 years ago | |
quickstart_spec.lua | 7 years ago | |
random_spec.lua | 8 years ago | |
readerbookmark_spec.lua | 3 years ago | |
readerdictionary_spec.lua | 3 years ago | |
readerfooter_spec.lua | 3 years ago | |
readerhighlight_spec.lua | 3 years ago | |
readerlink_spec.lua | 3 years ago | |
readerpaging_spec.lua | 3 years ago | |
readerrolling_spec.lua | 3 years ago | |
readersearch_spec.lua | 3 years ago | |
readertoc_spec.lua | 3 years ago | |
readerui_spec.lua | 3 years ago | |
readerview_spec.lua | 3 years ago | |
readhistory_spec.lua | 3 years ago | |
screenshoter_spec.lua | 3 years ago | |
size_spec.lua | 7 years ago | |
spore_spec.lua | 7 years ago | |
switch_plugin_spec.lua | 7 years ago | |
textboxwidget_spec.lua | 5 years ago | |
timeval_spec.lua | 3 years ago | |
toggleswitch_spec.lua | 5 years ago | |
touch_probe_spec.lua | 7 years ago | |
translator_spec.lua | 6 years ago | |
uimanager_bench.lua | 7 years ago | |
uimanager_spec.lua | 3 years ago | |
util_spec.lua | 3 years ago | |
version_spec.lua | 3 years ago | |
wakeupmgr_spec.lua | 5 years ago | |
widget_inputcontainer_spec.lua | 4 years ago | |
widget_menu_spec.lua | 4 years ago | |
widget_progresswidget_spec.lua | 7 years ago | |
wikipedia_spec.lua | 7 years ago |