示例#1
0
        // Members

        public RtfFont(string id, RtfFontKind kind, RtfFontPitch pitch, int charSet, int codePage, string name)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            if (charSet < 0)
            {
                throw new ArgumentException(Strings.InvalidCharacterSet(charSet));
            }
            if (codePage < 0)
            {
                throw new ArgumentException(Strings.InvalidCodePage(codePage));
            }
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            Id        = id;
            Kind      = kind;
            Pitch     = pitch;
            CharSet   = charSet;
            _codePage = codePage;
            Name      = name;
        } // RtfFont
示例#2
0
		// ----------------------------------------------------------------------
		public RtfFont( string id, RtfFontKind kind, RtfFontPitch pitch, int charSet, int codePage, string name )
		{
			if ( id == null )
			{
				throw new ArgumentNullException( "id" );
			}
			if ( charSet < 0 )
			{
				throw new ArgumentException( Strings.InvalidCharacterSet( charSet ) );
			}
			if ( codePage < 0 )
			{
				throw new ArgumentException( Strings.InvalidCodePage( codePage ) );
			}
			if ( name == null )
			{
				throw new ArgumentNullException( "name" );
			}
			this.id = id;
			this.kind = kind;
			this.pitch = pitch;
			this.charSet = charSet;
			this.codePage = codePage;
			this.name = name;
		} // RtfFont
示例#3
0
 // ----------------------------------------------------------------------
 public RtfFont(string id, RtfFontKind kind, RtfFontPitch pitch, int charSet, int codePage, string name)
 {
     if (id == null)
     {
         throw new ArgumentNullException("id");
     }
     if (charSet < 0)
     {
         throw new ArgumentException(Strings.InvalidCharacterSet(charSet));
     }
     if (codePage < 0)
     {
         throw new ArgumentException(Strings.InvalidCodePage(codePage));
     }
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     this.id       = id;
     this.kind     = kind;
     this.pitch    = pitch;
     this.charSet  = charSet;
     this.codePage = codePage;
     this.name     = name;
 }         // RtfFont
示例#4
0
 /// <summary>
 /// Initializes a new instance of ESCommon.Rtf.RtfFont class.
 /// </summary>
 public RtfFont(string fontName, RtfCharacterSet characterSet, RtfFontFamily fontFamily, RtfFontPitch pitch)
 {
     _fontName     = fontName;
     _characterSet = characterSet;
     _fontFamily   = fontFamily;
     _pitch        = pitch;
 }
 // ----------------------------------------------------------------------
 protected override void DoVisitTag( IRtfTag tag )
 {
     switch ( tag.Name )
     {
         case RtfSpec.TagThemeFontLoMajor:
         case RtfSpec.TagThemeFontHiMajor:
         case RtfSpec.TagThemeFontDbMajor:
         case RtfSpec.TagThemeFontBiMajor:
         case RtfSpec.TagThemeFontLoMinor:
         case RtfSpec.TagThemeFontHiMinor:
         case RtfSpec.TagThemeFontDbMinor:
         case RtfSpec.TagThemeFontBiMinor:
             // skip and ignore for the moment
             break;
         case RtfSpec.TagFont:
             fontId = tag.FullName;
             fontIndex = tag.ValueAsNumber;
             break;
         case RtfSpec.TagFontKindNil:
             fontKind = RtfFontKind.Nil;
             break;
         case RtfSpec.TagFontKindRoman:
             fontKind = RtfFontKind.Roman;
             break;
         case RtfSpec.TagFontKindSwiss:
             fontKind = RtfFontKind.Swiss;
             break;
         case RtfSpec.TagFontKindModern:
             fontKind = RtfFontKind.Modern;
             break;
         case RtfSpec.TagFontKindScript:
             fontKind = RtfFontKind.Script;
             break;
         case RtfSpec.TagFontKindDecor:
             fontKind = RtfFontKind.Decor;
             break;
         case RtfSpec.TagFontKindTech:
             fontKind = RtfFontKind.Tech;
             break;
         case RtfSpec.TagFontKindBidi:
             fontKind = RtfFontKind.Bidi;
             break;
         case RtfSpec.TagFontCharset:
             fontCharset = tag.ValueAsNumber;
             break;
         case RtfSpec.TagCodePage:
             fontCodePage = tag.ValueAsNumber;
             break;
         case RtfSpec.TagFontPitch:
             switch ( tag.ValueAsNumber )
             {
                 case 0:
                     fontPitch = RtfFontPitch.Default;
                     break;
                 case 1:
                     fontPitch = RtfFontPitch.Fixed;
                     break;
                 case 2:
                     fontPitch = RtfFontPitch.Variable;
                     break;
             }
             break;
     }
 }
 // ----------------------------------------------------------------------
 public void Reset()
 {
     fontIndex = 0;
     fontCharset = 0;
     fontCodePage = 0;
     fontKind = RtfFontKind.Nil;
     fontPitch = RtfFontPitch.Default;
     fontNameBuffer.Remove( 0, fontNameBuffer.Length );
 }