@@ -104,23 +104,32 @@ public override void Render(DrawingContext context)
104
104
if ( _inlines . Count == 0 )
105
105
return ;
106
106
107
- var height = Bounds . Height ;
108
- var width = Bounds . Width ;
109
- foreach ( var inline in _inlines )
107
+ var ro = new RenderOptions ( )
110
108
{
111
- if ( inline . X > width )
112
- return ;
109
+ TextRenderingMode = TextRenderingMode . SubpixelAntialias ,
110
+ EdgeMode = EdgeMode . Antialias
111
+ } ;
113
112
114
- if ( inline . Element is { Type : Models . InlineElementType . Code } )
115
- {
116
- var rect = new Rect ( inline . X , ( height - inline . Text . Height - 2 ) * 0.5 , inline . Text . WidthIncludingTrailingWhitespace + 8 , inline . Text . Height + 2 ) ;
117
- var roundedRect = new RoundedRect ( rect , new CornerRadius ( 4 ) ) ;
118
- context . DrawRectangle ( InlineCodeBackground , null , roundedRect ) ;
119
- context . DrawText ( inline . Text , new Point ( inline . X + 4 , ( height - inline . Text . Height ) * 0.5 ) ) ;
120
- }
121
- else
113
+ using ( context . PushRenderOptions ( ro ) )
114
+ {
115
+ var height = Bounds . Height ;
116
+ var width = Bounds . Width ;
117
+ foreach ( var inline in _inlines )
122
118
{
123
- context . DrawText ( inline . Text , new Point ( inline . X , ( height - inline . Text . Height ) * 0.5 ) ) ;
119
+ if ( inline . X > width )
120
+ return ;
121
+
122
+ if ( inline . Element is { Type : Models . InlineElementType . Code } )
123
+ {
124
+ var rect = new Rect ( inline . X , ( height - inline . Text . Height - 2 ) * 0.5 , inline . Text . WidthIncludingTrailingWhitespace + 8 , inline . Text . Height + 2 ) ;
125
+ var roundedRect = new RoundedRect ( rect , new CornerRadius ( 4 ) ) ;
126
+ context . DrawRectangle ( InlineCodeBackground , null , roundedRect ) ;
127
+ context . DrawText ( inline . Text , new Point ( inline . X + 4 , ( height - inline . Text . Height ) * 0.5 ) ) ;
128
+ }
129
+ else
130
+ {
131
+ context . DrawText ( inline . Text , new Point ( inline . X , ( height - inline . Text . Height ) * 0.5 ) ) ;
132
+ }
124
133
}
125
134
}
126
135
}
0 commit comments