public override void UpdateRunWidth() { //*** var textBufferSpan = new Typography.Text.TextBufferSpan(_mybuffer); //TODO: review here, //1. if mybuffer lenght is not changed,we don't need to alloc new array? _outputUserCharAdvances = new int[_mybuffer.Length]; if (_renderVxFormattedString != null) { _renderVxFormattedString.Dispose(); _renderVxFormattedString = null; } var measureResult = new TextSpanMeasureResult(); measureResult.outputXAdvances = _outputUserCharAdvances; if (_content_unparsed) { //parse the content first if (_lineSegs == null) { _lineSegs = new TextPrinterLineSegmentList <TextPrinterLineSegment>(); } _lineSegs.Clear(); // if (s_wordVistor == null) { s_wordVistor = new TextPrinterWordVisitor(); } s_wordVistor.SetLineSegmentList(_lineSegs); RunStyle.BreakToLineSegments(textBufferSpan, s_wordVistor); s_wordVistor.SetLineSegmentList(null); //BreakToLineSegs(textBufferSpan); } _content_unparsed = false; RunStyle.CalculateUserCharGlyphAdvancePos(textBufferSpan, _lineSegs, ref measureResult); SetSize(measureResult.outputTotalW, measureResult.lineHeight); InvalidateGraphics(); }