|
20 | 20 |
|
21 | 21 | MythFontProperties::MythFontProperties() : |
22 | 22 | m_brush(QColor(Qt::white)), m_hasShadow(false), m_shadowAlpha(255), |
23 | | - m_hasOutline(false), m_outlineAlpha(255), m_bFreeze(false) |
| 23 | + m_hasOutline(false), m_outlineAlpha(255), m_bFreeze(false), m_stretch(100) |
24 | 24 | { |
25 | 25 | CalcHash(); |
26 | 26 | } |
@@ -129,11 +129,21 @@ void MythFontProperties::Rescale(void) |
129 | 129 | Rescale(rect.height()); |
130 | 130 | } |
131 | 131 |
|
| 132 | +void MythFontProperties::AdjustStretch(int stretch) |
| 133 | +{ |
| 134 | + int newStretch = (int)(((float)m_stretch * ((float)stretch / 100.0f)) + 0.5f); |
| 135 | + |
| 136 | + if (newStretch <= 0) |
| 137 | + newStretch = 1; |
| 138 | + |
| 139 | + m_face.setStretch(newStretch); |
| 140 | +} |
| 141 | + |
132 | 142 | void MythFontProperties::SetPixelSize(float size) |
133 | 143 | { |
134 | 144 | QSize baseSize = GetMythUI()->GetBaseSize(); |
135 | 145 | m_relativeSize = size / (float)(baseSize.height()); |
136 | | - m_face.setPixelSize(GetMythMainWindow()->NormY((int)(size + 0.5))); |
| 146 | + m_face.setPixelSize(GetMythMainWindow()->NormY((int)(size + 0.5f))); |
137 | 147 | } |
138 | 148 |
|
139 | 149 | void MythFontProperties::SetPointSize(uint points) |
@@ -359,33 +369,35 @@ MythFontProperties *MythFontProperties::ParseFromXml( |
359 | 369 |
|
360 | 370 | if (stretch == "ultracondensed" || |
361 | 371 | stretch == "1") |
362 | | - newFont->m_face.setStretch(QFont::UltraCondensed); |
| 372 | + newFont->m_stretch = QFont::UltraCondensed; |
363 | 373 | else if (stretch == "extracondensed" || |
364 | 374 | stretch == "2") |
365 | | - newFont->m_face.setStretch(QFont::ExtraCondensed); |
| 375 | + newFont->m_stretch = QFont::ExtraCondensed; |
366 | 376 | else if (stretch == "condensed" || |
367 | 377 | stretch == "3") |
368 | | - newFont->m_face.setStretch(QFont::Condensed); |
| 378 | + newFont->m_stretch = QFont::Condensed; |
369 | 379 | else if (stretch == "semicondensed" || |
370 | 380 | stretch == "4") |
371 | | - newFont->m_face.setStretch(QFont::SemiCondensed); |
| 381 | + newFont->m_stretch = QFont::SemiCondensed; |
372 | 382 | else if (stretch == "unstretched" || |
373 | 383 | stretch == "5") |
374 | | - newFont->m_face.setStretch(QFont::Unstretched); |
| 384 | + newFont->m_stretch = QFont::Unstretched; |
375 | 385 | else if (stretch == "semiexpanded" || |
376 | 386 | stretch == "6") |
377 | | - newFont->m_face.setStretch(QFont::SemiExpanded); |
| 387 | + newFont->m_stretch = QFont::SemiExpanded; |
378 | 388 | else if (stretch == "expanded" || |
379 | 389 | stretch == "7") |
380 | | - newFont->m_face.setStretch(QFont::Expanded); |
| 390 | + newFont->m_stretch = QFont::Expanded; |
381 | 391 | else if (stretch == "extraexpanded" || |
382 | 392 | stretch == "8") |
383 | | - newFont->m_face.setStretch(QFont::ExtraExpanded); |
| 393 | + newFont->m_stretch = QFont::ExtraExpanded; |
384 | 394 | else if (stretch == "ultraexpanded" || |
385 | 395 | stretch == "9") |
386 | | - newFont->m_face.setStretch(QFont::UltraExpanded); |
| 396 | + newFont->m_stretch = QFont::UltraExpanded; |
387 | 397 | else |
388 | | - newFont->m_face.setStretch(QFont::Unstretched); |
| 398 | + newFont->m_stretch = QFont::Unstretched; |
| 399 | + |
| 400 | + newFont->m_face.setStretch(newFont->m_stretch); |
389 | 401 | } |
390 | 402 | else |
391 | 403 | { |
|
0 commit comments