예제 #1
0
파일: Canvas.cs 프로젝트: zhabis/nfx
        public Font CreateFont(string name, float size, FontStyling style, MeasureUnit unit)
        {
            EnsureObjectNotDisposed();
            var font = m_Handle.CreateFont(name, size, style, unit);

            return(new Canvas.Font(font));
        }
예제 #2
0
파일: xlator.cs 프로젝트: zhabis/nfx
        internal static System.Drawing.FontStyle xlat(FontStyling style)
        {
            switch (style)
            {
            case FontStyling.Bold:      return(System.Drawing.FontStyle.Bold);

            case FontStyling.Italic:    return(System.Drawing.FontStyle.Italic);

            case FontStyling.Regular:   return(System.Drawing.FontStyle.Regular);

            case FontStyling.Strikeout: return(System.Drawing.FontStyle.Strikeout);

            case FontStyling.Underline: return(System.Drawing.FontStyle.Underline);

            default: return(System.Drawing.FontStyle.Regular);
            }
        }
예제 #3
0
        // Replace placeholder values with the current rank values (and optionally the next rank values)
        public string GetDescription(bool showNextRankValues)
        {
            string description = _description;

            for (int i = 0; i < _startingValues.Length; i++)
            {
                string replace = "#" + i;

                if (!showNextRankValues)
                {
                    description = description.Replace(replace, GetValue(i).ToString());
                }
                else
                {
                    string currentRankValue = GetValue(i).ToString();
                    string nextRankValue;

                    // Is the value a percentage? (Ex. #1% = true, #1 = false)
                    // Looks for a percentage sign 2 characters past where the value is to be replaced
                    if (description.Substring(description.IndexOf(replace) + 2, 1) == "%")
                    {
                        replace          += "%"; // replace the existing %
                        currentRankValue += "%";
                        nextRankValue     = " (+" + ValueIncreasePerRank[i] + "%)";
                    }
                    else // not a percentage
                    {
                        nextRankValue = " (+" + ValueIncreasePerRank[i] + ")";
                    }

                    nextRankValue = FontStyling.AddGreenHighlight(nextRankValue);
                    description   = description.Replace(replace, currentRankValue + (ValueIncreasePerRank[i] != 0 ? nextRankValue : ""));
                }
            }

            return(description);
        }
예제 #4
0
 internal NetFont(string name, float size, FontStyling style, MeasureUnit unit)
 {
     m_Font = new Font(name, size, xlator.xlat(style), xlator.xlat(unit));
 }