CodePudding user response:
int nIndex=QFontDatabase: : addApplicationFont ("./Resources/msyh. The vera.ttf ");
If (nIndex!=1)
{
QStringList strList (QFontDatabase: : applicationFontFamilies (nIndex));
If (strList. The count () & gt; 0)
{
QFont fontThis (strList) at (0));
FontThis. SetPointSize (9);
A.s etFont (fontThis);
}
}
CodePudding user response:
Tips: the font file copy and paste to the system font folder,The control panel with the font to open the system font folder,
CodePudding user response:
# include "Windows. H"
# pragma comment (lib, "Gdi32. Lib")
Int ret=AddFontResourceA (LPCSTR Arg1);//parameter Arg1 "font file path
"//support the file type. Fon. FNT. The vera.ttf. TTC. Fot. Otf. MMM. PFB. PFM