コード例 #1
0
        /// <summary>
        /// Gets the font family from the user settings Font
        /// </summary>
        /// <returns>the font family</returns>
        private static TT.FontFamily GetFontFamily()
        {
            if (fontMap == null)
            {
                fontMap = new Dictionary <ClosedCaptionStyle, TT.FontFamily>();

                // _Smallcaps is a unique keyword that will trigger the usage of Typography.SetCapitals(textblock, FontCapitals.SmallCaps)
                // and the default font.
                fontMap[ClosedCaptionStyle.SmallCapitals] = new TT.FontFamily("_Smallcaps");
            }

            TT.FontFamily fontFamily;

            if (fontMap.TryGetValue(ClosedCaptionProperties.FontStyle, out fontFamily))
            {
                return(fontFamily);
            }

            var name = GetFontFamilyName(ClosedCaptionProperties.FontStyle);

            if (name == null)
            {
                return(null);
            }

            fontFamily = new TT.FontFamily(name);

            fontMap[ClosedCaptionProperties.FontStyle] = fontFamily;

            return(fontFamily);
        }
コード例 #2
0
        /// <summary>
        /// Gets the font family from the user settings Font
        /// </summary>
        /// <returns>the font family</returns>
        private static TT.FontFamily GetFontFamily()
        {
            if (fontMap == null)
            {
                fontMap = new Dictionary<ClosedCaptionStyle, TT.FontFamily>();

                // _Smallcaps is a unique keyword that will trigger the usage of Typography.SetCapitals(textblock, FontCapitals.SmallCaps)
                // and the default font.
                fontMap[ClosedCaptionStyle.SmallCapitals] = new TT.FontFamily("_Smallcaps");
            }

            TT.FontFamily fontFamily;

            if (fontMap.TryGetValue(ClosedCaptionProperties.FontStyle, out fontFamily))
            {
                return fontFamily;
            }

            var name = GetFontFamilyName(ClosedCaptionProperties.FontStyle);

            if (name == null)
            {
                return null;
            }

            fontFamily = new TT.FontFamily(name);

            fontMap[ClosedCaptionProperties.FontStyle] = fontFamily;

            return fontFamily;
        }