KFontUtils
KFontUtils Namespace Reference
Typedefs | |
typedef QFlags< AdaptFontSizeOption > | AdaptFontSizeOptions |
Enumerations | |
enum | AdaptFontSizeOption { NoFlags = 0x01 , DoNotAllowWordWrap = 0x02 } |
Functions | |
qreal KGUIADDONS_EXPORT | adaptFontSize (QPainter &painter, const QString &text, const QSizeF &availableSize, qreal maxFontSize=28.0, qreal minFontSize=1.0, AdaptFontSizeOptions flags=NoFlags) |
qreal KGUIADDONS_EXPORT | adaptFontSize (QPainter &painter, const QString &text, qreal width, qreal height, qreal maxFontSize=28.0, qreal minFontSize=1.0, AdaptFontSizeOptions flags=NoFlags) |
Detailed Description
Provides utility functions for font data.
Typedef Documentation
◆ AdaptFontSizeOptions
Stores a combination of AdaptFontSizeOption values.
Definition at line 35 of file kfontutils.h.
Enumeration Type Documentation
◆ AdaptFontSizeOption
Modifiers for the adaptFontSize function.
- See also
- AdaptFontSizeOptions
Enumerator | |
---|---|
NoFlags | No modifier. |
DoNotAllowWordWrap | Do not use word wrapping. |
Definition at line 28 of file kfontutils.h.
Function Documentation
◆ adaptFontSize() [1/2]
qreal KFontUtils::adaptFontSize | ( | QPainter & | painter, |
const QString & | text, | ||
const QSizeF & | availableSize, | ||
qreal | maxFontSize = 28.0, | ||
qreal | minFontSize = 1.0, | ||
AdaptFontSizeOptions | flags = NoFlags ) |
Convenience function for adaptFontSize that accepts a QSizeF instead two qreals.
- Since
- 4.7
Definition at line 82 of file kfontutils.cpp.
◆ adaptFontSize() [2/2]
qreal KFontUtils::adaptFontSize | ( | QPainter & | painter, |
const QString & | text, | ||
qreal | width, | ||
qreal | height, | ||
qreal | maxFontSize = 28.0, | ||
qreal | minFontSize = 1.0, | ||
AdaptFontSizeOptions | flags = NoFlags ) |
Helper function that calculates the biggest font size (in points) used drawing a centered text using word wrapping.
- Parameters
-
painter The painter where the text will be painted. The font set in the painter is used for the calculation. Note the painter font size is modified by this call text The text you want to draw width The available width for drawing height The available height for drawing maxFontSize The maximum font size (in points) to consider minFontSize The minimum font size (in points) to consider flags The modifiers for how the text is painted
- Returns
- The calculated biggest font size (in points) that draws the text in the given dimensions. Can return smaller than minFontSize, that means the text doesn't fit in the given rectangle. Can return -1 on error
- Since
- 4.7
Definition at line 30 of file kfontutils.cpp.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:51:16 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:51:16 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.