diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index 814bc5991..deb7f350c 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -1845,6 +1845,7 @@ wxFont& TFontId::Font(wxDC* dc) const { const wxSize ppi = dc->GetPPI(); dPrintScale = ppi.x / 96.0; // First guess for scaling factor + int nLastTextWidth = 0; int nBestSize = 0; double nMin = dPrintScale-0.1; @@ -1858,9 +1859,19 @@ wxFont& TFontId::Font(wxDC* dc) const wxFont courier(nFontSize, wxMODERN, wxNORMAL, wxNORMAL); dc->SetFont(courier); int tw; dc->GetTextExtent("0123456789", &tw, NULL); + if (tw != nLastTextWidth) + nLastTextWidth = tw; // Happens with Generic/Text Only + else + { + if (nBestSize == 0) + nBestSize = nFontSize; + break; + } if (tw > ppi.x) + { nMax = nScale; + } else { nMin = nScale;