Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent text to pixelize when I use RenderTransform?

When I use RenderTransform property and scale up a RichTextBox I get magnified text which is pixelized (square text edges).

How I can prevent this? enter image description here

EDIT:

I have TextOptions.TextFormattingMode="Display" - when I remove this option everything is fine!

like image 787
Alfa07 Avatar asked May 01 '11 19:05

Alfa07


2 Answers

Cannot claim that i can reproduce this with my current settings:

enter image description here

That is with a scale of 20. I think this could be dependent on the ClearType system settings, you can try setting RenderOptions.ClearTypeHint="Enabled" on the RichTextbox, that might enforce it.

Also try setting TextOptions.TextRenderingMode="ClearType".

Edit: This SO question deals with text-rendering quite in-depth and might be helpful.


Edit: Check out this weirdness:

<TextBlock Text="Lorem ipsum dolor sit"
           FontSize="20" TextOptions.TextFormattingMode="Display">
     <TextBlock.RenderTransform>
           <ScaleTransform x:Name="trans" ScaleY="10" ScaleX="10"/>
     </TextBlock.RenderTransform>
     <TextBlock.Triggers>
        <EventTrigger RoutedEvent="Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation To="20" Duration="0:0:5"
                                     Storyboard.TargetName="trans" Storyboard.TargetProperty="ScaleX"/>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
     </TextBlock.Triggers>
</TextBlock>

As soon as a certain scale is reached the text becomes clear for me, really odd...

like image 63
H.B. Avatar answered Oct 23 '22 00:10

H.B.


This worked for me:

TextOptions.TextFormattingMode="Ideal"

as suggested on: http://www.newventuresoftware.com/blog/wpf-text-rendering-quirks-scaletransform

like image 1
12 Foot Lanai Avatar answered Oct 23 '22 00:10

12 Foot Lanai