Пример #1
0
        internal void PrepareTypeface(FormattedTextBlock textdisplay = null)
        {
            // Reference to the text display
            if (textdisplay != null)
            {
                formattedTextBlockRef = textdisplay;
            }
            // If there is not typeface, it creates one
            if (typeface == null)
            {
                typeface = new Typeface(FontFamily, FontStyle.Value, FontWeight.Value, FontStretch.Value);
            }

            // Tries to load the glyphTypeface
            if (!typeface.TryGetGlyphTypeface(out glyphTypeface))
            {
                // If failed loading the glyphTypeface, the it tries with the default
                typeface = System.Windows.SystemFonts.MessageFontFamily.GetTypefaces().FirstOrDefault();
                if (!typeface.TryGetGlyphTypeface(out glyphTypeface))
                {
                    throw new InvalidOperationException("Application failed loading GlyphTypeFace for the specified font and the default font.");
                }
            }
        }
Пример #2
0
 public FontFormatCollection()
 {
     Items = new List <T>();
     formattedTextBlockRef = null;
 }