diff options
author | bors-servo <metajack+bors@gmail.com> | 2014-10-02 09:27:26 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2014-10-02 09:27:26 -0600 |
commit | adb428a725293fd639a0f188a32f3111ffca4d5b (patch) | |
tree | 8c10989c48a18726c17d94a6e2e00d8f3d72ea07 | |
parent | c7915028b498dc8426cdbb5b35f0ad270613a244 (diff) | |
parent | dbdfce06954997d27b8c38ffb965e96106212fe4 (diff) | |
download | servo-adb428a725293fd639a0f188a32f3111ffca4d5b.tar.gz servo-adb428a725293fd639a0f188a32f3111ffca4d5b.zip |
auto merge of #3560 : pcwalton/servo/subpixel-glyph-positioning, r=mbrubeck
Improves text rendering significantly.
r? @mbrubeck
-rw-r--r-- | components/gfx/display_list/mod.rs | 4 | ||||
-rw-r--r-- | components/util/geometry.rs | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 55829ae78d4..5025542765c 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -110,8 +110,8 @@ impl ScaledFontExtensionMethods for ScaledFont { let azglyph = struct__AzGlyph { mIndex: glyph.id() as uint32_t, mPosition: struct__AzPoint { - x: (origin.x + glyph_offset.x).to_nearest_px() as AzFloat, - y: (origin.y + glyph_offset.y).to_nearest_px() as AzFloat + x: (origin.x + glyph_offset.x).to_subpx() as AzFloat, + y: (origin.y + glyph_offset.y).to_subpx() as AzFloat } }; origin = Point2D(origin.x + glyph_advance, origin.y); diff --git a/components/util/geometry.rs b/components/util/geometry.rs index 0bf7cffe60c..d212992f6da 100644 --- a/components/util/geometry.rs +++ b/components/util/geometry.rs @@ -201,6 +201,12 @@ impl Au { } #[inline] + pub fn to_subpx(&self) -> f64 { + let Au(s) = *self; + (s as f64) / 60f64 + } + + #[inline] pub fn to_snapped(&self) -> Au { let Au(s) = *self; let res = s % 60i32; |