From c69567406e32521b504f4e20e1be75177a4d47ee Mon Sep 17 00:00:00 2001 From: Vee Satayamas Date: Wed, 17 Aug 2016 18:57:19 +0700 Subject: Fix #12193 Servo displays upper level Thai character in wrong place. --- components/gfx/text/glyph.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'components/gfx/text') diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index 73a66ff19bf..ea5a009959e 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -254,10 +254,10 @@ impl<'a> DetailedGlyphStore { let i = self.detail_lookup.binary_search(&key) .expect("Invalid index not found in detailed glyph lookup table!"); - - assert!(i + (count as usize) <= self.detail_buffer.len()); + let main_detail_offset = self.detail_lookup[i].detail_offset; + assert!(main_detail_offset + (count as usize) <= self.detail_buffer.len()); // return a slice into the buffer - &self.detail_buffer[i .. i + count as usize] + &self.detail_buffer[main_detail_offset .. main_detail_offset + count as usize] } fn detailed_glyph_with_index(&'a self, @@ -274,9 +274,9 @@ impl<'a> DetailedGlyphStore { let i = self.detail_lookup.binary_search(&key) .expect("Invalid index not found in detailed glyph lookup table!"); - - assert!(i + (detail_offset as usize) < self.detail_buffer.len()); - &self.detail_buffer[i + (detail_offset as usize)] + let main_detail_offset = self.detail_lookup[i].detail_offset; + assert!(main_detail_offset + (detail_offset as usize) < self.detail_buffer.len()); + &self.detail_buffer[main_detail_offset + (detail_offset as usize)] } fn ensure_sorted(&mut self) { -- cgit v1.2.3