CentralServerDemo.ExRichTextBox.GetFontTable C# (CSharp) Method

GetFontTable() private method

Creates a font table from a font object. When an Insert or Append operation is performed a font is either specified or the default font is used. In any case, on any Insert or Append, only one font is used, thus the font table will always contain a single font. The font table should have the form ... {\fonttbl{\f0\[FAMILY]\fcharset0 [FONT_NAME];}
private GetFontTable ( Font _font ) : string
_font System.Drawing.Font
return string
        private string GetFontTable(Font _font) {

            StringBuilder _fontTable = new StringBuilder();

            // Append table control string
            _fontTable.Append(@"{\fonttbl{\f0");
            _fontTable.Append(@"\");
			
            // If the font's family corresponds to an RTF family, append the
            // RTF family name, else, append the RTF for unknown font family.
            if (rtfFontFamily.Contains(_font.FontFamily.Name))
                _fontTable.Append(rtfFontFamily[_font.FontFamily.Name]);
            else
                _fontTable.Append(rtfFontFamily[FF_UNKNOWN]);

            // \fcharset specifies the character set of a font in the font table.
            // 0 is for ANSI.
            _fontTable.Append(@"\fcharset0 ");

            // Append the name of the font
            _fontTable.Append(_font.Name);

            // Close control string
            _fontTable.Append(@";}}");

            return _fontTable.ToString();
        }