Implementation of BFont::Blocks
BFont::Blocks is now implemented in ServerFont, via a call through the app_server. It uses fontconfig to iterate through a charset of a font and stores the defined blocks in a bitmap. A new API was added, BFont::IncludesBlock, that will allow for arbitrary testing of a given Unicode block. Since nothing is cached, searching through an entire charset for a series of Unicode blocks can be quite slow. In a given block there may be only 1 or 2 characters actually defined so every character within a block needs to be checked until one is found, which in a degenerate case will mean the entire block is checked. Signed-off-by: Axel Dörfler <[email protected]>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2015, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2005-2016, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _FONT_H_
|
||||
@@ -120,6 +120,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
struct unicode_block_range {
|
||||
uint32 start;
|
||||
uint32 end;
|
||||
const unicode_block& block;
|
||||
|
||||
uint32 Count() const { return end + 1 - start; }
|
||||
};
|
||||
|
||||
|
||||
struct edge_info {
|
||||
float left;
|
||||
float right;
|
||||
@@ -201,6 +210,7 @@ public:
|
||||
bool IsFullAndHalfFixed() const;
|
||||
BRect BoundingBox() const;
|
||||
unicode_block Blocks() const;
|
||||
bool IncludesBlock(uint32 start, uint32 end) const;
|
||||
font_file_format FileFormat() const;
|
||||
|
||||
int32 CountTuned() const;
|
||||
@@ -371,6 +381,7 @@ unicode_block::operator=(const unicode_block& block)
|
||||
{
|
||||
fData[0] = block.fData[0];
|
||||
fData[1] = block.fData[1];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user