Skip to content

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

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

Closed
wants to merge 2 commits into from
Closed
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
9 changes: 4 additions & 5 deletions src/gui/text/unix/qfontconfigdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,12 @@ 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;

FcBool colorFont = false;
#ifdef FC_COLOR
FcPatternGetBool(pattern, FC_COLOR, 1, &colorFont);
#endif

// 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 @@ -496,7 +495,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,colorFont,writingSystems,fontFile);
QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,isMonospace,colorFont,writingSystems,fontFile);
if (applicationFont != nullptr && face != nullptr && db != nullptr) {
db->addNamedInstancesForFace(face,
indexValue,
Expand All @@ -505,7 +504,7 @@ static void populateFromPattern(FcPattern *pattern,
weight,
stretch,
style,
fixedPitch,
isMonospace,
colorFont,
writingSystems,
QByteArray((const char*)file_value),
Expand Down Expand Up @@ -543,7 +542,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,colorFont,writingSystems,altFontFile);
QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,isMonospace,colorFont,writingSystems,altFontFile);
} else {
QPlatformFontDatabase::registerAliasToFontFamily(familyName, altFamilyName);
}
Expand Down