mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
allow max font size to be defined by user (#2488)
This commit is contained in:
parent
1cc50b2793
commit
a2a7561613
5 changed files with 25 additions and 4 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <QCursor>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#ifdef _WIN32
|
||||
#include "round.h"
|
||||
#endif /* _WIN32 */
|
||||
|
|
@ -66,6 +67,9 @@ QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
|
|||
|
||||
void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &translatedSize, int angle)
|
||||
{
|
||||
const int MAX_FONT_SIZE = settingsCache->getMaxFontSize();
|
||||
const int fontSize = std::max(9, MAX_FONT_SIZE);
|
||||
|
||||
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
|
||||
|
||||
painter->resetTransform();
|
||||
|
|
@ -77,9 +81,6 @@ void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &transla
|
|||
painter->setTransform(pixmapTransform);
|
||||
|
||||
QFont f;
|
||||
int fontSize = round(translatedSize.height() / 8);
|
||||
if (fontSize < 9)
|
||||
fontSize = 9;
|
||||
f.setPixelSize(fontSize);
|
||||
|
||||
painter->setFont(f);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue