Click or drag to resize
ReaderWmfLimitToScaleCustomTextWidth Property
Gets or sets a double that specifies at which ratio of custom sized text and its normal size a ScaleTransform is used on TextBlock. This value is only used when ProcessCharacterSpacing is set to true. Default value is 0.03;

Namespace: Ab2d
Assembly: Ab2d.ReaderWmf (in Ab2d.ReaderWmf.dll) Version: 7.1.5512.1040
Syntax
C#
public double LimitToScaleCustomTextWidth { get; set; }

Property Value

Type: Double
Remarks

Text in metafiles is often defined with defining character spacing (width of each character in text) that is used to exactly position each character in text.

TextBlock in WPF does not provide such functionality. To achieve similar results a ScaleTransform can be applied to TextBlock to scale the text according to character spacing data.

Because of different rendering technique, the TextBlock size is almost never the same as the sum of all character spacing. This means that if we wanted to be precise all TextBlocks would have a ScaleTransform applied to them. This would make the XAML more complex.

To prevent using too much ScaleTransform and on the other side still render correct image, the LimitToScaleCustomTextWidth can set a value that defined when to use ScaleTransform on TextBlock.

LimitToScaleCustomTextWidth is only used when ProcessCharacterSpacing is set to true.

To understand how the LimitToScaleCustomTextWidth is used we first need to understand that before using the LimitToScaleCustomTextWidth the widthFactor is calculated:
widthFactor = (sum of all character widths defined in metafile) / (measured with of TextBlock)
widthFactor represent x scale that should be applied to TextBlock to make it as long as defined in metafile.

The LimitToScaleCustomTextWidth is used to determine how much away from 1 the widthFactor should be to add ScaleTransform. The value 0.03 means the when the width in metafile is more than 3% away from the non-scaled WPF width, a ScaleTransform is added to TextBlock.

This means that lower values (closer to 0) will add more ScaleTransform and produce results more similar to metafiles. Bigger values will produce less ScaleTransforms but would make simpler XAML.

See Also