one , describe

1, establish QFont Object time , You can specify the various properties you want the font to have .Qt The font with the specified attribute will be used , Or if there is no matching font ,Qt The most matching installed font will be used . The font properties actually used can be found from  
QFontInfo  Object retrieval . use  QFontMetricsF  Get measured value , for example , use QFontMetrics::width() Gets the pixel length of the string .

2, To load a specific physical font ( Usually represented by a single file ), Please use  QRawFont.

3, Must exist QGuiApplication Instance can only be used QFont. have access to  QGuiApplication::setFont() Sets the default font for the application .

4, If the selected font does not contain all the characters that need to be displayed ,QFont Attempts to find characters in the closest equivalent font . When QPainter
When drawing characters from a font , If there is no such character ,QPainter An unfilled square is drawn .

5, The overhead of loading fonts can be expensive .QFont Contains a large number of optimizations , Can copy quickly QFont object .

two , Type member

1,QFont::Capitalization: Font case policy

* MixedCase: Normal text rendering , Keep it as it is .
* AllUppercase: All text is rendered in uppercase .
* AllLowercase: All contents of the text are rendered in lowercase .
* SmallCaps: The text is rendered in substantially lowercase .

* Capitalize: The first letter of each word is capitalized .
2,QFont::SpacingType: Spacing type

* PercentageSpacing: value 100 The spacing will remain the same ; value 200 After, the space between characters is expanded to the width of the character itself .

* AbsoluteSpacing: Positive values increase the letter spacing of the corresponding pixel ; Negative values reduce spacing .( The apparent value is the pixel value of the interval )

 3,QFont::Stretch: Stretch type ( Stretching factor ). follow CSS Predefined stretch values for naming conventions . The higher the value , The more stretched the text is .( The default value is 0)

* AnyStretch:0
* UltraCondensed:50
* ExtraCondensed:62
* Condensed:75
* SemiCondensed:87
* Unstretched:100
* SemiExpanded:112
* Expanded:125
* ExtraExpanded:150
* UltraExpanded:200

4,QFont::Style: Font style .

* StyleNormal: normal .
* StyleItalic: Italics .
* StyleOblique: oblique .( Not as oblique as italics )
5,QFont::Weight: Weight type .Qt Use from 0 reach 99 Weighted proportion of , Weight is 0 Indicates thin , and 99 Indicates extreme darkness .

* Thin:0
* ExtraLight:12
* Light:25
* Normal:50
* Medium:57
* DemiBold:63
* Bold:75
* ExtraBold:81
* Black:87
three , Member function

1,bool bold()

Is it bold . If the value of the weight >  QFont::Medium return true, Otherwise return false.

2,QFont::Capitalization capitalization()

Get case policy .

3,QString defaultFamily() 

4,bool exactMatch()

If a system font that exactly matches the settings of this font is available , Then return true.

5,bool fixedPitch()

Is a fixed font width set .

6,bool isCopyOf(const QFont &f)

If this font and f Are copies of each other , That is, one is created as a copy of the other , And it hasn't been modified since , Then return true.

7,bool italic()

If the font style is not QFont::StyleNormal, Then return true.( That is, italics )

8,bool kerning()

If use kerning is set , Then return true.

9,qreal letterSpacing()

Get letter spacing .

10,QFont::SpacingType letterSpacingType()

Gets the type of spacing setting .

11,bool overline()

Is the upper dash set .

12,int pixelSize()

* If the font is setPixelSize() Set , Returns the pixel size of the font .
* If the size is in setPointSize() or setPointSizeF() Set , Then return -1.
13,int pointSize()

Returns the point size of the font . If you specify the font size in pixels , Then return -1.

14,qreal pointSizeF()

Returns the point size of the font . If you specify the font size in pixels , Then return -1.

15,QFont resolve(const QFont &other)

Returns a new QFont, Should QFont Contains properties copied from other fonts .

16,void setBold(bool enable)

Set whether to bold , It's actually a setup QFont::Bold and QFont::Normal.

19,void setItalic(bool enable)

Sets whether to use italics . It's actually a setup QFont::StyleNormal / QFont::StyleItalic.

20,void setPixelSize(int pixelSize)

Set font size to pixel size . Use this function to make the font device dependent ( Different devices have different resolutions ).

21,void setPointSize(int pointSize)

Sets the point size of the font . The point size must be greater than zero .

22,void setPointSizeF(qreal pointSize)

ditto , However, not all platforms support this accuracy .

23,bool strikeOut()

Is a strikethrough set .

24,bool underline()

Is underline set .

25,qreal wordSpacing()

Gets the spacing between words .

four , Related nonmember functions

1,uint qHash(const QFont &font, uint seed = 0)

Gets the hash value of the font .(QFont The hash value changes as the setting of changes )