mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Basic support for bidirectional text
This commit is contained in:
parent
b386d7ae44
commit
dfac8ce4a1
20 changed files with 309 additions and 107 deletions
|
@ -5,14 +5,14 @@
|
|||
extern crate harfbuzz;
|
||||
|
||||
use font::{DISABLE_KERNING_SHAPING_FLAG, Font, FontHandleMethods, FontTableMethods, FontTableTag};
|
||||
use font::{IGNORE_LIGATURES_SHAPING_FLAG, ShapingOptions};
|
||||
use font::{IGNORE_LIGATURES_SHAPING_FLAG, RTL_FLAG, ShapingOptions};
|
||||
use platform::font::FontTable;
|
||||
use text::glyph::{CharIndex, GlyphStore, GlyphId, GlyphData};
|
||||
use text::shaping::ShaperMethods;
|
||||
use text::util::{float_to_fixed, fixed_to_float};
|
||||
|
||||
use euclid::Point2D;
|
||||
use harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR};
|
||||
use harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR, HB_DIRECTION_RTL};
|
||||
use harfbuzz::{RUST_hb_blob_create, RUST_hb_face_create_for_tables};
|
||||
use harfbuzz::{hb_blob_t};
|
||||
use harfbuzz::{hb_bool_t};
|
||||
|
@ -229,7 +229,11 @@ impl ShaperMethods for Shaper {
|
|||
fn shape_text(&self, text: &str, options: &ShapingOptions, glyphs: &mut GlyphStore) {
|
||||
unsafe {
|
||||
let hb_buffer: *mut hb_buffer_t = RUST_hb_buffer_create();
|
||||
RUST_hb_buffer_set_direction(hb_buffer, HB_DIRECTION_LTR);
|
||||
RUST_hb_buffer_set_direction(hb_buffer, if options.flags.contains(RTL_FLAG) {
|
||||
HB_DIRECTION_RTL
|
||||
} else {
|
||||
HB_DIRECTION_LTR
|
||||
});
|
||||
|
||||
RUST_hb_buffer_add_utf8(hb_buffer,
|
||||
text.as_ptr() as *const c_char,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue