Lines Matching defs:pattern
121 static bool get_bool(FcPattern* pattern, const char object[], bool missing = false) {
123 if (FcPatternGetBool(pattern, object, 0, &value) != FcResultMatch) {
129 static int get_int(FcPattern* pattern, const char object[], int missing) {
131 if (FcPatternGetInteger(pattern, object, 0, &value) != FcResultMatch) {
137 static const char* get_string(FcPattern* pattern, const char object[], const char* missing = "") {
139 if (FcPatternGetString(pattern, object, 0, &value) != FcResultMatch) {
145 static const FcMatrix* get_matrix(FcPattern* pattern, const char object[]) {
147 if (FcPatternGetMatrix(pattern, object, 0, &matrix) != FcResultMatch) {
159 * FcResult FcPatternIsWeak(pattern, object, id, FcBool* isWeak);
168 static SkWeakReturn is_weak(FcPattern* pattern, const char object[], int id) {
173 // Create a copy of the pattern with only the value 'pattern'['object'['id']] in it.
174 // Internally, FontConfig pattern objects are linked lists, so faster to remove from head.
176 SkAutoFcPattern minimal(FcPatternFilter(pattern, requestedObjectOnly));
212 // Add 'matchlang' to the copy of the pattern.
215 // Run a match against the copy of the pattern.
216 // If the 'id' was weak, then we should match the pattern with 'matchlang'.
217 // If the 'id' was strong, then we should match the pattern with 'nomatchlang'.
236 static void remove_weak(FcPattern* pattern, const char object[]) {
240 SkAutoFcPattern minimal(FcPatternFilter(pattern, requestedObjectOnly));
257 // If they were all weak, then leave the pattern alone.
264 SkAssertResult(FcPatternRemove(pattern, object, lastStrongId + 1));
305 static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) {
323 SkScalar weight = map_ranges(get_int(pattern, FC_WEIGHT, FC_WEIGHT_REGULAR),
337 SkScalar width = map_ranges(get_int(pattern, FC_WIDTH, FC_WIDTH_NORMAL),
341 switch (get_int(pattern, FC_SLANT, FC_SLANT_ROMAN)) {
351 static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) {
394 FcPatternAddInteger(pattern, FC_WEIGHT, weight);
395 FcPatternAddInteger(pattern, FC_WIDTH , width);
396 FcPatternAddInteger(pattern, FC_SLANT , slant);
445 static sk_sp<SkTypeface_fontconfig> Make(SkAutoFcPattern pattern, SkString sysroot) {
446 return sk_sp<SkTypeface_fontconfig>(new SkTypeface_fontconfig(std::move(pattern),
548 // Hold the lock while unrefing the pattern.
554 SkTypeface_fontconfig(SkAutoFcPattern pattern, SkString sysroot)
555 : INHERITED(skfontstyle_from_fcpattern(pattern),
556 FC_PROPORTIONAL != get_int(pattern, FC_SPACING, FC_PROPORTIONAL))
557 , fPattern(std::move(pattern))
614 SkAutoFcPattern pattern;
615 fcpattern_from_skfontstyle(style, pattern);
616 FcConfigSubstitute(fFontMgr->fFC, pattern, FcMatchPattern);
617 FcDefaultSubstitute(pattern);
623 pattern, &result);
691 * @param pattern a complete pattern from FcFontRenderPrepare.
693 sk_sp<SkTypeface> createTypefaceFromFcPattern(SkAutoFcPattern pattern) const {
694 if (!pattern) {
702 sk_sp<SkTypeface> face = fTFCache.findByProcAndRef(FindByFcPattern, pattern);
704 pattern.reset();
709 face = SkTypeface_fontconfig::Make(std::move(pattern), fSysroot);
745 * as a string object value in the pattern.
747 static bool AnyMatching(FcPattern* font, FcPattern* pattern, const char* object) {
751 // Set an arbitrary limit on the number of pattern object values to consider.
755 result = FcPatternGetString(pattern, object, patternId, &patternString);
805 static bool FontFamilyNameMatches(FcPattern* font, FcPattern* pattern) {
806 return AnyMatching(font, pattern, FC_FAMILY);
833 SkAutoFcPattern pattern;
834 FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)familyName);
835 FcConfigSubstitute(fFC, pattern, FcMatchPattern);
836 FcDefaultSubstitute(pattern);
841 strongPattern.reset(FcPatternDuplicate(pattern));
845 matchPattern = pattern;
863 FcFontSetAdd(matches, FcFontRenderPrepare(fFC, pattern, font));
877 SkAutoFcPattern pattern;
878 FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)familyName);
879 fcpattern_from_skfontstyle(style, pattern);
880 FcConfigSubstitute(fFC, pattern, FcMatchPattern);
881 FcDefaultSubstitute(pattern);
886 // After substitution the pattern for 'sans-serif' looks like "wwwwwwwwwwwwwwswww" where
894 strongPattern.reset(FcPatternDuplicate(pattern));
898 matchPattern = pattern;
902 SkAutoFcPattern font(FcFontMatch(fFC, pattern, &result));
920 SkAutoFcPattern pattern;
925 FcPatternAddWeak(pattern, FC_FAMILY, familyNameValue, FcFalse);
927 fcpattern_from_skfontstyle(style, pattern);
931 FcPatternAddCharSet(pattern, FC_CHARSET, charSet);
939 FcPatternAddLangSet(pattern, FC_LANG, langSet);
942 FcConfigSubstitute(fFC, pattern, FcMatchPattern);
943 FcDefaultSubstitute(pattern);
946 SkAutoFcPattern font(FcFontMatch(fFC, pattern, &result));