diff options
author | marha <marha@users.sourceforge.net> | 2014-03-28 17:43:20 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-28 17:43:20 +0100 |
commit | f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd (patch) | |
tree | afbeb028495328a2817aedbac7aae484a2c71a83 /fontconfig/src/fcdefault.c | |
parent | bf0cbcc1d00962ef2221cb4ceae87cc5ae737454 (diff) | |
parent | cbfb19790917d271b8ca6156554b16acc802719f (diff) | |
download | vcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.tar.gz vcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.tar.bz2 vcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
X11/xtrans/Xtrans.c
Diffstat (limited to 'fontconfig/src/fcdefault.c')
-rw-r--r-- | fontconfig/src/fcdefault.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/fontconfig/src/fcdefault.c b/fontconfig/src/fcdefault.c index 4beda7c00..7c16f4841 100644 --- a/fontconfig/src/fcdefault.c +++ b/fontconfig/src/fcdefault.c @@ -219,6 +219,7 @@ FcDefaultSubstitute (FcPattern *pattern) { FcValue v, namelang, v2; int i; + double dpi, size, scale, pixelsize; if (FcPatternObjectGet (pattern, FC_WEIGHT_OBJECT, 0, &v) == FcResultNoMatch ) FcPatternObjectAddInteger (pattern, FC_WEIGHT_OBJECT, FC_WEIGHT_NORMAL); @@ -233,32 +234,30 @@ FcDefaultSubstitute (FcPattern *pattern) if (FcPatternObjectGet (pattern, FcBoolDefaults[i].field, 0, &v) == FcResultNoMatch) FcPatternObjectAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value); - if (FcPatternObjectGet (pattern, FC_PIXEL_SIZE_OBJECT, 0, &v) == FcResultNoMatch) - { - double dpi, size, scale; + if (FcPatternObjectGetDouble (pattern, FC_SIZE_OBJECT, 0, &size) != FcResultMatch) + size = 12.0L; + if (FcPatternObjectGetDouble (pattern, FC_SCALE_OBJECT, 0, &scale) != FcResultMatch) + scale = 1.0; + if (FcPatternObjectGetDouble (pattern, FC_DPI_OBJECT, 0, &dpi) != FcResultMatch) + dpi = 75.0; - if (FcPatternObjectGetDouble (pattern, FC_SIZE_OBJECT, 0, &size) != FcResultMatch) - { - size = 12.0; - (void) FcPatternObjectDel (pattern, FC_SIZE_OBJECT); - FcPatternObjectAddDouble (pattern, FC_SIZE_OBJECT, size); - } - if (FcPatternObjectGetDouble (pattern, FC_SCALE_OBJECT, 0, &scale) != FcResultMatch) - { - scale = 1.0; - (void) FcPatternObjectDel (pattern, FC_SCALE_OBJECT); - FcPatternObjectAddDouble (pattern, FC_SCALE_OBJECT, scale); - } - size *= scale; - if (FcPatternObjectGetDouble (pattern, FC_DPI_OBJECT, 0, &dpi) != FcResultMatch) - { - dpi = 75.0; - (void) FcPatternObjectDel (pattern, FC_DPI_OBJECT); - FcPatternObjectAddDouble (pattern, FC_DPI_OBJECT, dpi); - } - size *= dpi / 72.0; - FcPatternObjectAddDouble (pattern, FC_PIXEL_SIZE_OBJECT, size); + if (FcPatternObjectGet (pattern, FC_PIXEL_SIZE_OBJECT, 0, &v) != FcResultMatch) + { + (void) FcPatternObjectDel (pattern, FC_SCALE_OBJECT); + FcPatternObjectAddDouble (pattern, FC_SCALE_OBJECT, scale); + pixelsize = size * scale; + (void) FcPatternObjectDel (pattern, FC_DPI_OBJECT); + FcPatternObjectAddDouble (pattern, FC_DPI_OBJECT, dpi); + pixelsize *= dpi / 72.0; + FcPatternObjectAddDouble (pattern, FC_PIXEL_SIZE_OBJECT, pixelsize); + } + else + { + size = v.u.d; + size = size / dpi * 72.0 / scale; } + (void) FcPatternObjectDel (pattern, FC_SIZE_OBJECT); + FcPatternObjectAddDouble (pattern, FC_SIZE_OBJECT, size); if (FcPatternObjectGet (pattern, FC_FONTVERSION_OBJECT, 0, &v) == FcResultNoMatch) { |