Lines Matching defs:pattern

120 static int get_int(FcPattern* pattern, const char object[], int missing) {
122 if (FcPatternGetInteger(pattern, object, 0, &value) != FcResultMatch) {
128 static const char* get_string(FcPattern* pattern, const char object[], const char* missing = "") {
130 if (FcPatternGetString(pattern, object, 0, &value) != FcResultMatch) {
142 * FcResult FcPatternIsWeak(pattern, object, id, FcBool* isWeak);
150 static SkWeakReturn is_weak(FcPattern* pattern, const char object[], int id) {
155 // Create a copy of the pattern with only the value 'pattern'['object'['id']] in it.
156 // Internally, FontConfig pattern objects are linked lists, so faster to remove from head.
158 SkAutoFcPattern minimal(FcPatternFilter(pattern, requestedObjectOnly));
194 // Add 'matchlang' to the copy of the pattern.
197 // Run a match against the copy of the pattern.
198 // If the 'id' was weak, then we should match the pattern with 'matchlang'.
199 // If the 'id' was strong, then we should match the pattern with 'nomatchlang'.
218 static void remove_weak(FcPattern* pattern, const char object[]) {
222 SkAutoFcPattern minimal(FcPatternFilter(pattern, requestedObjectOnly));
239 // If they were all weak, then leave the pattern alone.
246 SkAssertResult(FcPatternRemove(pattern, object, lastStrongId + 1));
300 static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) {
315 int weight = map_ranges(get_int(pattern, FC_WEIGHT, FC_WEIGHT_REGULAR),
329 int width = map_ranges(get_int(pattern, FC_WIDTH, FC_WIDTH_NORMAL),
332 SkFS::Slant slant = get_int(pattern, FC_SLANT, FC_SLANT_ROMAN) > 0
339 static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) {
371 FcPatternAddInteger(pattern, FC_WEIGHT, weight);
372 FcPatternAddInteger(pattern, FC_WIDTH, width);
373 FcPatternAddInteger(pattern, FC_SLANT, style.isItalic() ? FC_SLANT_ITALIC : FC_SLANT_ROMAN);
408 /** @param pattern takes ownership of the reference. */
409 static SkTypeface_fontconfig* Create(FcPattern* pattern) {
410 return SkNEW_ARGS(SkTypeface_fontconfig, (pattern));
434 // Hold the lock while unrefing the pattern.
440 /** @param pattern takes ownership of the reference. */
441 SkTypeface_fontconfig(FcPattern* pattern)
442 : INHERITED(skfontstyle_from_fcpattern(pattern),
444 FC_PROPORTIONAL != get_int(pattern, FC_SPACING, FC_PROPORTIONAL))
445 , fPattern(pattern)
497 SkAutoFcPattern pattern;
498 fcpattern_from_skfontstyle(style, pattern);
499 FcConfigSubstitute(fFontMgr->fFC, pattern, FcMatchPattern);
500 FcDefaultSubstitute(pattern);
506 pattern, &result));
576 * @param pattern a complete pattern from FcFontRenderPrepare.
578 SkTypeface* createTypefaceFromFcPattern(FcPattern* pattern) const {
581 SkTypeface* face = fTFCache.findByProcAndRef(FindByFcPattern, pattern);
583 FcPatternReference(pattern);
584 face = SkTypeface_fontconfig::Create(pattern);
622 * as a string object value in the pattern.
624 static bool AnyMatching(FcPattern* font, FcPattern* pattern, const char* object) {
628 // Set an arbitrary limit on the number of pattern object values to consider.
632 result = FcPatternGetString(pattern, object, patternId, &patternString);
664 static bool FontFamilyNameMatches(FcPattern* font, FcPattern* pattern) {
665 return AnyMatching(font, pattern, FC_FAMILY);
689 SkAutoFcPattern pattern;
690 FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)familyName);
691 FcConfigSubstitute(fFC, pattern, FcMatchPattern);
692 FcDefaultSubstitute(pattern);
697 strongPattern.reset(FcPatternDuplicate(pattern));
701 matchPattern = pattern;
719 FcFontSetAdd(matches, FcFontRenderPrepare(fFC, pattern, font));
732 SkAutoFcPattern pattern;
733 FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)familyName);
734 fcpattern_from_skfontstyle(style, pattern);
735 FcConfigSubstitute(fFC, pattern, FcMatchPattern);
736 FcDefaultSubstitute(pattern);
741 // The reason for is that after substitution the pattern for 'sans-serif' looks like
749 strongPattern.reset(FcPatternDuplicate(pattern));
753 matchPattern = pattern;
757 SkAutoFcPattern font(FcFontMatch(fFC, pattern, &result));
773 SkAutoFcPattern pattern;
778 FcPatternAddWeak(pattern, FC_FAMILY, familyNameValue, FcFalse);
780 fcpattern_from_skfontstyle(style, pattern);
784 FcPatternAddCharSet(pattern, FC_CHARSET, charSet);
792 FcPatternAddLangSet(pattern, FC_LANG, langSet);
795 FcConfigSubstitute(fFC, pattern, FcMatchPattern);
796 FcDefaultSubstitute(pattern);
799 SkAutoFcPattern font(FcFontMatch(fFC, pattern, &result));