File tree Expand file tree Collapse file tree
v2rayN/v2rayN.Desktop/Views Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,29 +161,18 @@ private async Task InitSettingFont()
161161
162162 private async Task < List < string > > GetFonts ( )
163163 {
164+ await Task . CompletedTask ;
165+
164166 var lstFonts = new List < string > ( ) ;
165167 try
166168 {
167- if ( Utils . IsWindows ( ) )
168- {
169- return lstFonts ;
170- }
171- else if ( Utils . IsNonWindows ( ) )
172- {
173- var result = await Utils . GetLinuxFontFamily ( "zh" ) ;
174- if ( result . IsNullOrEmpty ( ) )
175- {
176- return lstFonts ;
177- }
178-
179- var lst = result . Split ( Environment . NewLine )
180- . Where ( t => t . IsNotEmpty ( ) )
181- . ToList ( )
182- . Select ( t => t . Split ( "," ) . FirstOrDefault ( ) ?? "" )
183- . OrderBy ( t => t )
184- . ToList ( ) ;
185- return lst ;
186- }
169+ var lst = Avalonia . Media . FontManager . Current . SystemFonts
170+ . Select ( t => t . Name )
171+ . Where ( t => t . IsNotEmpty ( ) )
172+ . Distinct ( StringComparer . OrdinalIgnoreCase )
173+ . OrderBy ( t => t )
174+ . ToList ( ) ;
175+ return lst ;
187176 }
188177 catch ( Exception ex )
189178 {
You can’t perform that action at this time.
0 commit comments