From c63102621f1aca704e0b8576ac6e5b267cf20a7f Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sat, 24 May 2008 07:52:36 +0000 Subject: [PATCH] Added protected and public getters and setters to TextHandle. --- Source/Utilities/Fonts/TextHandle.cs | 31 +++++++++++++++++++++------ Source/Utilities/Fonts/TextPrinter.cs | 4 ++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Source/Utilities/Fonts/TextHandle.cs b/Source/Utilities/Fonts/TextHandle.cs index d4fc3539..fdb48f7b 100644 --- a/Source/Utilities/Fonts/TextHandle.cs +++ b/Source/Utilities/Fonts/TextHandle.cs @@ -13,20 +13,39 @@ namespace OpenTK.Graphics /// /// Represents a handle to cached text. /// - public class TextHandle : IDisposable + public abstract class TextHandle : IDisposable { - internal TextHandle(int handle) + /// + /// Constructs a new TextHandle, + /// + /// + public TextHandle(int handle) { Handle = handle; } + private int handle; + protected TextureFont font; + protected bool disposed; + /// - /// The handle of the cached text. Call the OpenTK.Graphics.ITextPrinter.Draw() method + /// Gets the handle of the cached text run. Call the OpenTK.Graphics.ITextPrinter.Draw() method /// to draw the text represented by this TextHandle. /// - public readonly int Handle; - internal TextureFont font; - protected bool disposed; + public int Handle + { + get { return handle; } + protected set { handle = value; } + } + + /// + /// Gets the TextureFont used for this text run. + /// + public TextureFont Font + { + get { return font; } + internal set { font = value; } + } #region public override string ToString() diff --git a/Source/Utilities/Fonts/TextPrinter.cs b/Source/Utilities/Fonts/TextPrinter.cs index f46f5c4e..3e713800 100644 --- a/Source/Utilities/Fonts/TextPrinter.cs +++ b/Source/Utilities/Fonts/TextPrinter.cs @@ -162,7 +162,7 @@ namespace OpenTK.Graphics PerformLayout(text, font, width, wordWarp, alignment, rightToLeft, ref vertices, ref indices, out num_indices); handle = Printer.Load(vertices, indices, num_indices); - handle.font = font; + handle.Font = font; } #endregion @@ -276,7 +276,7 @@ namespace OpenTK.Graphics /// The TextHandle to the cached text. public void Draw(TextHandle handle) { - GL.BindTexture(TextureTarget.Texture2D, handle.font.Texture); + GL.BindTexture(TextureTarget.Texture2D, handle.Font.Texture); Printer.Draw(handle); }