Skip to content

Commit

Permalink
Expand dubious character ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed May 23, 2024
1 parent 83c02c2 commit 7c348c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/formats/opentype/characters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ fn compress(ranges: Vec<(u32, u32)>) -> Result<Vec<Character>> {
}
if start == end {
values.push(Character::Scalar(start));
} else if start as usize + 1 == end as usize {
values.push(Character::Scalar(start));
values.push(Character::Scalar(end));
} else {
values.push(Character::Range(start, end));
}
Expand Down
29 changes: 19 additions & 10 deletions tests/characters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,23 @@ fn adobe_blank() {
"174–328",
"330–382",
"393",
"416–417",
"431–432",
"416",
"417",
"431",
"432",
"461–468",
"470–476",
"482–483",
"482",
"483",
"507–511",
"536–539",
"562–563",
"562",
"563",
"567",
"598",
"700",
"710–711",
"710",
"711",
"728–733",
"768–780",
"786",
Expand All @@ -62,7 +67,8 @@ fn adobe_blank() {
"8228",
"8230",
"8240",
"8242–8243",
"8242",
"8243",
"8248–8250",
"8254",
"8260",
Expand All @@ -76,14 +82,17 @@ fn adobe_blank() {
"8721–8723",
"8725",
"8730",
"8733–8734",
"8733",
"8734",
"8800",
"8804–8805",
"8804",
"8805",
"9753",
"10087",
"63632–63640",
"63642–63647",
"64257–64258",
]
"64257",
"64258",
],
);
}

0 comments on commit 7c348c0

Please sign in to comment.