File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Source/SVGImage/SVG/Utils Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Concurrent ;
3
3
using System . Collections . Generic ;
4
+ using System . Globalization ;
4
5
using System . Linq ;
6
+ using System . Linq . Expressions ;
5
7
using System . Text . RegularExpressions ;
6
8
using System . Windows . Media ;
9
+ using System . Xml . Linq ;
7
10
8
11
namespace SVGImage . SVG . Utils
9
12
{
@@ -27,11 +30,13 @@ public FontResolver(int maxLevenshteinDistance = 0)
27
30
. Select ( ff => new { NormalName = ff . Source , Family = ff } )
28
31
. ToDictionary ( x => x . NormalName , x => x . Family , StringComparer . OrdinalIgnoreCase ) ;
29
32
30
- _normalizedFontNameMap = _availableFonts . Keys
31
- . ToDictionary (
32
- name => Normalize ( name ) ,
33
- name => name ,
34
- StringComparer . OrdinalIgnoreCase ) ;
33
+ _normalizedFontNameMap = new Dictionary < string , string > ( _availableFonts . Count ) ;
34
+ foreach ( var font in _availableFonts . Keys )
35
+ {
36
+ var name = Normalize ( font ) ;
37
+ if ( ! _normalizedFontNameMap . ContainsKey ( name ) )
38
+ _normalizedFontNameMap . Add ( name , font ) ;
39
+ }
35
40
MaxLevenshteinDistance = maxLevenshteinDistance ;
36
41
}
37
42
/// <summary>
You can’t perform that action at this time.
0 commit comments