Hi,@HoWe Yu. Welcome to Microsoft Q&A.
If you want the text rendered by Glyphs
and TextBlock
to be consistent, you could refer to the following solution.
You need to cancel the additional settings for TextBlock
: you need to delete <Window>'s TextOptions.TextFormattingMode="Display"
.
Related code
<Window
...
WindowStartupLocation="CenterScreen"
Background="#FFFFFF"
TextOptions.TextRenderingMode="Aliased"
Title="MainWindow" Height="720" Width="1280">
<Grid x:Name="MainGrid">
<Grid x:Name="PaperBox" Margin="0"></Grid>
<Glyphs x:Name="MyGlyphs" FontUri="C:\WINDOWS\Fonts\simsun.ttc" FontRenderingEmSize="13" UnicodeString="Hello World!" Fill="Black" OriginX="100" OriginY="80" />
<TextBlock x:Name="MyTextBlock" Text="Hello World!" FontFamily="NSimSun" FontSize="13" FontWeight="Normal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="100"></TextBlock>
</Grid>
</Window>
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.