From cdc59fe68a4b3fbe0e8336c1b39270d434c3bba4 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 1 Oct 2014 22:07:10 -0700 Subject: [PATCH] gfx: Fix imprecision in `float_to_fixed`. Improves text rendering a lot. --- components/gfx/text/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/gfx/text/util.rs b/components/gfx/text/util.rs index 9aee736df61..23b8b029144 100644 --- a/components/gfx/text/util.rs +++ b/components/gfx/text/util.rs @@ -110,7 +110,7 @@ pub fn transform_text(text: &str, mode: CompressionMode, } pub fn float_to_fixed(before: int, f: f64) -> i32 { - (1i32 << before as uint) * (f as i32) + ((1i32 << before as uint) as f64 * f) as i32 } pub fn fixed_to_float(before: int, f: i32) -> f64 {