Make some Font fields private

This commit is contained in:
Matt Brubeck 2016-05-13 16:33:20 -07:00
parent 4361f92067
commit 1c5ec6f3ec
2 changed files with 29 additions and 21 deletions

View file

@ -95,12 +95,35 @@ pub struct Font {
pub descriptor: FontTemplateDescriptor,
pub requested_pt_size: Au,
pub actual_pt_size: Au,
pub shaper: Option<Shaper>,
pub shape_cache: HashCache<ShapeCacheEntry, Arc<GlyphStore>>,
pub glyph_advance_cache: HashCache<u32, FractionalPixel>,
shaper: Option<Shaper>,
shape_cache: HashCache<ShapeCacheEntry, Arc<GlyphStore>>,
glyph_advance_cache: HashCache<u32, FractionalPixel>,
pub font_key: Option<webrender_traits::FontKey>,
}
impl Font {
pub fn new(handle: FontHandle,
variant: font_variant::T,
descriptor: FontTemplateDescriptor,
requested_pt_size: Au,
actual_pt_size: Au,
font_key: Option<webrender_traits::FontKey>) -> Font {
let metrics = handle.metrics();
Font {
handle: handle,
shaper: None,
variant: variant,
descriptor: descriptor,
requested_pt_size: requested_pt_size,
actual_pt_size: actual_pt_size,
metrics: metrics,
shape_cache: HashCache::new(),
glyph_advance_cache: HashCache::new(),
font_key: font_key,
}
}
}
bitflags! {
pub flags ShapingFlags: u8 {
#[doc = "Set if the text is entirely whitespace."]
@ -130,7 +153,7 @@ pub struct ShapingOptions {
/// An entry in the shape cache.
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub struct ShapeCacheEntry {
struct ShapeCacheEntry {
text: String,
options: ShapingOptions,
}