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 11using System ;
22using System . Collections . Concurrent ;
33using System . Collections . Generic ;
4+ using System . Globalization ;
45using System . Linq ;
6+ using System . Linq . Expressions ;
57using System . Text . RegularExpressions ;
68using System . Windows . Media ;
9+ using System . Xml . Linq ;
710
811namespace SVGImage . SVG . Utils
912{
@@ -27,11 +30,13 @@ public FontResolver(int maxLevenshteinDistance = 0)
2730 . Select ( ff => new { NormalName = ff . Source , Family = ff } )
2831 . ToDictionary ( x => x . NormalName , x => x . Family , StringComparer . OrdinalIgnoreCase ) ;
2932
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+ }
3540 MaxLevenshteinDistance = maxLevenshteinDistance ;
3641 }
3742 /// <summary>
You can’t perform that action at this time.
0 commit comments