]>
git.wh0rd.org - fontconfig.git/blob - src/fcdefault.c
4 * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
30 } FcBoolDefaults
[] = {
31 { FC_HINTING
, FcTrue
}, /* !FT_LOAD_NO_HINTING */
32 { FC_VERTICAL_LAYOUT
, FcFalse
}, /* FC_LOAD_VERTICAL_LAYOUT */
33 { FC_AUTOHINT
, FcFalse
}, /* FC_LOAD_FORCE_AUTOHINT */
34 { FC_GLOBAL_ADVANCE
, FcTrue
}, /* !FC_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
37 #define NUM_FC_BOOL_DEFAULTS (sizeof FcBoolDefaults / sizeof FcBoolDefaults[0])
40 FcDefaultSubstitute (FcPattern
*pattern
)
45 if (FcPatternGet (pattern
, FC_STYLE
, 0, &v
) == FcResultNoMatch
)
47 if (FcPatternGet (pattern
, FC_WEIGHT
, 0, &v
) == FcResultNoMatch
)
49 FcPatternAddInteger (pattern
, FC_WEIGHT
, FC_WEIGHT_MEDIUM
);
51 if (FcPatternGet (pattern
, FC_SLANT
, 0, &v
) == FcResultNoMatch
)
53 FcPatternAddInteger (pattern
, FC_SLANT
, FC_SLANT_ROMAN
);
57 for (i
= 0; i
< NUM_FC_BOOL_DEFAULTS
; i
++)
58 if (FcPatternGet (pattern
, FcBoolDefaults
[i
].field
, 0, &v
) == FcResultNoMatch
)
59 FcPatternAddBool (pattern
, FcBoolDefaults
[i
].field
, FcBoolDefaults
[i
].value
);
61 if (FcPatternGet (pattern
, FC_PIXEL_SIZE
, 0, &v
) == FcResultNoMatch
)
63 double dpi
, size
, scale
;
65 if (FcPatternGetDouble (pattern
, FC_SIZE
, 0, &size
) != FcResultMatch
)
68 (void) FcPatternDel (pattern
, FC_SIZE
);
69 FcPatternAddDouble (pattern
, FC_SIZE
, size
);
71 if (FcPatternGetDouble (pattern
, FC_SCALE
, 0, &scale
) != FcResultMatch
)
74 (void) FcPatternDel (pattern
, FC_SCALE
);
75 FcPatternAddDouble (pattern
, FC_SCALE
, scale
);
78 if (FcPatternGetDouble (pattern
, FC_DPI
, 0, &dpi
) != FcResultMatch
)
81 (void) FcPatternDel (pattern
, FC_DPI
);
82 FcPatternAddDouble (pattern
, FC_DPI
, dpi
);
85 FcPatternAddDouble (pattern
, FC_PIXEL_SIZE
, size
);