mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 16:05:31 +00:00
Moved TextExtents to OpenTK.Graphics.
Added documentation to all public classes and interfaces.
This commit is contained in:
parent
c18b522763
commit
538198776b
|
@ -17,19 +17,125 @@ namespace OpenTK.Graphics
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ITextPrinter : IDisposable
|
public interface ITextPrinter : IDisposable
|
||||||
{
|
{
|
||||||
void Begin();
|
#region Print
|
||||||
void End();
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
void Print(string text, Font font, Color color);
|
void Print(string text, Font font, Color color);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
void Print(string text, Font font, Color color, RectangleF rect);
|
void Print(string text, Font font, Color color, RectangleF rect);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to print text.</param>
|
||||||
void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options);
|
void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to print text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to print text.</param>
|
||||||
void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment);
|
void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to print text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to print text.</param>
|
||||||
|
/// <param name="direction">The OpenTK.Graphics.TextDirection that will be used to print text.</param>
|
||||||
void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction);
|
void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Measure
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
TextExtents Measure(string text, Font font);
|
TextExtents Measure(string text, Font font);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to measure text.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
TextExtents Measure(string text, Font font, RectangleF rect);
|
TextExtents Measure(string text, Font font, RectangleF rect);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to measure text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to measure text.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options);
|
TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to measure text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to measure text.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options, TextAlignment alignment);
|
TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options, TextAlignment alignment);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to measure text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to measure text.</param>
|
||||||
|
/// <param name="direction">The OpenTK.Graphics.TextDirection that will be used to measure text.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction);
|
TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obsolete
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
|
void Begin();
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
|
void End();
|
||||||
|
|
||||||
[Obsolete("Use TextPrinter.Print instead")]
|
[Obsolete("Use TextPrinter.Print instead")]
|
||||||
void Draw(TextHandle handle);
|
void Draw(TextHandle handle);
|
||||||
|
|
||||||
|
@ -38,5 +144,7 @@ namespace OpenTK.Graphics
|
||||||
|
|
||||||
[Obsolete("Use TextPrinter.Print instead")]
|
[Obsolete("Use TextPrinter.Print instead")]
|
||||||
void Prepare(string text, TextureFont font, out TextHandle handle);
|
void Prepare(string text, TextureFont font, out TextHandle handle);
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,11 @@ using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace OpenTK.Graphics.Text
|
namespace OpenTK.Graphics
|
||||||
{
|
{
|
||||||
// Holds layout information about a TextBlock.
|
/// <summary>
|
||||||
|
/// Holds the results of a text measurement.
|
||||||
|
/// </summary>
|
||||||
public class TextExtents : IDisposable
|
public class TextExtents : IDisposable
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -54,39 +56,42 @@ namespace OpenTK.Graphics.Text
|
||||||
|
|
||||||
#region Public Members
|
#region Public Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the bounding box of the measured text.
|
||||||
|
/// </summary>
|
||||||
public RectangleF BoundingBox
|
public RectangleF BoundingBox
|
||||||
{
|
{
|
||||||
get { return text_extents; }
|
get { return text_extents; }
|
||||||
internal set { text_extents = value; }
|
internal set { text_extents = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the extents of each glyph in the measured text.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="i">The index of the glyph.</param>
|
||||||
|
/// <returns>The extents of the specified glyph.</returns>
|
||||||
public RectangleF this[int i]
|
public RectangleF this[int i]
|
||||||
{
|
{
|
||||||
get { return glyph_extents[i]; }
|
get { return glyph_extents[i]; }
|
||||||
internal set { glyph_extents[i] = value; }
|
internal set { glyph_extents[i] = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the extents of each glyph in the measured text.
|
||||||
|
/// </summary>
|
||||||
public IEnumerable<RectangleF> GlyphExtents
|
public IEnumerable<RectangleF> GlyphExtents
|
||||||
{
|
{
|
||||||
get
|
get { return (IEnumerable<RectangleF>)glyph_extents; }
|
||||||
{
|
|
||||||
return (IEnumerable<RectangleF>)glyph_extents;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of the measured glyphs.
|
||||||
|
/// </summary>
|
||||||
public int Count
|
public int Count
|
||||||
{
|
{
|
||||||
get { return glyph_extents.Count; }
|
get { return glyph_extents.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextExtents Clone()
|
|
||||||
{
|
|
||||||
TextExtents extents = new TextExtents();
|
|
||||||
extents.glyph_extents.AddRange(GlyphExtents);
|
|
||||||
extents.BoundingBox = BoundingBox;
|
|
||||||
return extents;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Internal Members
|
#region Internal Members
|
||||||
|
@ -107,10 +112,21 @@ namespace OpenTK.Graphics.Text
|
||||||
glyph_extents.Clear();
|
glyph_extents.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal TextExtents Clone()
|
||||||
|
{
|
||||||
|
TextExtents extents = new TextExtents();
|
||||||
|
extents.glyph_extents.AddRange(GlyphExtents);
|
||||||
|
extents.BoundingBox = BoundingBox;
|
||||||
|
return extents;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDisposable Members
|
#region IDisposable Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Frees the resources consumed by this TextExtents instance.
|
||||||
|
/// </summary>
|
||||||
public virtual void Dispose()
|
public virtual void Dispose()
|
||||||
{
|
{
|
||||||
}
|
}
|
|
@ -41,11 +41,15 @@ namespace OpenTK.Graphics
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new TextPrinter object.
|
/// Constructs a new TextPrinter instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TextPrinter()
|
public TextPrinter()
|
||||||
: this(null, null, TextQuality.Default) { }
|
: this(null, null, TextQuality.Default) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new TextPrinter instance with the specified TextQuality level.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="quality">The desired TextQuality of this TextPrinter.</param>
|
||||||
public TextPrinter(TextQuality quality)
|
public TextPrinter(TextQuality quality)
|
||||||
: this(null, null, quality) { }
|
: this(null, null, quality) { }
|
||||||
|
|
||||||
|
@ -62,26 +66,66 @@ namespace OpenTK.Graphics
|
||||||
|
|
||||||
#region Print
|
#region Print
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
public void Print(string text, Font font, Color color)
|
public void Print(string text, Font font, Color color)
|
||||||
{
|
{
|
||||||
Print(text, font, color, RectangleF.Empty, TextPrinterOptions.Default, TextAlignment.Near, TextDirection.LeftToRight);
|
Print(text, font, color, RectangleF.Empty, TextPrinterOptions.Default, TextAlignment.Near, TextDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
public void Print(string text, Font font, Color color, RectangleF rect)
|
public void Print(string text, Font font, Color color, RectangleF rect)
|
||||||
{
|
{
|
||||||
Print(text, font, color, rect, TextPrinterOptions.Default, TextAlignment.Near, TextDirection.LeftToRight);
|
Print(text, font, color, rect, TextPrinterOptions.Default, TextAlignment.Near, TextDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to print text.</param>
|
||||||
public void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options)
|
public void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options)
|
||||||
{
|
{
|
||||||
Print(text, font, color, rect, options, TextAlignment.Near, TextDirection.LeftToRight);
|
Print(text, font, color, rect, options, TextAlignment.Near, TextDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to print text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to print text.</param>
|
||||||
public void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment)
|
public void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment)
|
||||||
{
|
{
|
||||||
Print(text, font, color, rect, options, alignment, TextDirection.LeftToRight);
|
Print(text, font, color, rect, options, alignment, TextDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints text using the specified color and layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to print.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to print text.</param>
|
||||||
|
/// <param name="color">The System.Drawing.Color that will be used to print text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to print text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to print text.</param>
|
||||||
|
/// <param name="direction">The OpenTK.Graphics.TextDirection that will be used to print text.</param>
|
||||||
public void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction)
|
public void Print(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction)
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
|
@ -97,27 +141,66 @@ namespace OpenTK.Graphics
|
||||||
|
|
||||||
#region Measure
|
#region Measure
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
public TextExtents Measure(string text, Font font)
|
public TextExtents Measure(string text, Font font)
|
||||||
{
|
{
|
||||||
return Measure(text, font, RectangleF.Empty, TextPrinterOptions.Default, TextAlignment.Near, TextDirection.LeftToRight);
|
return Measure(text, font, RectangleF.Empty, TextPrinterOptions.Default, TextAlignment.Near, TextDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
public TextExtents Measure(string text, Font font, RectangleF rect)
|
public TextExtents Measure(string text, Font font, RectangleF rect)
|
||||||
{
|
{
|
||||||
return Measure(text, font, rect, TextPrinterOptions.Default, TextAlignment.Near, TextDirection.LeftToRight);
|
return Measure(text, font, rect, TextPrinterOptions.Default, TextAlignment.Near, TextDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to measure text.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
public TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options)
|
public TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options)
|
||||||
{
|
{
|
||||||
return Measure(text, font, rect, options, TextAlignment.Near, TextDirection.LeftToRight);
|
return Measure(text, font, rect, options, TextAlignment.Near, TextDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to measure text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to measure text.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
public TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options, TextAlignment alignment)
|
public TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options, TextAlignment alignment)
|
||||||
{
|
{
|
||||||
return Measure(text, font, rect, options, alignment, TextDirection.LeftToRight);
|
return Measure(text, font, rect, options, alignment, TextDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures text using the specified layout options.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The System.String to measure.</param>
|
||||||
|
/// <param name="font">The System.Drawing.Font that will be used to measure text.</param>
|
||||||
|
/// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
|
||||||
|
/// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to measure text.</param>
|
||||||
|
/// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to measure text.</param>
|
||||||
|
/// <param name="direction">The OpenTK.Graphics.TextDirection that will be used to measure text.</param>
|
||||||
|
/// <returns>An OpenTK.Graphics.TextExtents instance that contains the results of the measurement.</returns>
|
||||||
public TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction)
|
public TextExtents Measure(string text, Font font, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction)
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
|
@ -260,6 +343,9 @@ namespace OpenTK.Graphics
|
||||||
|
|
||||||
#region IDisposable Members
|
#region IDisposable Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Frees the resources consumed by this TextPrinter object.
|
||||||
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
|
|
|
@ -4,11 +4,18 @@ using System.Text;
|
||||||
|
|
||||||
namespace OpenTK.Graphics
|
namespace OpenTK.Graphics
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines available quality levels for text printing.
|
||||||
|
/// </summary>
|
||||||
public enum TextQuality
|
public enum TextQuality
|
||||||
{
|
{
|
||||||
|
/// <summary>Use the default quality, as specified by the operating system.</summary>
|
||||||
Default = 0,
|
Default = 0,
|
||||||
|
/// <summary>Use fast, low quality text (typically non-antialiased) .</summary>
|
||||||
Low,
|
Low,
|
||||||
|
/// <summary>Use medium quality text (typically grayscale antialiased).</summary>
|
||||||
Medium,
|
Medium,
|
||||||
|
/// <summary>Use slow, high quality text (typically subpixel antialiased).</summary>
|
||||||
High
|
High
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue