示例#1
0
 // Get the toolkit version of this font for a specific toolkit.
 internal IToolkitFont GetFont(IToolkit toolkit, float dpi)
 {
     lock (this)
     {
         if (this.toolkitFont == null)
         {
             // We don't yet have a toolkit font yet.
             this.toolkitFont = toolkit.CreateFont(this, dpi);
             this.toolkit     = toolkit;
             return(this.toolkitFont);
         }
         else if (this.toolkit == toolkit)
         {
             // Same toolkit - return the cached pen information.
             return(this.toolkitFont);
         }
         else
         {
             // We have a font object for another toolkit,
             // so dispose it and create for this toolkit.
             // We null out "toolkitFont" before calling
             // "CreateFont()" just in case an exception
             // is thrown while creating the toolkit font.
             this.toolkitFont.Dispose();
             this.toolkitFont = null;
             this.toolkitFont = toolkit.CreateFont(this, dpi);
             this.toolkit     = toolkit;
             return(this.toolkitFont);
         }
     }
 }
示例#2
0
 // Dispose of this object.
 public void Dispose()
 {
     lock (this)
     {
         if (toolkitFont != null)
         {
             toolkitFont.Dispose();
             toolkitFont = null;
         }
         toolkit = null;
     }
 }
示例#3
0
 private Font(IToolkitFont font)
 {
     this.toolkit     = toolkit;
     this.toolkitFont = font;
     // TODO: load the font information from the IToolkitFont
 }
示例#4
0
	// Get the toolkit version of this font for a specific toolkit.
	internal IToolkitFont GetFont(IToolkit toolkit, float dpi)
			{
				lock(this)
				{
					if(this.toolkitFont == null)
					{
						// We don't yet have a toolkit font yet.
						this.toolkitFont = toolkit.CreateFont(this, dpi);
						this.toolkit = toolkit;
						return this.toolkitFont;
					}
					else if(this.toolkit == toolkit)
					{
						// Same toolkit - return the cached pen information.
						return this.toolkitFont;
					}
					else
					{
						// We have a font object for another toolkit,
						// so dispose it and create for this toolkit.
						// We null out "toolkitFont" before calling
						// "CreateFont()" just in case an exception
						// is thrown while creating the toolkit font.
						this.toolkitFont.Dispose();
						this.toolkitFont = null;
						this.toolkitFont = toolkit.CreateFont(this, dpi);
						this.toolkit = toolkit;
						return this.toolkitFont;
					}
				}
			}
示例#5
0
	// Dispose of this object.
	public void Dispose()
			{
				lock(this)
				{
					if(toolkitFont != null)
					{
						toolkitFont.Dispose();
						toolkitFont = null;
					}
					toolkit = null;
				}
			}
示例#6
0
	private Font(IToolkitFont font)
			{
				this.toolkit = toolkit;
				this.toolkitFont = font;
				// TODO: load the font information from the IToolkitFont
			}
示例#7
0
 private Font(IToolkitFont font)
 {
     _toolkit = _toolkit;
     _toolkitFont = font;
     // TODO: load the font information from the IToolkitFont
 }