public static string GetKnownFontstring(RTFFont font)
 {
     string value = string.Empty;
     switch (font)
     {
         case RTFFont.Arial:
             value = Arial;
             break;
         case RTFFont.ArialBlack:
             value = ArialBlack;
             break;
         case RTFFont.BookmanOldStyle:
             value = BookmanOldStyle;
             break;
         case RTFFont.Broadway:
             value = Broadway;
             break;
         case RTFFont.CenturyGothic:
             value = CenturyGothic;
             break;
         case RTFFont.Consolas:
             value = Consolas;
             break;
         case RTFFont.CordiaNew:
             value = CordiaNew;
             break;
         case RTFFont.CourierNew:
             value = CourierNew;
             break;
         case RTFFont.FontTimesNewRoman:
             value = FontTimesNewRoman;
             break;
         case RTFFont.Garamond:
             value = Garamond;
             break;
         case RTFFont.Georgia:
             value = Georgia;
             break;
         case RTFFont.Impact:
             value = Impact;
             break;
         case RTFFont.LucidaConsole:
             value = LucidaConsole;
             break;
         case RTFFont.Symbol:
             value = Symbol;
             break;
         case RTFFont.WingDings:
             value = WingDings;
             break;
         case RTFFont.MSSansSerif:
             value = MSSansSerif;
             break;
         default:
             throw new ArgumentOutOfRangeException("font");
     }
     return value;
 }
예제 #2
0
        /// <summary>
        /// Indexes the of font.
        /// </summary>
        /// <param name="font">The font.</param>
        /// <returns></returns>
        public int IndexOfFont(RTFFont font, byte charset)
        {
            string s = RTFBuilder.RawFonts.GetKnownFontstring(font);

            if (charset != 0)
            {
                s = s.Replace(@"\fcharset0 ", @"\fcharset" + charset.ToString());
            }
            return(IndexOfRawFont(s));
        }
예제 #3
0
 protected Font LookupFont(RTFFont defaultFont, float defaultFontSize)
 {
     try
     {
         return(new Font(defaultFont.ToString(), defaultFontSize));
     }
     catch
     {
         return(SystemFonts.DefaultFont);
     }
 }
 protected RTFBuilderbase(RTFFont defaultFont, float defaultFontSize)
 {
     _rawFonts              = new StringCollection();
     this._font             = IndexOfFont(defaultFont);
     this._defaultFontSize  = defaultFontSize;
     this._fontSize         = this._defaultFontSize;
     this._defaultforecolor = SystemColors.WindowText;
     this._defaultbackcolor = SystemColors.Window;
     this._colortbl         = new List <Color>();
     this._colortbl.Add(this._defaultforecolor);
     this._colortbl.Add(this._defaultbackcolor);
     this._fontStyle      = System.Drawing.FontStyle.Regular;
     this._backcolor      = this._defaultbackcolor;
     this._forecolor      = this._defaultforecolor;
     this._sf             = (StringFormat)StringFormat.GenericDefault.Clone();
     this._sf.FormatFlags = StringFormatFlags.NoWrap;
     this._sf.Trimming    = StringTrimming.Word;
 }
예제 #5
0
        protected RTFBuilderBase(RTFFont  defaultFont, float defaultFontSize)
        {

            _rawFonts = new StringCollection();
            this._font = IndexOfFont(defaultFont);
            this._defaultFontSize = defaultFontSize;
            this._fontSize = this._defaultFontSize;
            this._defaultforecolor = SystemColors.WindowText;
            this._defaultbackcolor = SystemColors.Window;
            this._colortbl = new List <Color>();
            this._colortbl.Add(this._defaultforecolor);
            this._colortbl.Add(this._defaultbackcolor);
            this._fontStyle = System.Drawing.FontStyle.Regular;
            this._backcolor = this._defaultbackcolor;
            this._forecolor = this._defaultforecolor;
            this._sf = (StringFormat) StringFormat.GenericDefault.Clone();
            this._sf.FormatFlags = StringFormatFlags.NoWrap;
            this._sf.Trimming = StringTrimming.Word;
        }
예제 #6
0
 protected RTFBuilderbase(RTFFont defaultFont, float defaultFontSize, ushort codepage, byte charset)
 {
     _rawFonts = new StringCollection();
     DefLang = codepage;
     _font = IndexOfFont(defaultFont, charset);
     _defaultFontSize = defaultFontSize;
     _fontSize = _defaultFontSize;
     _defaultforecolor = SystemColors.WindowText;
     _defaultbackcolor = SystemColors.Window;
     _colortbl = new List<Color>();
     _colortbl.Add(_defaultforecolor);
     _colortbl.Add(_defaultbackcolor);
     _fontStyle = System.Drawing.FontStyle.Regular;
     _backcolor = _defaultbackcolor;
     _forecolor = _defaultforecolor;
     _sf = (StringFormat) StringFormat.GenericDefault.Clone();
     _sf.FormatFlags = StringFormatFlags.NoWrap;
     _sf.Trimming = StringTrimming.Word;
     _sysfont = LookupFont(defaultFont, defaultFontSize);
 }
예제 #7
0
 protected RTFBuilderbase(RTFFont defaultFont, float defaultFontSize, ushort codepage, byte charset)
 {
     _rawFonts         = new StringCollection();
     DefLang           = codepage;
     _font             = IndexOfFont(defaultFont, charset);
     _defaultFontSize  = defaultFontSize;
     _fontSize         = _defaultFontSize;
     _defaultforecolor = SystemColors.WindowText;
     _defaultbackcolor = SystemColors.Window;
     _colortbl         = new List <Color>();
     _colortbl.Add(_defaultforecolor);
     _colortbl.Add(_defaultbackcolor);
     _fontStyle      = System.Drawing.FontStyle.Regular;
     _backcolor      = _defaultbackcolor;
     _forecolor      = _defaultforecolor;
     _sf             = (StringFormat)StringFormat.GenericDefault.Clone();
     _sf.FormatFlags = StringFormatFlags.NoWrap;
     _sf.Trimming    = StringTrimming.Word;
     _sysfont        = LookupFont(defaultFont, defaultFontSize);
 }
 public RTFBuilderbase Font(RTFFont font)
 {
     this._font = IndexOfFont(font);
     return(this);
 }
예제 #9
0
 /// <summary>
 /// Indexes the of font.
 /// </summary>
 /// <param name="font">The font.</param>
 /// <returns></returns>
 public int IndexOfFont(RTFFont font)
 {
     return IndexOfFont(font, 0);
 }
 /// <summary>
 /// Indexes the of font.
 /// </summary>
 /// <param name="font">The font.</param>
 /// <returns></returns>
 public int IndexOfFont(RTFFont font)
 {
     return(IndexOfRawFont(RTFBuilder.RawFonts.GetKnownFontstring(font)));
 }
 public RTFBuilder(RTFFont defaultFont, float defaultFontSize) : base(defaultFont, defaultFontSize)
 {
     this._sb = new StringBuilder();
 }
 public RTFBuilder(RTFFont defaultFont) : base(defaultFont, 20F)
 {
     this._sb = new StringBuilder();
 }
예제 #13
0
 public RTFBuilder(RTFFont defaultFont, float defaultFontSize) : base(defaultFont, defaultFontSize)
 {
     this._sb = new StringBuilder();
 }
예제 #14
0
 public RTFBuilder(RTFFont defaultFont, float defaultFontSize, ushort codepage, byte charset)
     : base(defaultFont, defaultFontSize, codepage, charset)
 {
     _sb = new StringBuilder();
 }
예제 #15
0
 /// <summary>
 /// Indexes the of font.
 /// </summary>
 /// <param name="font">The font.</param>
 /// <returns></returns>
 public int IndexOfFont(RTFFont font, byte charset)
 {
     string s = RTFBuilder.RawFonts.GetKnownFontstring(font);
     if (charset != 0) s = s.Replace(@"\fcharset0 ", @"\fcharset" + charset.ToString());
     return IndexOfRawFont(s);
 }
예제 #16
0
 /// <summary>
 /// Indexes the of font.
 /// </summary>
 /// <param name="font">The font.</param>
 /// <returns></returns>
 public int IndexOfFont(RTFFont  font)
 {
    return IndexOfRawFont(RTFBuilder.RawFonts.GetKnownFontstring(font));
 }
예제 #17
0
 protected RTFBuilderbase(RTFFont defaultFont, float defaultFontSize)
     : this(defaultFont, defaultFontSize, 1252, 0)
 {
 }
예제 #18
0
 protected RTFBuilderbase(RTFFont defaultFont, float defaultFontSize)
     : this(defaultFont, defaultFontSize, 1252, 0)
 {
 }
예제 #19
0
 /// <summary>
 /// Indexes the of font.
 /// </summary>
 /// <param name="font">The font.</param>
 /// <returns></returns>
 public int IndexOfFont(RTFFont font)
 {
     return(IndexOfFont(font, 0));
 }
예제 #20
0
 protected Font LookupFont(RTFFont defaultFont, float defaultFontSize)
 {
     try
     {
         return new Font(defaultFont.ToString(), defaultFontSize);
     }
     catch
     {
         return SystemFonts.DefaultFont;
     }
 }
예제 #21
0
 public RTFBuilderBase Font(RTFFont font)
 {
    this._font = IndexOfFont(font);
    return this;
 }
예제 #22
0
 public RTFBuilder(RTFFont defaultFont) : base(defaultFont, 20F)
 {
     this._sb = new StringBuilder();
 }
예제 #23
0
            public static string GetKnownFontstring(RTFFont font)
            {
                string value = string.Empty;

                switch (font)
                {
                case RTFFont.Arial:
                    value = Arial;
                    break;

                case RTFFont.ArialBlack:
                    value = ArialBlack;
                    break;

                case RTFFont.BookmanOldStyle:
                    value = BookmanOldStyle;
                    break;

                case RTFFont.Broadway:
                    value = Broadway;
                    break;

                case RTFFont.CenturyGothic:
                    value = CenturyGothic;
                    break;

                case RTFFont.Consolas:
                    value = Consolas;
                    break;

                case RTFFont.CordiaNew:
                    value = CordiaNew;
                    break;

                case RTFFont.CourierNew:
                    value = CourierNew;
                    break;

                case RTFFont.FontTimesNewRoman:
                    value = FontTimesNewRoman;
                    break;

                case RTFFont.Garamond:
                    value = Garamond;
                    break;

                case RTFFont.Georgia:
                    value = Georgia;
                    break;

                case RTFFont.Impact:
                    value = Impact;
                    break;

                case RTFFont.LucidaConsole:
                    value = LucidaConsole;
                    break;

                case RTFFont.Symbol:
                    value = Symbol;
                    break;

                case RTFFont.WingDings:
                    value = WingDings;
                    break;

                case RTFFont.MSSansSerif:
                    value = MSSansSerif;
                    break;

                default:
                    throw new ArgumentOutOfRangeException("font");
                }
                return(value);
            }
예제 #24
0
 public RTFBuilder(RTFFont defaultFont, float defaultFontSize, ushort codepage, byte charset)
     : base(defaultFont, defaultFontSize, codepage, charset)
 {
     _sb = new StringBuilder();
 }