CharacterMap: fix block filter

Some of the Unicode blocks correspond to the union of two blocks as
defined in BeOS (for example, "Arabic" includes B_BASIC_ARABIC_BLOCK and
B_ARABIC_EXTENDED_BLOCK), making the `Includes` test inadequate.

Change-Id: Ib1a358f6be8a8f517c6b8a3642536b3e75d365a4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7828
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Máximo Castañeda
2024-07-06 13:12:21 +00:00
committed by Jérôme Duval
parent 66ee6532aa
commit 36087e77db
2 changed files with 10 additions and 14 deletions
+5 -7
View File
@@ -97,17 +97,15 @@ CharacterView::IsShowingBlock(int32 blockIndex) const
if (!fShowPrivateBlocks && kUnicodeBlocks[blockIndex].private_block)
return false;
// the reason for two checks is BeOS compatibility.
// The Includes method checks for unicode blocks as
// defined by Be, but there are only 71 such blocks.
// The reason for two checks is BeOS compatibility.
// The first one checks for unicode blocks as defined by Be,
// but there are only 71 such blocks.
// The rest of the blocks (denoted by kNoBlock) need to
// be queried by searching for the start and end codepoints
// via the IncludesBlock method.
if (fShowContainedBlocksOnly) {
if (kUnicodeBlocks[blockIndex].block != kNoBlock
&& !fUnicodeBlocks.Includes(
kUnicodeBlocks[blockIndex].block))
return false;
if (kUnicodeBlocks[blockIndex].block != kNoBlock)
return (fUnicodeBlocks & kUnicodeBlocks[blockIndex].block) != kNoBlock;
if (!fCharacterFont.IncludesBlock(
kUnicodeBlocks[blockIndex].start,
+5 -7
View File
@@ -84,17 +84,15 @@ UnicodeBlockView::IsShowingBlock(int32 blockIndex) const
if (!fShowPrivateBlocks && kUnicodeBlocks[blockIndex].private_block)
return false;
// the reason for two checks is BeOS compatibility.
// The Includes method checks for unicode blocks as
// defined by Be, but there are only 71 such blocks.
// The reason for two checks is BeOS compatibility.
// The first one checks for unicode blocks as defined by Be,
// but there are only 71 such blocks.
// The rest of the blocks (denoted by kNoBlock) need to
// be queried by searching for the start and end codepoints
// via the IncludesBlock method.
if (fShowContainedBlocksOnly) {
if (kUnicodeBlocks[blockIndex].block != kNoBlock
&& !fUnicodeBlocks.Includes(
kUnicodeBlocks[blockIndex].block))
return false;
if (kUnicodeBlocks[blockIndex].block != kNoBlock)
return (fUnicodeBlocks & kUnicodeBlocks[blockIndex].block) != kNoBlock;
if (!fCharacterFont.IncludesBlock(
kUnicodeBlocks[blockIndex].start,