/// <summary>
        /// Sets up the fonts.
        /// </summary>
        /// <returns>The <see cref="NexusFontSetResolver"/> to be used.</returns>
        private NexusFontSetResolver SetUpFonts()
        {
            FontManager.Add("LinBiolinum", Resources.LinBiolinum_RB);
            FontManager.Add("LinBiolinum", Resources.LinBiolinum_RI);

            FontSet fstDefault = new FontSet(new string[] { "Microsoft Sans Serif", "Arial" });
            FontSetGroup fsgDefault = new FontSetGroup(fstDefault);
            fsgDefault.AddFontSet("StandardText", fstDefault);
            fsgDefault.AddFontSet("HeadingText", fstDefault);
            fsgDefault.AddFontSet("SmallText", new FontSet(new string[] { "Segoe UI", "Arial" }));
            fsgDefault.AddFontSet("MenuText", new FontSet(new string[] { "Segoe UI", "Arial" }));
            fsgDefault.AddFontSet("GameSearchText", new FontSet(new string[] { "LinBiolinum" }));
            fsgDefault.AddFontSet("TestText", new FontSet(new string[] { "Wingdings" }));

            NexusFontSetResolver fsrResolver = new NexusFontSetResolver();
            fsrResolver.AddFontSets(fsgDefault);

            FontProvider.SetFontSetResolver(fsrResolver);
            return fsrResolver;
        }
        /// <summary>
        /// Returns a font that best matches the described font set.
        /// </summary>
        /// <param name="p_fsiFontInfo">The information describing the desired font.</param>
        /// <returns>A font that best matches the described font set.</returns>
        public Font RequestFont(FontSetInformation p_fsiFontInfo)
        {
            Font fntFont = null;

            for (Int32 i = m_lstFontSetGroups.Count - 1; i >= 0; i--)
            {
                FontSetGroup fsgGroup = m_lstFontSetGroups[i];
                if (fsgGroup.HasFontSet(p_fsiFontInfo.Set))
                {
                    fntFont = fsgGroup.GetFontSet(p_fsiFontInfo.Set).CreateFont(p_fsiFontInfo.Style, p_fsiFontInfo.Size);
                }
                if ((fntFont == null) && (fsgGroup.DefaultFontSet != null))
                {
                    fntFont = fsgGroup.DefaultFontSet.CreateFont(p_fsiFontInfo.Style, p_fsiFontInfo.Size);
                }
                if (fntFont != null)
                {
                    return(fntFont);
                }
            }
            return(null);
        }
示例#3
0
 /// <summary>
 /// A simple constructor that initializes the theme.
 /// </summary>
 /// <param name="p_icnIcon">The icon to use for this theme.</param>
 /// <param name="p_clrPrimary">The theme's primary colour.</param>
 /// <param name="p_fsgFontSets">The theme's font sets.</param>
 public Theme(Icon p_icnIcon, Color p_clrPrimary, FontSetGroup p_fsgFontSets)
 {
     Icon          = p_icnIcon;
     PrimaryColour = p_clrPrimary;
     FontSets      = p_fsgFontSets ?? new FontSetGroup();
 }
 /// <summary>
 /// Addes the given <see cref="FontSetGroup"/>s to the resolver.
 /// </summary>
 /// <remarks>
 /// When resolving a font, the groups are examined in the reverse order in which they were added.
 /// </remarks>
 /// <param name="p_fsgFontSets">The font set group to add.</param>
 public void AddFontSets(FontSetGroup p_fsgFontSets)
 {
     m_lstFontSetGroups.Add(p_fsgFontSets);
 }