aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/gfx/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/gfx/text')
-rw-r--r--src/components/gfx/text/glyph.rs10
-rw-r--r--src/components/gfx/text/shaping/harfbuzz.rs8
-rw-r--r--src/components/gfx/text/text_run.rs6
-rw-r--r--src/components/gfx/text/util.rs6
4 files changed, 15 insertions, 15 deletions
diff --git a/src/components/gfx/text/glyph.rs b/src/components/gfx/text/glyph.rs
index 8e2e0bf8015..0baa11dff51 100644
--- a/src/components/gfx/text/glyph.rs
+++ b/src/components/gfx/text/glyph.rs
@@ -12,7 +12,7 @@ use std::num::NumCast;
use std::u16;
use std::vec;
use std::util;
-use std::iterator;
+use std::iter;
use geom::point::Point2D;
use extra::sort;
@@ -157,7 +157,7 @@ fn is_simple_glyph_id(glyphId: GlyphIndex) -> bool {
}
fn is_simple_advance(advance: Au) -> bool {
- let unsignedAu = advance.to_int() as u32;
+ let unsignedAu = advance.to_u32().unwrap();
(unsignedAu & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT)) == unsignedAu
}
@@ -169,7 +169,7 @@ impl GlyphEntry {
// getter methods
#[inline(always)]
fn advance(&self) -> Au {
- NumCast::from((self.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT)
+ NumCast::from((self.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT).unwrap()
}
fn index(&self) -> GlyphIndex {
@@ -678,8 +678,8 @@ impl<'self> GlyphStore {
pub struct GlyphIterator<'self> {
priv store: &'self GlyphStore,
priv char_index: uint,
- priv char_range: iterator::Range<uint>,
- priv glyph_range: Option<iterator::Range<uint>>,
+ priv char_range: iter::Range<uint>,
+ priv glyph_range: Option<iter::Range<uint>>,
}
impl<'self> Iterator<(uint, GlyphInfo<'self>)> for GlyphIterator<'self> {
diff --git a/src/components/gfx/text/shaping/harfbuzz.rs b/src/components/gfx/text/shaping/harfbuzz.rs
index cebc7360d9e..314fc975de9 100644
--- a/src/components/gfx/text/shaping/harfbuzz.rs
+++ b/src/components/gfx/text/shaping/harfbuzz.rs
@@ -145,7 +145,7 @@ pub struct Shaper {
#[unsafe_destructor]
impl Drop for Shaper {
#[fixed_stack_segment]
- fn drop(&self) {
+ fn drop(&mut self) {
unsafe {
assert!(self.hb_face.is_not_null());
hb_face_destroy(self.hb_face);
@@ -198,11 +198,11 @@ impl Shaper {
}
}
- fn float_to_fixed(f: float) -> i32 {
+ fn float_to_fixed(f: f64) -> i32 {
float_to_fixed(16, f)
}
- fn fixed_to_float(i: hb_position_t) -> float {
+ fn fixed_to_float(i: hb_position_t) -> f64 {
fixed_to_float(16, i)
}
@@ -350,7 +350,7 @@ impl Shaper {
if glyph_span.length() == 1 { break; }
// if no glyphs were found yet, extend the char byte range more.
- if glyph_span.length() == 0 { loop; }
+ if glyph_span.length() == 0 { continue; }
debug!("Complex (multi-glyph to multi-char) association found. This case \
probably doesn't work.");
diff --git a/src/components/gfx/text/text_run.rs b/src/components/gfx/text/text_run.rs
index 3ca1960921f..bc195005bf2 100644
--- a/src/components/gfx/text/text_run.rs
+++ b/src/components/gfx/text/text_run.rs
@@ -61,7 +61,7 @@ impl<'self> Iterator<(&'self GlyphStore, uint, Range)> for SliceIterator<'self>
let slice_range = Range::new(self.offset, slice_glyphs.char_len());
let mut char_range = self.range.intersect(&slice_range);
- char_range.shift_by(-(self.offset.to_int()));
+ char_range.shift_by(-(self.offset.to_int().unwrap()));
let old_offset = self.offset;
self.offset += slice_glyphs.char_len();
@@ -86,11 +86,11 @@ impl<'self> Iterator<Range> for LineIterator<'self> {
Some((glyphs, offset, slice_range)) => {
match (glyphs.is_whitespace(), self.clump) {
(false, Some(ref mut c)) => {
- c.extend_by(slice_range.length().to_int());
+ c.extend_by(slice_range.length().to_int().unwrap());
}
(false, None) => {
let mut c = slice_range;
- c.shift_by(offset.to_int());
+ c.shift_by(offset.to_int().unwrap());
self.clump = Some(c);
}
(true, None) => { /* chomp whitespace */ }
diff --git a/src/components/gfx/text/util.rs b/src/components/gfx/text/util.rs
index cca38493729..7b741e11a6f 100644
--- a/src/components/gfx/text/util.rs
+++ b/src/components/gfx/text/util.rs
@@ -95,12 +95,12 @@ pub fn transform_text(text: &str, mode: CompressionMode, incoming_whitespace: bo
}
}
-pub fn float_to_fixed(before: int, f: float) -> i32 {
+pub fn float_to_fixed(before: int, f: f64) -> i32 {
(1i32 << before) * (f as i32)
}
-pub fn fixed_to_float(before: int, f: i32) -> float {
- f as float * 1.0f / ((1i32 << before) as float)
+pub fn fixed_to_float(before: int, f: i32) -> f64 {
+ f as f64 * 1.0f64 / ((1i32 << before) as f64)
}
pub fn fixed_to_rounded_int(before: int, f: i32) -> int {