Skip to content

Commit

Permalink
fix pango-related font rendering bug (closes #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
misson20000 committed Aug 4, 2024
1 parent e68ef2d commit b36dab7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/view/gsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ impl Cache {
}

pub fn begin_text<'a>(pg: &'a pango::Context, font: &'a pango::Font, color: &'a gdk::RGBA, text: &'a str, pos: &'a mut graphene::Point) -> TextBuilder<'a, impl std::iter::DoubleEndedIterator<Item = pango::GlyphString> + 'a> {
let old_desc = pg.font_description();
pg.set_font_description(Some(&font.describe()));
let items = pango::itemize(pg, text, 0, text.len() as i32, &pango::AttrList::new(), None);
pg.set_font_description(old_desc.as_ref());

TextBuilder {
iterator: items.into_iter().map(|item| {
Expand Down

0 comments on commit b36dab7

Please sign in to comment.