mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Break text runs by unicode script
This commit is contained in:
parent
062493fac6
commit
371e6897e1
8 changed files with 51 additions and 1 deletions
|
@ -23,6 +23,7 @@ serde_macros = "0.5"
|
|||
smallvec = "0.1"
|
||||
string_cache = "0.1"
|
||||
time = "0.1.12"
|
||||
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../plugins"
|
||||
|
|
|
@ -18,6 +18,7 @@ use style::properties::style_structs::Font as FontStyle;
|
|||
use text::Shaper;
|
||||
use text::glyph::{GlyphId, GlyphStore};
|
||||
use text::shaping::ShaperMethods;
|
||||
use unicode_script::Script;
|
||||
use util::cache::HashCache;
|
||||
use util::geometry::Au;
|
||||
|
||||
|
@ -117,6 +118,8 @@ pub struct ShapingOptions {
|
|||
pub letter_spacing: Option<Au>,
|
||||
/// Spacing to add between each word. Corresponds to the CSS 2.1 `word-spacing` property.
|
||||
pub word_spacing: Au,
|
||||
/// The Unicode script property of the characters in this run.
|
||||
pub script: Script,
|
||||
/// Various flags.
|
||||
pub flags: ShapingFlags,
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ extern crate smallvec;
|
|||
extern crate string_cache;
|
||||
extern crate style;
|
||||
extern crate time;
|
||||
extern crate unicode_script;
|
||||
extern crate url;
|
||||
|
||||
|
||||
|
|
|
@ -215,6 +215,8 @@ impl ShaperMethods for Shaper {
|
|||
HB_DIRECTION_LTR
|
||||
});
|
||||
|
||||
hb_buffer_set_script(hb_buffer, options.script.to_hb_script());
|
||||
|
||||
hb_buffer_add_utf8(hb_buffer,
|
||||
text.as_ptr() as *const c_char,
|
||||
text.len() as c_int,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue