Commit 9832cff1 authored by mae's avatar mae
Browse files

Fix monospace font optimization on Mac OS X. Trouble on the mac

is that monospace is not exactly monospace, there can be a
fractional component.

Thanks to Andreas Kling <info@andreaskling.com> for spotting
this and providing a fix.
parent 0e351513
...@@ -126,6 +126,15 @@ void BinEditor::init() ...@@ -126,6 +126,15 @@ void BinEditor::init()
++hex; ++hex;
} }
if (m_isMonospacedFont && fm.width("M M ") != m_charWidth * 4) {
// On Qt/Mac, monospace font widths may have a fractional component
// This breaks the assumption that width("MMM") == width('M') * 3
m_isMonospacedFont = false;
m_columnWidth = fm.width("MMM");
m_labelWidth = fm.width("MMMM:MMMM:MMMM:MMMM");
}
horizontalScrollBar()->setRange(0, 2 * m_margin + 16 * m_columnWidth horizontalScrollBar()->setRange(0, 2 * m_margin + 16 * m_columnWidth
+ m_labelWidth + m_textWidth - viewport()->width()); + m_labelWidth + m_textWidth - viewport()->width());
horizontalScrollBar()->setPageStep(viewport()->width()); horizontalScrollBar()->setPageStep(viewport()->width());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment