示例#1
0
        public Face GetFallbackFace(Library library, uint cp)
        {
            string file = null;

            using (var pat = FcPattern.FromFamilyName("sans"))
            {
                using (var cs = new FcCharSet())
                {
                    pat.ConfigSubstitute(fcconfig, FcMatchKind.Pattern);
                    pat.DefaultSubstitute();
                    cs.AddCharacter(cp);
                    pat.AddCharSet("charset", cs);
                    FcResult result;
                    using (var font = pat.Match(fcconfig, out result))
                    {
                        if (font.GetString(Fc.FC_FILE, 0, ref file) == FcResult.Match)
                        {
                            if (!fallbacks.ContainsKey(file))
                            {
                                fallbacks.Add(file, new Face(library, file));
                            }
                            return(fallbacks[file]);
                        }
                    }
                }
            }

            if (sans != null)
            {
                return(sans);
            }

            var style = FontStyles.Regular;

            sans = LoadSystemFace(library, "sans", ref style);
            return(sans);
        }
示例#2
0
 public void AddCharSet(string name, FcCharSet fcs)
 {
     Native.FcPatternAddCharSet(Handle, name, fcs.Handle);
 }