Move hb_tag! macro and KERN into font module

This commit is contained in:
Matt Brubeck 2016-05-18 10:50:31 -07:00
parent 1eab6fbb2e
commit 0010b448b8
3 changed files with 11 additions and 11 deletions

View file

@ -24,6 +24,14 @@ use unicode_script::Script;
use util::cache::HashCache; use util::cache::HashCache;
use webrender_traits; use webrender_traits;
macro_rules! ot_tag {
($t1:expr, $t2:expr, $t3:expr, $t4:expr) => (
(($t1 as u32) << 24) | (($t2 as u32) << 16) | (($t3 as u32) << 8) | ($t4 as u32)
);
}
pub const KERN: u32 = ot_tag!('k', 'e', 'r', 'n');
static TEXT_SHAPING_PERFORMANCE_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; static TEXT_SHAPING_PERFORMANCE_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
// FontHandle encapsulates access to the platform's font API, // FontHandle encapsulates access to the platform's font API,

View file

@ -95,7 +95,7 @@ mod paint_context;
pub mod display_list; pub mod display_list;
// Fonts // Fonts
pub mod font; #[macro_use] pub mod font;
pub mod font_cache_thread; pub mod font_cache_thread;
pub mod font_context; pub mod font_context;
pub mod font_template; pub mod font_template;

View file

@ -5,7 +5,7 @@
use app_units::Au; use app_units::Au;
use euclid::Point2D; use euclid::Point2D;
use font::{DISABLE_KERNING_SHAPING_FLAG, Font, FontTableMethods, FontTableTag}; use font::{DISABLE_KERNING_SHAPING_FLAG, Font, FontTableMethods, FontTableTag};
use font::{IGNORE_LIGATURES_SHAPING_FLAG, RTL_FLAG, ShapingOptions}; use font::{IGNORE_LIGATURES_SHAPING_FLAG, KERN, RTL_FLAG, ShapingOptions};
use harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY}; use harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY};
use harfbuzz::{hb_blob_create, hb_face_create_for_tables}; use harfbuzz::{hb_blob_create, hb_face_create_for_tables};
use harfbuzz::{hb_blob_t}; use harfbuzz::{hb_blob_t};
@ -39,16 +39,8 @@ use text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use text::shaping::ShaperMethods; use text::shaping::ShaperMethods;
use text::util::{fixed_to_float, float_to_fixed, is_bidi_control}; use text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
macro_rules! hb_tag {
($t1:expr, $t2:expr, $t3:expr, $t4:expr) => (
(($t1 as u32) << 24) | (($t2 as u32) << 16) | (($t3 as u32) << 8) | ($t4 as u32)
);
}
const NO_GLYPH: i32 = -1; const NO_GLYPH: i32 = -1;
const LIGA: u32 = ot_tag!('l', 'i', 'g', 'a');
static KERN: u32 = hb_tag!('k', 'e', 'r', 'n');
static LIGA: u32 = hb_tag!('l', 'i', 'g', 'a');
pub struct ShapedGlyphData { pub struct ShapedGlyphData {
count: usize, count: usize,