1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Handle all the whitespaces the same way when creating text chunks

This commit is contained in:
Calixte Denizet 2022-01-07 21:20:53 +01:00
parent 9bb636402a
commit 9dae421a0d
3 changed files with 27 additions and 11 deletions

View file

@ -1640,7 +1640,17 @@ function reverseIfRtl(chars) {
return buf.join("");
}
const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})$", "u");
function getCharUnicodeCategory(char) {
const groups = char.match(SpecialCharRegExp);
return {
isWhitespace: !!(groups && groups[1]),
isDiacritic: !!(groups && groups[2]),
};
}
export {
getCharUnicodeCategory,
getNormalizedUnicodes,
getUnicodeForGlyph,
getUnicodeRangeFor,