Skip to content

Commit

Permalink
Adjusted script detection per PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wojciechowski committed Nov 1, 2016
1 parent 893d46c commit 85abbdc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
14 changes: 7 additions & 7 deletions js/util/is_char_in_unicode_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = {
// 'Buhid': (char) => char >= 0x1740 && char <= 0x175F,
// 'Tagbanwa': (char) => char >= 0x1760 && char <= 0x177F,
// 'Khmer': (char) => char >= 0x1780 && char <= 0x17FF,
'Mongolian': (char) => char >= 0x1800 && char <= 0x18AF,
// 'Mongolian': (char) => char >= 0x1800 && char <= 0x18AF,
// 'Unified Canadian Aboriginal Syllabics Extended': (char) => char >= 0x18B0 && char <= 0x18FF,
// 'Limbu': (char) => char >= 0x1900 && char <= 0x194F,
// 'Tai Le': (char) => char >= 0x1950 && char <= 0x197F,
Expand Down Expand Up @@ -109,10 +109,10 @@ module.exports = {
'CJK Symbols and Punctuation': (char) => char >= 0x3000 && char <= 0x303F,
'Hiragana': (char) => char >= 0x3040 && char <= 0x309F,
'Katakana': (char) => char >= 0x30A0 && char <= 0x30FF,
// 'Bopomofo': (char) => char >= 0x3100 && char <= 0x312F,
'Bopomofo': (char) => char >= 0x3100 && char <= 0x312F,
'Hangul Compatibility Jamo': (char) => char >= 0x3130 && char <= 0x318F,
// 'Kanbun': (char) => char >= 0x3190 && char <= 0x319F,
// 'Bopomofo Extended': (char) => char >= 0x31A0 && char <= 0x31BF,
'Kanbun': (char) => char >= 0x3190 && char <= 0x319F,
'Bopomofo Extended': (char) => char >= 0x31A0 && char <= 0x31BF,
'CJK Strokes': (char) => char >= 0x31C0 && char <= 0x31EF,
'Katakana Phonetic Extensions': (char) => char >= 0x31F0 && char <= 0x31FF,
'Enclosed CJK Letters and Months': (char) => char >= 0x3200 && char <= 0x32FF,
Expand All @@ -135,7 +135,7 @@ module.exports = {
// 'Devanagari Extended': (char) => char >= 0xA8E0 && char <= 0xA8FF,
// 'Kayah Li': (char) => char >= 0xA900 && char <= 0xA92F,
// 'Rejang': (char) => char >= 0xA930 && char <= 0xA95F,
// 'Hangul Jamo Extended-A': (char) => char >= 0xA960 && char <= 0xA97F,
'Hangul Jamo Extended-A': (char) => char >= 0xA960 && char <= 0xA97F,
// 'Javanese': (char) => char >= 0xA980 && char <= 0xA9DF,
// 'Myanmar Extended-B': (char) => char >= 0xA9E0 && char <= 0xA9FF,
// 'Cham': (char) => char >= 0xAA00 && char <= 0xAA5F,
Expand All @@ -147,7 +147,7 @@ module.exports = {
// 'Cherokee Supplement': (char) => char >= 0xAB70 && char <= 0xABBF,
// 'Meetei Mayek': (char) => char >= 0xABC0 && char <= 0xABFF,
'Hangul Syllables': (char) => char >= 0xAC00 && char <= 0xD7AF,
// 'Hangul Jamo Extended-B': (char) => char >= 0xD7B0 && char <= 0xD7FF,
'Hangul Jamo Extended-B': (char) => char >= 0xD7B0 && char <= 0xD7FF,
// 'High Surrogates': (char) => char >= 0xD800 && char <= 0xDB7F,
// 'High Private Use Surrogates': (char) => char >= 0xDB80 && char <= 0xDBFF,
// 'Low Surrogates': (char) => char >= 0xDC00 && char <= 0xDFFF,
Expand All @@ -156,7 +156,7 @@ module.exports = {
// 'Alphabetic Presentation Forms': (char) => char >= 0xFB00 && char <= 0xFB4F,
// 'Arabic Presentation Forms-A': (char) => char >= 0xFB50 && char <= 0xFDFF,
// 'Variation Selectors': (char) => char >= 0xFE00 && char <= 0xFE0F,
// 'Vertical Forms': (char) => char >= 0xFE10 && char <= 0xFE1F,
'Vertical Forms': (char) => char >= 0xFE10 && char <= 0xFE1F,
// 'Combining Half Marks': (char) => char >= 0xFE20 && char <= 0xFE2F,
'CJK Compatibility Forms': (char) => char >= 0xFE30 && char <= 0xFE4F,
// 'Small Form Variants': (char) => char >= 0xFE50 && char <= 0xFE6F,
Expand Down
13 changes: 11 additions & 2 deletions js/util/script_detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ module.exports.charAllowsIdeographicBreaking = function(char) {
// Return early for characters outside all ideographic ranges.
if (char < 0x2E80) return false;

if (isChar['Bopomofo Extended'](char)) return true;
if (isChar['Bopomofo'](char)) return true;
if (isChar['CJK Compatibility Forms'](char)) return true;
if (isChar['CJK Compatibility Ideographs'](char)) return true;
if (isChar['CJK Compatibility'](char)) return true;
if (isChar['CJK Radicals Supplement'](char)) return true;
if (isChar['CJK Strokes'](char)) return true;
if (isChar['CJK Symbols and Punctuation'](char)) return true;
if (isChar['CJK Unified Ideographs Extension A']) return true;
if (isChar['CJK Unified Ideographs Extension A'](char)) return true;
if (isChar['CJK Unified Ideographs'](char)) return true;
if (isChar['Enclosed CJK Letters and Months'](char)) return true;
if (isChar['Halfwidth and Fullwidth Forms'](char)) return true;
Expand All @@ -36,6 +38,7 @@ module.exports.charAllowsIdeographicBreaking = function(char) {
if (isChar['Kangxi Radicals'](char)) return true;
if (isChar['Katakana Phonetic Extensions'](char)) return true;
if (isChar['Katakana'](char)) return true;
if (isChar['Vertical Forms'](char)) return true;
if (isChar['Yi Radicals'](char)) return true;
if (isChar['Yi Syllables'](char)) return true;

Expand All @@ -46,23 +49,29 @@ function charAllowsVerticalWritingMode(char) {
// Return early for characters outside all ideographic ranges.
if (char < 0x2E80) return false;

if (isChar['Bopomofo Extended'](char)) return true;
if (isChar['Bopomofo'](char)) return true;
if (isChar['CJK Compatibility Forms'](char)) return true;
if (isChar['CJK Compatibility Ideographs'](char)) return true;
if (isChar['CJK Compatibility'](char)) return true;
if (isChar['CJK Radicals Supplement'](char)) return true;
if (isChar['CJK Strokes'](char)) return true;
if (isChar['CJK Symbols and Punctuation'](char)) return true;
if (isChar['CJK Unified Ideographs Extension A']) return true;
if (isChar['CJK Unified Ideographs Extension A'](char)) return true;
if (isChar['CJK Unified Ideographs'](char)) return true;
if (isChar['Enclosed CJK Letters and Months'](char)) return true;
if (isChar['Hangul Compatibility Jamo'](char)) return true;
if (isChar['Hangul Jamo Extended-A'](char)) return true;
if (isChar['Hangul Jamo Extended-B'](char)) return true;
if (isChar['Hangul Jamo'](char)) return true;
if (isChar['Hangul Syllables'](char)) return true;
if (isChar['Hiragana'](char)) return true;
if (isChar['Ideographic Description Characters'](char)) return true;
if (isChar['Kanbun'](char)) return true;
if (isChar['Kangxi Radicals'](char)) return true;
if (isChar['Katakana Phonetic Extensions'](char)) return true;
if (isChar['Katakana'](char)) return true;
if (isChar['Vertical Forms'](char)) return true;

if (isCharFullwidthForm(char)) return true;

Expand Down

0 comments on commit 85abbdc

Please sign in to comment.