KD Reports API Documentation 2.2
Loading...
Searching...
No Matches
KDReportsFontScaler_p.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of the KD Reports library.
4**
5** SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6**
7** SPDX-License-Identifier: MIT
8**
9****************************************************************************/
10
11#ifndef FONTSCALER_P_H
12#define FONTSCALER_P_H
13
14#include "KDReportsGlobal.h"
15#include <QFont>
16#include <QFontMetricsF>
17
18//
19// W A R N I N G
20// -------------
21//
22// This file is not part of the KD Reports API. It exists purely as an
23// implementation detail. This header file may change from version to
24// version without notice, or even be removed.
25//
26// We mean it.
27//
28//
29
30// Enable this to get debug output about the layouting
31// (font scaling, table layout, spreadsheet layout)
32// #define DEBUG_LAYOUT
33
34namespace KDReports {
35
37{
38public:
39 explicit FontScaler(const QFont &initialFont);
40
41 void setFontAndScalingFactor(const QFont &font, qreal scalingFactor);
42
43 void setFactorForHeight(qreal wantedHeight);
44 void setFactorForWidth(qreal wantedFactor, const QString &sampleText);
45 void applyAdditionalScalingFactor(qreal factor);
46
47 QFont font() const
48 {
49 return m_font;
50 }
52 {
53 return m_fontMetrics;
54 }
55 qreal scalingFactor() const
56 {
57 return m_scalingFactor;
58 }
60 {
61 return m_initialFontMetrics;
62 }
63 qreal textWidth(const QString &text) const;
64
65private:
66 QFont m_font;
67 QFontMetricsF m_fontMetrics;
68 QFontMetricsF m_initialFontMetrics;
69 qreal m_scalingFactor;
70};
71
72}
73
74#endif /* FONTSCALER_P_H */
#define KDREPORTS_EXPORT
QFontMetricsF initialFontMetrics() const
QFontMetricsF fontMetrics() const

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-reports/
Generated on Wed Apr 24 2024 04:08:14 for KD Reports API Documentation by doxygen 1.9.8