/// <summary> /// Get inline object's measurement metrics. /// </summary> /// <param name="remainingParagraphWidth">Remaining paragraph width.</param> /// <returns>Inline object metrics.</returns> public override TextEmbeddedObjectMetrics Format(double remainingParagraphWidth) { Size desiredSize = _host.MeasureChild(this); // Make sure that LS/PTS limitations are not exceeded for object's size. TextDpi.EnsureValidObjSize(ref desiredSize); double baseline = desiredSize.Height; double baselineOffsetValue = (double)UIElementIsland.Root.GetValue(TextBlock.BaselineOffsetProperty); if (!double.IsNaN(baselineOffsetValue)) { baseline = baselineOffsetValue; } return(new TextEmbeddedObjectMetrics(desiredSize.Width, desiredSize.Height, baseline)); }