Skip to content

Commit

Permalink
Fix monospace fonts on Linux (#1)
Browse files Browse the repository at this point in the history
Fix monospace fonts on Linux
  • Loading branch information
Eugeny authored Sep 29, 2019
2 parents 81275d9 + bf983af commit d73eb82
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/FontManagerLinux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,31 @@ FontDescriptor *createFontDescriptor(FcPattern *pattern) {
FcChar8 *path, *psName, *family, *style;
int weight, width, slant, spacing;

FcPatternGetString(pattern, FC_FILE, 0, &path);
FcPatternGetString(pattern, FC_POSTSCRIPT_NAME, 0, &psName);
FcPatternGetString(pattern, FC_FAMILY, 0, &family);
FcPatternGetString(pattern, FC_STYLE, 0, &style);

FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight);
FcPatternGetInteger(pattern, FC_WIDTH, 0, &width);
FcPatternGetInteger(pattern, FC_SLANT, 0, &slant);
FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing);
if (FcPatternGetString(pattern, FC_FILE, 0, &path) != FcResultMatch) {
path = NULL;
}
if (FcPatternGetString(pattern, FC_POSTSCRIPT_NAME, 0, &psName) != FcResultMatch) {
psName = NULL;
}
if (FcPatternGetString(pattern, FC_FAMILY, 0, &family) != FcResultMatch) {
family = NULL;
}
if (FcPatternGetString(pattern, FC_STYLE, 0, &style) != FcResultMatch) {
style = NULL;
}

if (FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight) != FcResultMatch) {
weight = 0;
}
if (FcPatternGetInteger(pattern, FC_WIDTH, 0, &width)!= FcResultMatch) {
width = 0;
}
if (FcPatternGetInteger(pattern, FC_SLANT, 0, &slant) != FcResultMatch) {
slant = -1;
}
if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing) != FcResultMatch) {
spacing = -1;
}

return new FontDescriptor(
(char *) path,
Expand Down

0 comments on commit d73eb82

Please sign in to comment.