Skip to content

Commit

Permalink
Mild tweaks to baseline calculation for LaTeX math
Browse files Browse the repository at this point in the history
  • Loading branch information
blackhole89 committed Jul 21, 2020
1 parent 978f2cf commit af3eb0a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions imagewidgets.cpp
Expand Up @@ -131,10 +131,14 @@ CLatexWidget::CLatexWidget(Glib::RefPtr<Gdk::Window> wnd, Glib::ustring text, Gd
18 / 3.f,
clr);

float h = r->getHeight(), w = r->getWidth();

SetSize(r->getWidth()+4,r->getHeight()+2);
SetSize(w+4,h+2);

baseline=(int)(round(1.5+(r->getHeight())*(1.0-r->getBaseline())));
baseline=(int)(round((2.5+(h)*(1.0f-r->getBaseline()))));

// workaround for not entirely correct baseline arithmetic
if(h<12) baseline-=1;

Graphics2D_cairo g2(image_ctx);
r->draw(g2,2,1);
Expand Down

0 comments on commit af3eb0a

Please sign in to comment.