mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-11-24 16:53:20 +08:00
Compare commits
1 Commits
file-12623
...
additional
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21f1cd5354 |
@@ -32,7 +32,7 @@
|
||||
|
||||
public virtual string GetNameByStringId(int stringId)
|
||||
{
|
||||
return GlyphIdToStringIdAndName.SingleOrDefault(x => x.Value.stringId == stringId).Value.name;
|
||||
return GlyphIdToStringIdAndName.FirstOrDefault(x => x.Value.stringId == stringId).Value.name;
|
||||
}
|
||||
|
||||
public virtual int GetStringIdByGlyphId(int glyphId)
|
||||
|
||||
@@ -44,6 +44,25 @@
|
||||
return handler.Generate(dictionary);
|
||||
}
|
||||
|
||||
// Try simple font recovery:
|
||||
NameToken[] orderedFallbacks = [NameToken.Type1, NameToken.TrueType];
|
||||
foreach (var fallback in orderedFallbacks)
|
||||
{
|
||||
if (!handlers.TryGetValue(fallback, out handler))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return handler.Generate(dictionary);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log?.Error($"Tried to parse font as fallback type: {fallback}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotImplementedException($"Parsing not implemented for fonts of type: {subtype}, please submit a pull request or an issue.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user