From 5e449dabd4cc4ed16af9f8d1cf4b7db990d634aa Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Mon, 24 Nov 2008 18:02:57 +0000 Subject: [PATCH] Add 2 pixels of space between packed glyphs, to avoid rendering artifacts. --- Source/Utilities/Graphics/Text/GlyphPacker.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Utilities/Graphics/Text/GlyphPacker.cs b/Source/Utilities/Graphics/Text/GlyphPacker.cs index 1a492aa5..90e9c4ce 100644 --- a/Source/Utilities/Graphics/Text/GlyphPacker.cs +++ b/Source/Utilities/Graphics/Text/GlyphPacker.cs @@ -41,13 +41,17 @@ namespace OpenTK.Graphics.Text throw new InvalidOperationException("The item is too large for this TexturePacker"); Node node; + // Increase size so that the glyphs do not touch each other (to avoid rendering artifacts). + boundingBox.Width += 2; + boundingBox.Height += 2; node = root.Insert(boundingBox); // Tree is full and insertion failed: if (node == null) throw new TexturePackerFullException(); - return node.Rectangle; + return new Rectangle(node.Rectangle.X, node.Rectangle.Y, node.Rectangle.Width - 2, node.Rectangle.Height - 2); + //return node.Rectangle; } #endregion