Table Of Contents

Previous topic

QFontMetrics

Next topic

QFontDatabase

QFontInfo

Inheritance diagram of QFontInfo

Synopsis

Functions

Detailed Description

The PySide.QtGui.QFontInfo class provides general information about fonts.

The PySide.QtGui.QFontInfo class provides the same access functions as PySide.QtGui.QFont , e.g. PySide.QtGui.QFontInfo.family() , PySide.QtGui.QFontInfo.pointSize() , PySide.QtGui.QFontInfo.italic() , PySide.QtGui.QFontInfo.weight() , PySide.QtGui.QFontInfo.fixedPitch() , PySide.QtGui.QFontInfo.styleHint() etc. But whilst the PySide.QtGui.QFont access functions return the values that were set, a PySide.QtGui.QFontInfo object returns the values that apply to the font that will actually be used to draw the text.

For example, when the program asks for a 25pt Courier font on a machine that has a non-scalable 24pt Courier font, PySide.QtGui.QFont will (normally) use the 24pt Courier for rendering. In this case, QFont.pointSize() returns 25 and QFontInfo.pointSize() returns 24.

There are three ways to create a PySide.QtGui.QFontInfo object.

class PySide.QtGui.QFontInfo(arg__1)
class PySide.QtGui.QFontInfo(arg__1)
Parameters:arg__1PySide.QtGui.QFont

Constructs a font info object for font .

The font must be screen-compatible, i.e. a font you use when drawing text in widgets or pixmaps , not PySide.QtGui.QPicture or PySide.QtGui.QPrinter .

The font info object holds the information for the font that is passed in the constructor at the time it is created, and is not updated if the font’s attributes are changed later.

Use QPainter.fontInfo() to get the font info when painting. This will give correct results also when painting on paint device that is not screen-compatible.

Constructs a copy of fi .

PySide.QtGui.QFontInfo.bold()
Return type:PySide.QtCore.bool

Returns true if PySide.QtGui.QFontInfo.weight() would return a value greater than QFont.Normal ; otherwise returns false.

PySide.QtGui.QFontInfo.exactMatch()
Return type:PySide.QtCore.bool

Returns true if the matched window system font is exactly the same as the one specified by the font; otherwise returns false.

PySide.QtGui.QFontInfo.family()
Return type:unicode

Returns the family name of the matched window system font.

See also

QFont.family()

PySide.QtGui.QFontInfo.fixedPitch()
Return type:PySide.QtCore.bool

Returns the fixed pitch value of the matched window system font.

PySide.QtGui.QFontInfo.italic()
Return type:PySide.QtCore.bool

Returns the italic value of the matched window system font.

See also

QFont.italic()

PySide.QtGui.QFontInfo.overline()
Return type:PySide.QtCore.bool

Returns the overline value of the matched window system font.

Here we read the overline flag directly from the PySide.QtGui.QFont . This is OK for X11 and for Windows because we always get what we want.

See also

QFont.overline()

PySide.QtGui.QFontInfo.pixelSize()
Return type:PySide.QtCore.int

Returns the pixel size of the matched window system font.

PySide.QtGui.QFontInfo.pointSize()
Return type:PySide.QtCore.int

Returns the point size of the matched window system font.

PySide.QtGui.QFontInfo.pointSizeF()
Return type:PySide.QtCore.qreal

Returns the point size of the matched window system font.

PySide.QtGui.QFontInfo.rawMode()
Return type:PySide.QtCore.bool

Returns true if the font is a raw mode font; otherwise returns false.

If it is a raw mode font, all other functions in PySide.QtGui.QFontInfo will return the same values set in the PySide.QtGui.QFont , regardless of the font actually used.

See also

QFont.rawMode()

PySide.QtGui.QFontInfo.strikeOut()
Return type:PySide.QtCore.bool

Returns the strikeout value of the matched window system font.

This is OK for X11 and for Windows because we always get what we want.

PySide.QtGui.QFontInfo.style()
Return type:PySide.QtGui.QFont.Style

Returns the style value of the matched window system font.

See also

QFont.style()

PySide.QtGui.QFontInfo.styleHint()
Return type:PySide.QtGui.QFont.StyleHint

Returns the style of the matched window system font.

Currently only returns the style hint set in PySide.QtGui.QFont .

See also

QFont.styleHint() QFont.StyleHint

PySide.QtGui.QFontInfo.underline()
Return type:PySide.QtCore.bool

Returns the underline value of the matched window system font.

Here we read the underline flag directly from the PySide.QtGui.QFont . This is OK for X11 and for Windows because we always get what we want.

PySide.QtGui.QFontInfo.weight()
Return type:PySide.QtCore.int

Returns the weight of the matched window system font.