mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
fonts: Consider Tertiary Ideographic Plane to be CJK (#31670)
* added check for Tertiary Ideographic Plane * added unit test for is_cjk function Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> * fixed formatting Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> * removed for loop assertions & added TIP chars Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> --------- Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> Co-authored-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local>
This commit is contained in:
parent
55bb289b30
commit
94c1f2c992
2 changed files with 22 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use gfx::text::util::{transform_text, CompressionMode};
|
||||
use gfx::text::util::{is_cjk, transform_text, CompressionMode};
|
||||
|
||||
#[test]
|
||||
fn test_transform_compress_none() {
|
||||
|
@ -104,3 +104,22 @@ fn test_transform_compress_whitespace_newline_no_incoming() {
|
|||
assert_eq!(trimmed_str, oracle)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_cjk() {
|
||||
// Test characters from different CJK blocks
|
||||
assert_eq!(is_cjk('〇'), true);
|
||||
assert_eq!(is_cjk('㐀'), true);
|
||||
assert_eq!(is_cjk('あ'), true);
|
||||
assert_eq!(is_cjk('ア'), true);
|
||||
assert_eq!(is_cjk('㆒'), true);
|
||||
assert_eq!(is_cjk('ㆣ'), true);
|
||||
assert_eq!(is_cjk('龥'), true);
|
||||
assert_eq!(is_cjk('𰾑'), true);
|
||||
assert_eq!(is_cjk('𰻝'), true);
|
||||
|
||||
// Test characters from outside CJK blocks
|
||||
assert_eq!(is_cjk('a'), false);
|
||||
assert_eq!(is_cjk('🙂'), false);
|
||||
assert_eq!(is_cjk('©'), false);
|
||||
}
|
||||
|
|
|
@ -149,5 +149,6 @@ pub fn is_cjk(codepoint: char) -> bool {
|
|||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Plane_(Unicode)#Supplementary_Ideographic_Plane
|
||||
unicode_plane(codepoint) == 2
|
||||
// https://en.wikipedia.org/wiki/Plane_(Unicode)#Tertiary_Ideographic_Plane
|
||||
unicode_plane(codepoint) == 2 || unicode_plane(codepoint) == 3
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue