Skip to content

Commit

Permalink
Added null check
Browse files Browse the repository at this point in the history
  • Loading branch information
tastysugar committed Feb 23, 2021
1 parent c2e7b5c commit 6ef121e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions AssFontSubset/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,17 @@ private void ChangeXmlFontName(List<SubsetFontInfo> subsetFonts)

// find cid for ellipsis (\u2026)
XmlNode cmap = xd.SelectSingleNode(@"//map[@code='0x2026']");
String ellipsisCid = cmap.Attributes["name"].Value.Trim();
XmlNodeList substitutionNodes = xd.SelectNodes($"//Substitution[@in='{ellipsisCid}']");

// remove substitution for lower ellipsis.
// NOTE: Vertical ellipsis is cid5xxxxx, and we need to keep it. Hopefully Adobe won't change it.
foreach (XmlNode sNode in substitutionNodes) {
if (Regex.IsMatch(sNode.Attributes["out"].Value, @"cid6")){
sNode.ParentNode.RemoveChild(sNode);
if (cmap != null) {
String ellipsisCid = cmap.Attributes["name"].Value.Trim();
XmlNodeList substitutionNodes = xd.SelectNodes($"//Substitution[@in='{ellipsisCid}']");
// remove substitution for lower ellipsis.
// NOTE: Vertical ellipsis is cid5xxxxx, and we need to keep it. Hopefully Adobe won't change it.
foreach (XmlNode sNode in substitutionNodes)
{
if (Regex.IsMatch(sNode.Attributes["out"].Value, @"cid6"))
{
sNode.ParentNode.RemoveChild(sNode);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions AssFontSubset/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.24.2")]
[assembly: AssemblyFileVersion("1.1.24.2")]
[assembly: AssemblyVersion("1.1.24.3")]
[assembly: AssemblyFileVersion("1.1.24.3")]

0 comments on commit 6ef121e

Please sign in to comment.