aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-28 20:32:28 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-28 20:32:28 +0000
commitbd3f2fdf0e3db9d6186461e7306ba383cf017b64 (patch)
tree032405d548087309b0d73163a786b32a6f6bd4e8
parentosc 52: default to 'clipboard' if no source/target has been specified (diff)
font: use pixelsizefixupfactor on regular bitmap fonts too, if set
But if it isn't set, only estimate it if the font is a *scalable* non-outline (bitmap) font.
-rw-r--r--font.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/font.c b/font.c
index 20d71fa5..d13db2c2 100644
--- a/font.c
+++ b/font.c
@@ -156,18 +156,14 @@ from_font_set(FcPattern *pattern, FcFontSet *fonts, int start_idx,
if (FcPatternGetBool(final_pattern, FC_OUTLINE, 0, &outline) != FcResultMatch)
outline = FcTrue;
- /* Pixel fixup - apply only to "scalable" bitmap (well, non-outline) fonts */
double pixel_fixup = 1.;
- if (scalable && !outline) {
- if (FcPatternGetDouble(final_pattern, "pixelsizefixupfactor", 0, &pixel_fixup) != FcResultMatch) {
- /*
- * This happens for example when the user hasn't enabled
- * 10-scale-bitmap-fonts.conf in /etc/fonts/conf.d.
- *
- * What we do is estimate the scale factor using the
- * requested pixel size and the nominal height (vertical
- * PPEM - pixels per EM).
- */
+ if (FcPatternGetDouble(final_pattern, "pixelsizefixupfactor", 0, &pixel_fixup) != FcResultMatch) {
+ /*
+ * Force a fixup factor on scalable bitmap fonts (typically
+ * emoji fonts). The fixup factor is
+ * requested-pixel-size / actual-pixels-size
+ */
+ if (scalable && !outline) {
double original_pixel_size;
if (FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &original_pixel_size) != FcResultMatch) {
/* User didn't specify ":pixelsize=xy" */
@@ -183,7 +179,8 @@ from_font_set(FcPattern *pattern, FcFontSet *fonts, int start_idx,
pixel_fixup = original_pixel_size / ft_face->size->metrics.y_ppem;
LOG_DBG("estimated pixel fixup factor to %f (from pixel size: %f)",
pixel_fixup, original_pixel_size);
- }
+ } else
+ pixel_fixup = 1.
}
#if 0