Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize n,2n-width fonts as monospace #102

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/gui/text/unix/qfontconfigdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ static void populateFromPattern(FcPattern *pattern,
if (!scalable)
FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &pixel_size);

bool fixedPitch = spacing_value >= FC_MONO;
bool isMonospace = spacing_value >= FC_DUAL;
// Note: stretch should really be an int but registerFont incorrectly uses an enum
QFont::Stretch stretch = QFont::Stretch(stretchFromFcWidth(width_value));
QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
Expand All @@ -490,7 +490,7 @@ static void populateFromPattern(FcPattern *pattern,
applicationFont->properties.append(properties);
}

QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,isMonospace,writingSystems,fontFile);
if (applicationFont != nullptr && face != nullptr && db != nullptr) {
db->addNamedInstancesForFace(face,
indexValue,
Expand All @@ -499,7 +499,7 @@ static void populateFromPattern(FcPattern *pattern,
weight,
stretch,
style,
fixedPitch,
isMonospace,
writingSystems,
QByteArray((const char*)file_value),
applicationFont->data);
Expand Down Expand Up @@ -536,7 +536,7 @@ static void populateFromPattern(FcPattern *pattern,
applicationFont->properties.append(properties);
}
FontFile *altFontFile = new FontFile(*fontFile);
QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,altFontFile);
QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,isMonospace,writingSystems,altFontFile);
} else {
QPlatformFontDatabase::registerAliasToFontFamily(familyName, altFamilyName);
}
Expand Down