Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.15.8, 6.7.2
-
None
-
Windows /Linux/ macOS
Description
I added the Poppins-Light.ttf font to the application and noticed that this font has a different name on Windows than on macOS
The simple code below returns:
"Poppins Light" under Windows
"Poppins" under macOS and linux
#include <QFontDatabase> #include <QApplication> #include <QDebug> int main(int argc, char *argv[]){ QApplication a(argc, argv); int fid= QFontDatabase::addApplicationFont(":/fonts/Poppins-Light.ttf"); qDebug() << "font #" << fid << "families=" << QFontDatabase::applicationFontFamilies(fid); return a.exec(); }
The Poppins is a popular font provided by Google, you can download it from: fonts.google.com/specimen/Poppins .
This is a big problem because the font name is used in many places in the stylesheets.
I wouldn't want to create different styles depending on the operating system
Attached are photos of the font preview in Windows/Linux/Mac, on all systems the font is called "Poppins Light".
Why does Qt say it's called "Poppins"? (macOS and Linux only)
If there is no way to get the correct font name, consider adding an additional parameter to the function and let me determine it myself