aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2014-07-08 07:44:05 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2014-07-08 07:44:05 +1000
commit0c3cb39da39d010cb2bb08e6c6e50178d17e3e36 (patch)
treee634e93e6d904401350cfaa2b602cd9daa425564 /src
parent12978eeb50d8f727bc020bcdd0534e80d7890c7f (diff)
downloadservo-0c3cb39da39d010cb2bb08e6c6e50178d17e3e36.tar.gz
servo-0c3cb39da39d010cb2bb08e6c6e50178d17e3e36.zip
Address review comments.
Diffstat (limited to 'src')
-rw-r--r--src/components/gfx/font.rs2
-rw-r--r--src/components/gfx/font_template.rs4
-rw-r--r--src/components/gfx/platform/android/font.rs48
-rw-r--r--src/components/gfx/platform/linux/font.rs48
4 files changed, 48 insertions, 54 deletions
diff --git a/src/components/gfx/font.rs b/src/components/gfx/font.rs
index 2630b018190..a17bf199979 100644
--- a/src/components/gfx/font.rs
+++ b/src/components/gfx/font.rs
@@ -109,8 +109,6 @@ pub struct Font {
impl Font {
pub fn shape_text(&mut self, text: String, is_whitespace: bool) -> Arc<GlyphStore> {
-
- //FIXME (ksh8281)
self.make_shaper();
let shaper = &self.shaper;
self.shape_cache.find_or_create(&text, |txt| {
diff --git a/src/components/gfx/font_template.rs b/src/components/gfx/font_template.rs
index 3ca9aff4e45..2bd6a1270d2 100644
--- a/src/components/gfx/font_template.rs
+++ b/src/components/gfx/font_template.rs
@@ -37,8 +37,8 @@ impl PartialEq for FontTemplateDescriptor {
}
/// This describes all the information needed to create
-/// font instance handles. It contains a unique that is
-/// platform specific.
+/// font instance handles. It contains a unique
+/// FontTemplateData structure that is platform specific.
pub struct FontTemplate {
identifier: String,
descriptor: Option<FontTemplateDescriptor>,
diff --git a/src/components/gfx/platform/android/font.rs b/src/components/gfx/platform/android/font.rs
index 3e060c0fb58..9e393733c69 100644
--- a/src/components/gfx/platform/android/font.rs
+++ b/src/components/gfx/platform/android/font.rs
@@ -39,9 +39,7 @@ fn fixed_to_float_ft(f: i32) -> f64 {
fixed_to_float(6, f)
}
-pub struct FontTable {
- _bogus: ()
-}
+pub struct FontTable;
impl FontTableMethods for FontTable {
fn with_buffer(&self, _blk: |*u8, uint|) {
@@ -95,28 +93,28 @@ impl FontHandleMethods for FontHandle {
Err(()) => Err(())
};
- fn create_face_from_buffer(lib: FT_Library, cbuf: *u8, cbuflen: uint, pt_size: Option<f64>)
- -> Result<FT_Face, ()> {
- unsafe {
- let mut face: FT_Face = ptr::null();
- let face_index = 0 as FT_Long;
- let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long,
- face_index, &mut face);
-
- if !result.succeeded() || face.is_null() {
- return Err(());
- }
- let is_ok = match pt_size {
- Some(s) => FontHandle::set_char_size(face, s).is_ok(),
- None => true,
- };
- if is_ok {
- Ok(face)
- } else {
- Err(())
- }
- }
- }
+ fn create_face_from_buffer(lib: FT_Library, cbuf: *u8, cbuflen: uint, pt_size: Option<f64>)
+ -> Result<FT_Face, ()> {
+ unsafe {
+ let mut face: FT_Face = ptr::null();
+ let face_index = 0 as FT_Long;
+ let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long,
+ face_index, &mut face);
+
+ if !result.succeeded() || face.is_null() {
+ return Err(());
+ }
+ match pt_size {
+ Some(s) => {
+ match FontHandle::set_char_size(face, s) {
+ Ok(_) => Ok(face),
+ Err(_) => Err(()),
+ }
+ }
+ None => Ok(face),
+ }
+ }
+ }
}
fn get_template(&self) -> Arc<FontTemplateData> {
self.font_data.clone()
diff --git a/src/components/gfx/platform/linux/font.rs b/src/components/gfx/platform/linux/font.rs
index 3e060c0fb58..9e393733c69 100644
--- a/src/components/gfx/platform/linux/font.rs
+++ b/src/components/gfx/platform/linux/font.rs
@@ -39,9 +39,7 @@ fn fixed_to_float_ft(f: i32) -> f64 {
fixed_to_float(6, f)
}
-pub struct FontTable {
- _bogus: ()
-}
+pub struct FontTable;
impl FontTableMethods for FontTable {
fn with_buffer(&self, _blk: |*u8, uint|) {
@@ -95,28 +93,28 @@ impl FontHandleMethods for FontHandle {
Err(()) => Err(())
};
- fn create_face_from_buffer(lib: FT_Library, cbuf: *u8, cbuflen: uint, pt_size: Option<f64>)
- -> Result<FT_Face, ()> {
- unsafe {
- let mut face: FT_Face = ptr::null();
- let face_index = 0 as FT_Long;
- let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long,
- face_index, &mut face);
-
- if !result.succeeded() || face.is_null() {
- return Err(());
- }
- let is_ok = match pt_size {
- Some(s) => FontHandle::set_char_size(face, s).is_ok(),
- None => true,
- };
- if is_ok {
- Ok(face)
- } else {
- Err(())
- }
- }
- }
+ fn create_face_from_buffer(lib: FT_Library, cbuf: *u8, cbuflen: uint, pt_size: Option<f64>)
+ -> Result<FT_Face, ()> {
+ unsafe {
+ let mut face: FT_Face = ptr::null();
+ let face_index = 0 as FT_Long;
+ let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long,
+ face_index, &mut face);
+
+ if !result.succeeded() || face.is_null() {
+ return Err(());
+ }
+ match pt_size {
+ Some(s) => {
+ match FontHandle::set_char_size(face, s) {
+ Ok(_) => Ok(face),
+ Err(_) => Err(()),
+ }
+ }
+ None => Ok(face),
+ }
+ }
+ }
}
fn get_template(&self) -> Arc<FontTemplateData> {
self.font_data.clone()