示例#1
0
        private List <KeyValuePair <string, string> > LoadFontInformation()
        {
            KeyValuePair <string, string> Get(CanvasFontInformation info)
            {
                var infos = FontFace.GetInformationalStrings(info);

                if (infos.Count == 0)
                {
                    return(new KeyValuePair <string, string>());
                }

                var name = info.Humanize().Transform(To.TitleCase);
                var dic  = infos.ToDictionary(k => k.Key, k => k.Value);

                if (infos.TryGetValue(CultureInfo.CurrentCulture.Name, out string value) ||
                    infos.TryGetValue("en-us", out value))
                {
                    return(KeyValuePair.Create(name, value));
                }
                else
                {
                    return(KeyValuePair.Create(name, infos.First().Value));
                }
            }

            return(INFORMATIONS.Select(Get).Where(s => s.Key != null).ToList());
        }
示例#2
0
        private List <KeyValuePair <string, string> > LoadFontInformation()
        {
            //KeyValuePair<string, string> Get(CanvasFontInformation info)
            //{
            //    var infos = FontFace.GetInformationalStrings(info);
            //    if (infos.Count == 0)
            //        return new KeyValuePair<string, string>();

            //    var name = info.Humanise();
            //    var dic = infos.ToDictionary(k => k.Key, k => k.Value);
            //    if (infos.TryGetValue(CultureInfo.CurrentCulture.Name, out string value)
            //        || infos.TryGetValue("en-us", out value))
            //        return KeyValuePair.Create(name, value);
            //    return KeyValuePair.Create(name, infos.First().Value);
            //}

            return(INFORMATIONS.Select(i => GetInfoKey(FontFace, i)).Where(s => s.Key != null).ToList());
        }