Add some debugging for mulitple glyph cases in shaper and glyph storage.

This commit is contained in:
Brian J. Burg 2012-11-15 09:46:59 -08:00
parent b4943a6298
commit 80aa0e904d
2 changed files with 13 additions and 1 deletions

View file

@ -307,6 +307,8 @@ impl DetailedGlyphStore {
detail_offset: self.detail_buffer.len() detail_offset: self.detail_buffer.len()
}; };
debug!("Adding entry[off=%u] for detailed glyphs: %?", entry_offset, glyphs);
/* TODO: don't actually assert this until asserts are compiled /* TODO: don't actually assert this until asserts are compiled
in/out based on severity, debug/release, etc. This assertion in/out based on severity, debug/release, etc. This assertion
would wreck the complexity of the lookup. would wreck the complexity of the lookup.
@ -325,6 +327,8 @@ impl DetailedGlyphStore {
// not pure; may perform a deferred sort. // not pure; may perform a deferred sort.
fn get_detailed_glyphs_for_entry(&self, entry_offset: uint, count: u16) -> &[DetailedGlyph] { fn get_detailed_glyphs_for_entry(&self, entry_offset: uint, count: u16) -> &[DetailedGlyph] {
debug!("Requesting detailed glyphs[n=%u] for entry[off=%u]", count as uint, entry_offset);
assert count > 0; assert count > 0;
assert (count as uint) <= self.detail_buffer.len(); assert (count as uint) <= self.detail_buffer.len();
self.ensure_sorted(); self.ensure_sorted();
@ -503,6 +507,8 @@ impl GlyphStore {
} }
}; };
//debug!("Adding single glyph[idx=%u]: %?", i, entry);
self.entry_buffer.set_elt(i, entry); self.entry_buffer.set_elt(i, entry);
} }
@ -529,6 +535,8 @@ impl GlyphStore {
} }
}; };
debug!("Adding multiple glyphs[idx=%u, count=%u]: %?", i, glyph_count, entry);
self.entry_buffer.set_elt(i, entry); self.entry_buffer.set_elt(i, entry);
} }

View file

@ -102,7 +102,6 @@ pub impl HarfbuzzShaper {
when rendered in a specific font. when rendered in a specific font.
*/ */
pub fn shape_text(text: &str, glyphs: &GlyphStore) { pub fn shape_text(text: &str, glyphs: &GlyphStore) {
debug!("shaping text '%s'", text);
let hb_buffer: *hb_buffer_t = hb_buffer_create(); let hb_buffer: *hb_buffer_t = hb_buffer_create();
hb_buffer_set_direction(hb_buffer, HB_DIRECTION_LTR); hb_buffer_set_direction(hb_buffer, HB_DIRECTION_LTR);
@ -124,6 +123,11 @@ pub impl HarfbuzzShaper {
let pos_buf = hb_buffer_get_glyph_positions(hb_buffer, to_unsafe_ptr(&pos_buf_len)); let pos_buf = hb_buffer_get_glyph_positions(hb_buffer, to_unsafe_ptr(&pos_buf_len));
assert pos_buf.is_not_null(); assert pos_buf.is_not_null();
debug!("Shaped text[len=%u], got back %u glyph info records.", text.len(), info_buf_len as uint);
if text.len() != info_buf_len as uint {
debug!("Since these are not equal, we probably have been given some complex glyphs!");
}
assert info_buf_len == pos_buf_len; assert info_buf_len == pos_buf_len;
for uint::range(0u, info_buf_len as uint) |i| { unsafe { for uint::range(0u, info_buf_len as uint) |i| { unsafe {