mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Use byte indices instead of char indices for text runs
Replace character indices with UTF-8 byte offsets throughout the code dealing with text shaping and breaking. This eliminates a lot of complexity when converting from one to the other, and interoperates better with the rest of the Rust ecosystem.
This commit is contained in:
parent
dba878dfb2
commit
659305fe0a
15 changed files with 259 additions and 437 deletions
|
@ -43,7 +43,7 @@ use style::computed_values::{border_style, filter, image_rendering, mix_blend_mo
|
|||
use style::properties::{ComputedValues};
|
||||
use style_traits::cursor::Cursor;
|
||||
use text::TextRun;
|
||||
use text::glyph::CharIndex;
|
||||
use text::glyph::ByteIndex;
|
||||
use util::geometry::{self, MAX_RECT, ScreenPx};
|
||||
use util::print_tree::PrintTree;
|
||||
use webrender_traits::{self, WebGLContextId};
|
||||
|
@ -989,7 +989,7 @@ pub struct TextDisplayItem {
|
|||
pub text_run: Arc<TextRun>,
|
||||
|
||||
/// The range of text within the text run.
|
||||
pub range: Range<CharIndex>,
|
||||
pub range: Range<ByteIndex>,
|
||||
|
||||
/// The color of the text.
|
||||
pub text_color: Color,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue