Пример #1
0
                public TypefaceListItem(Typeface typeface)
                {
                    _displayName = GetDisplayName(typeface);
                    _simulated   = typeface.IsBoldSimulated || typeface.IsObliqueSimulated;

                    this.FontFamily  = typeface.FontFamily;
                    this.FontWeight  = typeface.Weight;
                    this.FontStyle   = typeface.Style;
                    this.FontStretch = typeface.Stretch;

                    string itemLabel = _displayName;

                    if (_simulated)
                    {
                        string formatString = Properties.Resources.ResourceManager.GetString(
                            "simulated",
                            CultureInfo.CurrentUICulture
                            );
                        itemLabel = string.Format(formatString, itemLabel);
                    }

                    this.Text    = itemLabel;
                    this.ToolTip = itemLabel;

                    // In the case of symbol font, apply the default message font to the text so it can be read.
                    if (FontFamilyListItem.IsSymbolFont(typeface.FontFamily))
                    {
                        TextRange range = new TextRange(this.ContentStart, this.ContentEnd);
                        range.ApplyPropertyValue(TextBlock.FontFamilyProperty, SystemFonts.MessageFontFamily);
                    }
                }
Пример #2
0
        private void InitializeFontFamilyList()
        {
            ICollection <FontFamily> familyCollection = FontFamilyCollection;

            if (familyCollection != null)
            {
                FontFamilyListItem[] items = new FontFamilyListItem[familyCollection.Count];

                int i = 0;

                foreach (FontFamily family in familyCollection)
                {
                    items[i++] = new FontFamilyListItem(family);
                }

                Array.Sort <FontFamilyListItem>(items);

                for (int j = items.Length - 1; j >= 0; j--)
                {
                    FontFamilyCmb.Items.Add(items[j]);
                }
            }
        }
Пример #3
0
        void InitializeFontFamilyList()
        {
            ICollection<FontFamily> familyCollection = FontFamilyCollection;
            if (familyCollection != null)
            {
                var items = new FontFamilyListItem[familyCollection.Count];

                int i = 0;

                foreach (FontFamily family in familyCollection)
                {
                    items[i++] = new FontFamilyListItem(family);
                }

                Array.Sort<FontFamilyListItem>(items);

                foreach (FontFamilyListItem item in items)
                {
                    fontFamilyList.Items.Add(item);
                }
            }
        }