Skip to content

Commit

Permalink
Simplified initialization of a dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Lehonti Ramos committed Sep 6, 2023
1 parent a6318de commit 195ac10
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/XamlMath.Shared/DefaultTexFontParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,18 @@ public IReadOnlyDictionary<string, double> GetParameters()

public IReadOnlyDictionary<string, object> GetGeneralSettings()
{
var result = new Dictionary<string, object>();

var generalSettings = rootElement.Element("GeneralSettings");

if (generalSettings == null)
throw new InvalidOperationException("Cannot find GeneralSettings element.");

result.Add("mufontid", generalSettings.AttributeInt32Value("mufontid"));
result.Add("spacefontid", generalSettings.AttributeInt32Value("spacefontid"));
result.Add("scriptfactor", generalSettings.AttributeDoubleValue("scriptfactor"));
result.Add("scriptscriptfactor", generalSettings.AttributeDoubleValue("scriptscriptfactor"));

return result;
return new Dictionary<string, object>
{
["mufontid"] = generalSettings.AttributeInt32Value("mufontid"),
["spacefontid"] = generalSettings.AttributeInt32Value("spacefontid"),
["scriptfactor"] = generalSettings.AttributeDoubleValue("scriptfactor"),
["scriptscriptfactor"] = generalSettings.AttributeDoubleValue("scriptscriptfactor"),
};
}

public IReadOnlyDictionary<string, IReadOnlyList<CharFont>> GetTextStyleMappings()
Expand Down

0 comments on commit 195ac10

Please sign in to comment.