Macos QRawFont::fromFont无法正常工作
我在Mac OS X 10.6.3的Qt上发现了一些错误:Macos QRawFont::fromFont无法正常工作,macos,qt,Macos,Qt,我在Mac OS X 10.6.3的Qt上发现了一些错误: QFont font = QFont("Wingdings"); //font.family() == "Wingdings" QRawFont rawFont = QRawFont::fromFont(font); //rawFont.familyName() == "Lucida Grande" 我认为rawFont.familyName()应该是“Wingdings”。 在Windows上,此代码正常工作 我试过这个
QFont font = QFont("Wingdings"); //font.family() == "Wingdings"
QRawFont rawFont = QRawFont::fromFont(font); //rawFont.familyName() == "Lucida Grande"
我认为rawFont.familyName()应该是“Wingdings”。
在Windows上,此代码正常工作
我试过这个方法:
QRawFont ( const QString & fileName, qreal pixelSize, QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting )
在字体文件上,它可以正常工作
我真的不知道怎么纠正这个。
非常感谢您的帮助。您可能发现了一个bug
如果您查看,您将看到:
[...]
#if defined(Q_WS_MAC)
QTextLayout layout(QFontDatabase::writingSystemSample(writingSystem), font);
layout.beginLayout();
QTextLine line = layout.createLine();
layout.endLayout();
QList<QGlyphRun> list = layout.glyphRuns();
if (list.size()) {
for (int i = 0; i < list.size(); i++) {
rawFont = list.at(i).rawFont();
if (rawFont.familyName() == font.family())
return rawFont;
}
return list.at(0).rawFont();
}
#else
[...]
[…]
#如果已定义(Q_WS_MAC)
QTextLayout布局(QFontDatabase::writingSystemSample(writingSystem),字体);
layout.beginLayout();
QTextLine=layout.createLine();
layout.endLayout();
QList list=layout.glyphrunts();
if(list.size()){
对于(int i=0;i
显然,这种方法是对Mac OS X的一种黑客攻击。这种方法在头部版本(大概是5.X)中发生了变化,不再对OS X有黑客攻击。您可能发现了一个bug
如果您查看,您将看到:
[...]
#if defined(Q_WS_MAC)
QTextLayout layout(QFontDatabase::writingSystemSample(writingSystem), font);
layout.beginLayout();
QTextLine line = layout.createLine();
layout.endLayout();
QList<QGlyphRun> list = layout.glyphRuns();
if (list.size()) {
for (int i = 0; i < list.size(); i++) {
rawFont = list.at(i).rawFont();
if (rawFont.familyName() == font.family())
return rawFont;
}
return list.at(0).rawFont();
}
#else
[...]
[…]
#如果已定义(Q_WS_MAC)
QTextLayout布局(QFontDatabase::writingSystemSample(writingSystem),字体);
layout.beginLayout();
QTextLine=layout.createLine();
layout.endLayout();
QList list=layout.glyphrunts();
if(list.size()){
对于(int i=0;i
显然,这种方法是对Mac OS X的攻击。该方法在头部版本(大概是5.X)中更改,并且不再对OS X有攻击。我正在尝试将RawFont设置为GlyphRun,但使用上述代码,结果在Mac上是错误的。有没有办法在Mac上将字体从QFontComboBox设置为GlyphRun?我正在尝试将RawFont设置为GlyphRun,但是使用上面的代码,结果在Mac上是错误的。有没有办法将字体从QFontComboBox设置为在Mac上运行的字形?