public BufferedString(String value, Int32 exactLength, Int32 textAttributes, TextJustification justification) { this.value = value; this.exactLength = exactLength; this.textAttributes = textAttributes; this.justification = justification; }
public void Smoke_Text_Justification() { var sumOfSquaresOfBlankSpaceEndingsInEachLine = TextJustification.GetJustification(new List <string>() { "Ramanu", "Dog", "likes", "to", "code" }, 10); Assert.AreEqual(26, sumOfSquaresOfBlankSpaceEndingsInEachLine); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { var gp = new GetPoint(); gp.SetCommandPrompt("Start point"); gp.AddOptionEnumList("Justification", m_justification); gp.ConstrainToConstructionPlane(false); for (;;) { var res = gp.Get(); if (res == GetResult.Option) { var option = gp.Option(); if (null != option) { var list = Enum.GetValues(typeof(TextJustification)).Cast <TextJustification>().ToList(); m_justification = list[option.CurrentListOptionIndex]; } continue; } if (res != GetResult.Point) { return(Result.Cancel); } break; } var point = gp.Point(); var plane = gp.View().ActiveViewport.ConstructionPlane(); plane.Origin = point; var text = new TextEntity { Plane = plane, Justification = m_justification }; text.PlainText = text.Justification.ToString(); var attr = new ObjectAttributes { ColorSource = ObjectColorSource.ColorFromObject, ObjectColor = Color.FromArgb(0, 0, 255) }; var object_id = doc.Objects.AddText(text, attr); RhinoApp.WriteLine("{0}", object_id.ToString()); doc.Views.Redraw(); return(Result.Success); }
public void TestMethod3(string[] words, int maxWidth, string[] expected) { // Arrange TextJustification question = new TextJustification(); // Act IList <string> actual = question.FullJustify(words, maxWidth); // Assert CollectionAssert.AreEqual(expected, actual?.ToArray()); }
public ZplSingleLineFieldBlock( string text, int positionX, int positionY, int width, ZplFont font, TextJustification textJustification = TextJustification.Left, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true, bool reversePrint = false) : base(text, positionX, positionY, width, font, 9999, 9999, textJustification, 0, newLineConversion, useHexadecimalIndicator, reversePrint) { }
private static TextAlignment JustificationToTextAlignment(TextJustification justification) { switch (justification) { case TextJustification.Right: return(TextAlignment.Center); case TextJustification.Center: return(TextAlignment.Center); default: return(TextAlignment.Left); } }
public void Test4_SingleWord() { //Given string[] words = new string[] { "Science" }; int maxWidth = 20; //When var sut = new TextJustification(); var justifiedText = sut.FullJustify(words, maxWidth); //Then justifiedText.Count.Should().Be(1); justifiedText[0].Should().Be("Science "); }
public void TestTextJustification() { var r = TextJustification.Do(new [] { "Science", "is", "what", "we", "understand", "well", "enough", "to", "explain", "to", "a", "computer.", "Art", "is", "everything", "else", "we", "do" }, 20); Assert.AreEqual(r[0], "Science is what we"); Assert.AreEqual(r[3], "a computer. Art is"); Assert.AreEqual(r[5], "do "); r = TextJustification.Do(new[] { "What", "must", "be", "acknowledgment", "shall", "be" }, 16); Assert.AreEqual(r[0], "What must be"); Assert.AreEqual(r[1], "acknowledgment "); Assert.AreEqual(r[2], "shall be "); }
public void Test2_LongWord() { //Given string[] words = new string[] { "What", "must", "be", "acknowledgment", "shall", "be" }; int maxWidth = 16; //When var sut = new TextJustification(); var justifiedText = sut.FullJustify(words, maxWidth); //Then justifiedText.Count.Should().Be(3); justifiedText[0].Should().Be("What must be"); justifiedText[1].Should().Be("acknowledgment "); justifiedText[2].Should().Be("shall be "); }
public vxMenuTheme(vxEngine Engine) : base(Engine) { TextJustification = TextJustification.Center; FineTune = new Vector2(0, 5); vxMenuItemWidth = 100; vxMenuItemHeight = 34; TitleColor = Color.White; TitlePosition = new Vector2(Engine.GraphicsDevice.Viewport.Width / 2, 80); BoundingRectangleOffset = new Vector2(0, 0); DrawBackgroungImage = true; }
public void Test1_Basic() { //Given string[] words = new string[] { "This", "is", "an", "example", "of", "text", "justification." }; int maxWidth = 16; //When var sut = new TextJustification(); var justifiedText = sut.FullJustify(words, maxWidth); //Then justifiedText.Count.Should().Be(3); justifiedText[0].Should().Be("This is an"); justifiedText[1].Should().Be("example of text"); justifiedText[2].Should().Be("justification. "); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { GetPoint gp = new GetPoint(); gp.SetCommandPrompt("Start point"); gp.AddOptionEnumList("Justification", m_justification); gp.ConstrainToConstructionPlane(false); for (;;) { GetResult res = gp.Get(); if (res == GetResult.Option) { CommandLineOption option = gp.Option(); if (null != option) { List <TextJustification> list = Enum.GetValues(typeof(TextJustification)).Cast <TextJustification>().ToList(); m_justification = list[option.CurrentListOptionIndex]; } continue; } else if (res != GetResult.Point) { return(Result.Cancel); } break; } Point3d point = gp.Point(); Plane plane = gp.View().ActiveViewport.ConstructionPlane(); plane.Origin = point; TextEntity text = new TextEntity(); text.Plane = plane; text.Justification = m_justification; text.Text = text.Justification.ToString(); doc.Objects.AddPoint(point); doc.Objects.AddText(text); doc.Views.Redraw(); return(Result.Success); }
/// <summary> /// Get Zpl char for text justification /// </summary> /// <param name="textJustification"></param> /// <returns></returns> public string RenderTextJustification(TextJustification textJustification) { switch (textJustification) { case TextJustification.Left: return("L"); case TextJustification.Center: return("C"); case TextJustification.Right: return("R"); case TextJustification.Justified: return("J"); } throw new NotImplementedException("Unknown Text Justification"); }
public void Test3_LongerText() { //Given string[] words = new string[] { "Science", "is", "what", "we", "understand", "well", "enough", "to", "explain", "to", "a", "computer.", "Art", "is", "everything", "else", "we", "do" }; int maxWidth = 20; //When var sut = new TextJustification(); var justifiedText = sut.FullJustify(words, maxWidth); //Then justifiedText.Count.Should().Be(6); justifiedText[0].Should().Be("Science is what we"); justifiedText[1].Should().Be("understand well"); justifiedText[2].Should().Be("enough to explain to"); justifiedText[3].Should().Be("a computer. Art is"); justifiedText[4].Should().Be("everything else we"); justifiedText[5].Should().Be("do "); }
public ZplFieldBlock( string text, int positionX, int positionY, int width, ZplFont font, int maxLineCount = 1, int lineSpace = 0, TextJustification textJustification = TextJustification.Left, int hangingIndent = 0, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToZplNewLine, bool useHexadecimalIndicator = true, bool reversePrint = false) : base(text, positionX, positionY, font, newLineConversion, useHexadecimalIndicator, reversePrint) { TextJustification = textJustification; Width = width; MaxLineCount = maxLineCount; LineSpace = lineSpace; HangingIndent = hangingIndent; }
// Draw a line of text. private static void DrawLine(Graphics gr, string line, Font font, Brush brush, float x, float y, float width, TextJustification justification) { // Make a rectangle to hold the text. RectangleF rect = new RectangleF(x, y, width, font.Height); // See if we should use full justification. if (justification == TextJustification.Full) { // Justify the text. DrawJustifiedLine(gr, rect, font, brush, line); } else { // Make a StringFormat to align the text. using (StringFormat sf = new StringFormat()) { // Use the appropriate alignment. switch (justification) { case TextJustification.Left: sf.Alignment = StringAlignment.Near; break; case TextJustification.Right: sf.Alignment = StringAlignment.Far; break; case TextJustification.Center: sf.Alignment = StringAlignment.Center; break; } gr.DrawString(line, font, brush, rect, sf); } } }
// Draw justified text on the Graphics // object in the indicated Rectangle. private static string DrawParagraphs(string text, Graphics gr, Font font, Brush brush, RectangleF rect, TextJustification justification, float line_spacing, float indent, float paragraph_spacing) { string totalLeftOverText = ""; string paraLeftOverText = ""; // Split the text into paragraphs. string[] paragraphs = text.Split('\n'); int paraCurrentIndex = 0; // Draw each paragraph. while (paraCurrentIndex < paragraphs.Length) { // Draw the paragraph keeping track of remaining space. (rect, paraLeftOverText) = DrawParagraph(gr, rect, font, brush, paragraphs[paraCurrentIndex], justification, line_spacing, indent, paragraph_spacing); // See if there's any room left. if (rect.Height < font.Size || !string.IsNullOrEmpty(paraLeftOverText)) { totalLeftOverText = (string.IsNullOrEmpty(paraLeftOverText)) ? "" : (paraLeftOverText + "\n"); if (paraCurrentIndex < paragraphs.Length - 1) { paraCurrentIndex = paraCurrentIndex + 1; totalLeftOverText = totalLeftOverText + string.Join("\n", paragraphs, paraCurrentIndex, paragraphs.Length - paraCurrentIndex); } break; } paraCurrentIndex = paraCurrentIndex + 1; } return(totalLeftOverText); }
/// <summary> /// Prints the possible content of input text to Page as per the space availablity and returns back the left over text /// </summary> /// <param name="stringToPrint"></param> /// <param name="graphics"></param> /// <param name="printFont"></param> /// <param name="brush"></param> /// <param name="rectF"></param> /// <param name="textJustification"></param> /// <returns></returns> public static string PrintPage(string stringToPrint, Graphics graphics, Font printFont, Brush brush, RectangleF rectF, TextJustification textJustification) { return(DrawParagraphs(stringToPrint, graphics, printFont, brush, rectF, TextJustification.Full, 1, 1, 0)); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { Plane plane = new Plane(); string text = ""; double size = 5; int justify = 0; string font = ""; bool bold = false; double offsetDis = 0; DA.GetData("Location", ref plane); DA.GetData("Text", ref text); DA.GetData("Size", ref size); DA.GetData("Justification", ref justify); DA.GetData("Font", ref font); DA.GetData("Bold", ref bold); DA.GetData("OffsetDistance", ref offsetDis); if (justify < 0 || justify > 8) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid Justification.Only 0-8 are allowed."); justify = 4; } TextJustification justification = TextJustification.MiddleCenter; if (justify == 0) { Message = "BottomLeft"; justification = TextJustification.BottomLeft; } else if (justify == 1) { Message = "BottomCenter"; justification = TextJustification.BottomCenter; } else if (justify == 2) { Message = "BottomRight"; justification = TextJustification.BottomRight; } else if (justify == 3) { Message = "MiddleLeft"; justification = TextJustification.MiddleLeft; } else if (justify == 4) { Message = "MiddleCenter"; justification = TextJustification.MiddleCenter; } else if (justify == 5) { Message = "MiddleRight"; justification = TextJustification.MiddleRight; } else if (justify == 6) { Message = "TopLeft"; justification = TextJustification.TopLeft; } else if (justify == 7) { Message = "TopCenter"; justification = TextJustification.TopCenter; } else if (justify == 8) { Message = "TopRight"; justification = TextJustification.TopRight; } TextEntity t = new TextEntity(); t.Plane = plane; t.PlainText = text; t.DimensionScale = size; t.Font = Rhino.DocObjects.Font.InstalledFonts(font)[0]; t.Justification = justification; t.SetBold(bold); List <Curve> curves = new List <Curve>(t.Explode()); List <Point3d> boxCorner = new List <Point3d>(); foreach (Curve crv in curves) { foreach (Point3d pt in crv.GetBoundingBox(plane).GetCorners()) { boxCorner.Add(pt); } } Box box = new Box(plane, new BoundingBox(boxCorner)); Point3d[] corners = box.GetCorners(); Point3d[] pts = new Point3d[5] { corners[0], corners[1], corners[2], corners[3], corners[0] }; PolylineCurve polyCrv = new PolylineCurve(pts); Curve bound; if (offsetDis == 0) { bound = polyCrv; } else { bound = polyCrv.Offset(plane, offsetDis, GH_Component.DocumentTolerance(), CurveOffsetCornerStyle.Round)[0]; } DA.SetDataList("Curve", curves); DA.SetData("Bound", bound); }
public static void DrawCustomText(string Message, float FontSize, Font FontType, int Red, int Green, int Blue, int Alpha, float XPos, float YPos, TextJustification justifyType = TextJustification.Left, bool ForceTextWrap = false, float startWrap = 0f, float endWrap = 1f, bool withRectangle = false, int R = 0, int G = 0, int B = 0, int A = 255, float rectWidthOffset = 0f, float rectHeightOffset = 0f, float rectYPosDivisor = 23.5f) { Function.Call(Hash._SET_TEXT_ENTRY, "jamyfafi"); //Required, don't change this! AKA BEGIN_TEXT_COMMAND_DISPLAY_TEXT Function.Call(Hash.SET_TEXT_SCALE, FontSize, FontSize); //1st param: 1.0f Function.Call(Hash.SET_TEXT_FONT, (int)FontType); Function.Call(Hash.SET_TEXT_COLOUR, Red, Green, Blue, Alpha); //Function.Call(Hash.SET_TEXT_DROPSHADOW, 0, 0, 0, 0, 0); Function.Call(Hash.SET_TEXT_DROP_SHADOW, 1, 1, 1, 1, 1); Function.Call(Hash.SET_TEXT_JUSTIFICATION, (int)justifyType); if (justifyType == TextJustification.Right || ForceTextWrap) { Function.Call(Hash.SET_TEXT_WRAP, startWrap, endWrap); } //Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, Message); AddLongString(Message); Function.Call(Hash._DRAW_TEXT, XPos, YPos); //AKA END_TEXT_COMMAND_DISPLAY_TEXT if (withRectangle) { switch (FontType) { case Font.ChaletLondon: rectYPosDivisor = 15f; break; case Font.HouseScript: rectYPosDivisor = 23f; break; case Font.Monospace: rectYPosDivisor = 25f; break; case Font.ChaletComprimeCologne: rectYPosDivisor = 30f; break; case Font.Pricedown: rectYPosDivisor = 35f; break; } var adjWidth = MeasureStringWidthNoConvert(Message, FontType, FontSize); var fontHeight = MeasureFontHeightNoConvert(FontSize, FontType); var rectangleWidth = endWrap - startWrap + rectWidthOffset; var baseYPos = YPos + FontSize / rectYPosDivisor; //int numLines = (int)Math.Ceiling(adjWidth / ((endWrap - startWrap) * 0.98f)); var numLines = GetStringLineCount(Message, FontSize, FontType, startWrap, endWrap, XPos, YPos); for (var i = 0; i < numLines; i++) { var adjustedYPos = i == 0 ? baseYPos - rectHeightOffset / 2 : (i == numLines - 1 ? baseYPos + rectHeightOffset / 2 : baseYPos); var adjustedRectangleHeight = i == 0 || i == numLines - 1 ? fontHeight + rectHeightOffset : fontHeight; var adjustedXPos = justifyType == TextJustification.Left ? XPos + (endWrap - startWrap) / 2 : (justifyType == TextJustification.Right ? endWrap - (endWrap - startWrap) / 2 : XPos); DrawRectangle(adjustedXPos, adjustedYPos + i * fontHeight, rectangleWidth, adjustedRectangleHeight, R, G, B, A); } } }
public Request Append(String data, Int32 exactLength, TextJustification justification) { if (data.Length > exactLength) data = data.Substring(0, exactLength); else { if (data.Length < exactLength) { switch (justification) { case TextJustification.Left: data = data.PadRight(exactLength); break; case TextJustification.Center: var spaces = new String(' ', (exactLength - data.Length) / 2); data = String.Concat(spaces, data, spaces); break; default: data = data.PadLeft(exactLength); break; } } } return Append(data); }
static extern bool gimp_text_layer_set_justification(Int32 layer_ID, TextJustification justify);
// Draw a paragraph by lines inside the Rectangle. // Return a RectangleF representing any unused // space in the original RectangleF. private static (RectangleF, string) DrawParagraph(Graphics gr, RectangleF rect, Font font, Brush brush, string text, TextJustification justification, float line_spacing, float indent, float extra_paragraph_spacing) { string leftOverText = ""; // Get the coordinates for the first line. float y = rect.Top; // Break the text into words. string[] words = text.Split(' '); int currentWordIndex = 0; int endWordIndex = 0; // Repeat until we run out of text or room. for (; ;) { // See how many words will fit. // Start with just the next word. string line = words[currentWordIndex]; // Add more words until the line won't fit. endWordIndex = currentWordIndex + 1; while (endWordIndex < words.Length) { // See if the next word fits. string test_line = line + " " + words[endWordIndex]; SizeF line_size = gr.MeasureString(test_line, font); if (line_size.Width > rect.Width) { // The line is too wide. Don't use the last word. endWordIndex--; break; } else { // The word fits. Save the test line. line = test_line; } // Try the next word. endWordIndex++; } // See if this is the last line in the paragraph. if ((endWordIndex == words.Length) && (justification == TextJustification.Full)) { // This is the last line. Don't justify it. DrawLine(gr, line, font, brush, rect.Left + indent, y, rect.Width - indent, TextJustification.Left); } else { // This is not the last line. Justify it. DrawLine(gr, line, font, brush, rect.Left + indent, y, rect.Width - indent, justification); } // Move down to draw the next line. y += font.Height * line_spacing; // Make sure there's room for another line. if (y > rect.Bottom) { break; } // Start the next line at the next word. currentWordIndex = endWordIndex + 1; if (currentWordIndex >= words.Length) { break; } // Don't indent subsequent lines in this paragraph. indent = 0; } // Add a gap after the paragraph. y += font.Height * extra_paragraph_spacing; // Return a RectangleF representing any unused // space in the original RectangleF. float height = rect.Bottom - y - (float)0.5; if (height < 0) { height = 0; } // left over text if (endWordIndex < words.Length) { endWordIndex = endWordIndex + 1; leftOverText = string.Join(" ", words, endWordIndex, words.Length - endWordIndex); } return(new RectangleF(rect.X, y, rect.Width, height), leftOverText); }
public void TestTextJustification(string sentence, int maximumLineLength) { var words = sentence.Split(" ").ToList(); var textJustificationSolver = new TextJustification(); var optimalLines = textJustificationSolver.GetOptimalLineSpacing(words, maximumLineLength); }
protected internal TextField(string text, TextJustification positioning, ConsoleColor backgroundColour, ConsoleColor forgoundColour) : base(new Renderable { Text = text, Position = positioning, Background = backgroundColour, Forground = forgoundColour }) { }
/// <summary> /// A simple text label to display to the user /// </summary> /// <param name="text">The content to display</param> /// <param name="positioning">The text justification (centered or left aligned)</param> /// <param name="backgroundColor">The forground color for the text</param> /// <param name="forgroundColor">The background color for the text</param> public TextField AddText(string text, TextJustification positioning = TextJustification.Left, ConsoleColor?backgroundColor = null, ConsoleColor?forgroundColor = null) => Add(new TextField(text, positioning, backgroundColor ?? this.backgroundColor, forgroundColor ?? this.foregroundColor)).Single();
void DrawCustomText(string Message, float FontSize, int FontType, int Red, int Green, int Blue, int Alpha, float XPos, float YPos, TextJustification justifyType = TextJustification.Left, bool ForceTextWrap = false) { Function.Call(Hash.SET_TEXT_SCALE, 0.0f, FontSize); Function.Call(Hash.SET_TEXT_FONT, FontType); Function.Call(Hash.SET_TEXT_COLOUR, Red, Green, Blue, Alpha); //Function.Call(Hash.SET_TEXT_DROPSHADOW, 0, 0, 0, 0, 0); Function.Call(Hash.SET_TEXT_JUSTIFICATION, (int)justifyType); if (justifyType == TextJustification.Right || ForceTextWrap) { Function.Call(Hash.SET_TEXT_WRAP, xPosItemText, xPosItemValue); } Function.Call(Hash._SET_TEXT_ENTRY, "STRING"); //Required, don't change this! AKA BEGIN_TEXT_COMMAND_DISPLAY_TEXT //Function.Call(Hash._0x54CE8AC98E120CAB, "STRING"); //Required, don't change this! AKA BEGIN_TEXT_COMMAND_WIDTH Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, Message); Function.Call(Hash._DRAW_TEXT, XPos, YPos); //AKA END_TEXT_COMMAND_DISPLAY_TEXT //Function.Call<float>(Hash._0x85F061DA64ED2F67, XPos, YPos); //AKA END_TEXT_COMMAND_GET_WIDTH }
/// <summary> /// Prints some text on the screen within a rectangle with justification /// </summary> /// <param name="batch">Spritebatch handle</param> /// <param name="zone">Rectangle of the text</param> /// <param name="justification">Text justifcation</param> /// <param name="color">Text color</param> /// <param name="text">Text to print</param> internal void DrawText(SpriteBatch batch, Vector4 zone, TextJustification justification, Color color, string text) { if (string.IsNullOrEmpty(text) || batch == null) { return; } if (GlyphTileset == null) { } // Encode string to xml string msg = "<?xml version=\"1.0\" encoding=\"unicode\" standalone=\"yes\"?><root>" + text + "</root>"; UnicodeEncoding utf8 = new UnicodeEncoding(); byte[] buffer = utf8.GetBytes(msg); MemoryStream stream = new MemoryStream(buffer); XmlTextReader reader = new XmlTextReader(stream); reader.WhitespaceHandling = WhitespaceHandling.All; // Color stack Stack <Color> ColorStack = new Stack <Color>(); ColorStack.Push(color); Color currentcolor = color; Vector4 rect = zone; // Extra offset when displaying tile int tileoffset = 0; try { // Skip the first tags "<?...?>" and "<root>" reader.MoveToContent(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Attribute: { } break; #region control tags // Special tags case XmlNodeType.Element: { switch (reader.Name.ToLower()) { case "tile": { if (TextTileset == null) { break; } int id = int.Parse(reader.GetAttribute("id")); Tile tile = TextTileset.GetTile(id); batch.DrawTile(TextTileset, id, rect.Xy, Color.White); rect.X += tile.Size.Width; //rect.Offset(tile.Size.Width, 0); tileoffset = tile.Size.Height - LineHeight; } break; case "br": { rect.X = zone.X; rect.Y += (int)(LineHeight * GlyphTileset.Scale.Y) + tileoffset + Interline; tileoffset = 0; } break; // Change the color case "color": { ColorStack.Push(currentcolor); currentcolor = Color.FromArgb(int.Parse(reader.GetAttribute("a")), int.Parse(reader.GetAttribute("r")), int.Parse(reader.GetAttribute("g")), int.Parse(reader.GetAttribute("b"))); } break; } } break; #endregion #region closing control tags case XmlNodeType.EndElement: { switch (reader.Name.ToLower()) { case "color": { currentcolor = ColorStack.Pop(); } break; } } break; #endregion #region Raw text case XmlNodeType.Text: { foreach (char c in reader.Value) { // Get the tile Tile tile = GlyphTileset.GetTile(c - GlyphOffset); if (tile == null) { continue; } // Move the glyph according to its origin Vector4 tmp = new Vector4( rect.X - tile.Pivot.X * GlyphTileset.Scale.X, rect.Y - tile.Pivot.Y * GlyphTileset.Scale.Y, tile.Rectangle.Width * GlyphTileset.Scale.X, tile.Rectangle.Height * GlyphTileset.Scale.Y); // Out of the bouding box => new line if (tmp.Right >= zone.Right && zone.Size != Vector2.Zero) { tmp.X = zone.X; tmp.Y = tmp.Y + (LineHeight * GlyphTileset.Scale.Y); rect.X = zone.X; rect.Y += (LineHeight * GlyphTileset.Scale.Y) + tileoffset + Interline; tileoffset = 0; } // Add glyph to the batch batch.DrawTile(GlyphTileset, c - GlyphOffset, tmp.Xy, currentcolor); // Move to the next glyph rect.X += tmp.Width + Advance; //rect = Vector4.Add(rect, new Vector4(tmp.Width + Advance, 0.0f, 0.0f, 0.0f)); } } break; #endregion } } } catch (XmlException ex) { } finally { // Close streams reader.Close(); stream.Close(); } }