TextLineBounds snipping bottom of letters

杀马特。学长 韩版系。学妹 提交于 2019-12-08 06:45:49

问题


I'm using TextLineBounds in Windows 8.1 to align text of different font sizes on the baseline, such as

With the XAML looking like:

    <Grid x:Name="PageHeader">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="28" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="15" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="15" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="1"
                       VerticalAlignment="Bottom"
                       TextLineBounds="TrimToBaseline"
                       FontSize="50"
                       Text="OOO Big Font" />
            <TextBlock Grid.Column="3"
                       VerticalAlignment="Bottom"
                       TextLineBounds="TrimToBaseline"
                       FontSize="26"
                       Text="OOO SmallerFont" />
            <TextBlock Grid.Column="5"
                       VerticalAlignment="Bottom"
                       TextLineBounds="TrimToBaseline"
                       FontSize="20"
                       Text="OOO Even Smaller Font" />
        </Grid>
     </Grid>

When I resize the window, at some point (before the minimum size of 500) the descenders are clipped (and I've also seen the bottom pixel or two across entire line get clipped even when there are no descenders - resulting in artifacts like a flattened O).

The display elements do not change on the resize, there's no modification due to visual state, etc.

It seems like a bug, but not sure if there's a workaround (other than to abandon use of TextLineBounds).

来源:https://stackoverflow.com/questions/27829414/textlinebounds-snipping-bottom-of-letters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!