1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-12 14:11:10 +02:00

2nd try at getting the TimeTextControl font correct.

This commit is contained in:
lllucius 2014-10-07 21:27:55 +00:00
parent 6fd448d1be
commit 08a3c2672c

View File

@ -1056,18 +1056,18 @@ bool TimeTextCtrl::Layout()
wxString exampleText = wxT("0"); wxString exampleText = wxT("0");
// Keep making the font bigger until it's too big, then subtract one. // Keep making the font bigger until it's too big, then subtract one.
memDC.SetFont(wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); memDC.SetFont(wxFont(fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
memDC.GetTextExtent(exampleText, &strW, &strH); memDC.GetTextExtent(exampleText, &strW, &strH);
while(strW <= mDigitBoxW && strH <= mDigitBoxH) { while(strW <= mDigitBoxW && strH <= mDigitBoxH) {
fontSize++; fontSize++;
memDC.SetFont(wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); memDC.SetFont(wxFont(fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
memDC.GetTextExtent(exampleText, &strW, &strH); memDC.GetTextExtent(exampleText, &strW, &strH);
} }
fontSize--; fontSize--;
if (mDigitFont) if (mDigitFont)
delete mDigitFont; delete mDigitFont;
mDigitFont = new wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); mDigitFont = new wxFont(fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
memDC.SetFont(*mDigitFont); memDC.SetFont(*mDigitFont);
memDC.GetTextExtent(exampleText, &strW, &strH); memDC.GetTextExtent(exampleText, &strW, &strH);
mDigitW = strW; mDigitW = strW;
@ -1077,7 +1077,7 @@ bool TimeTextCtrl::Layout()
fontSize--; fontSize--;
if (mLabelFont) if (mLabelFont)
delete mLabelFont; delete mLabelFont;
mLabelFont = new wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); mLabelFont = new wxFont(fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
// Figure out the x-position of each field and label in the box // Figure out the x-position of each field and label in the box
x = mBorderLeft; x = mBorderLeft;