fix issue with null encodings for cid fonts

This commit is contained in:
Eliot Jones
2020-04-04 17:30:06 +01:00
parent 9abe9f4b2f
commit 729234477a
2 changed files with 8 additions and 2 deletions

View File

@@ -1,7 +1,6 @@
namespace UglyToad.PdfPig.PdfFonts.CidFonts
{
using System;
using System.Linq;
using Core;
using Fonts.CompactFontFormat;
@@ -20,8 +19,15 @@
public bool TryGetBoundingBox(int characterIdentifier, out PdfRectangle boundingBox)
{
boundingBox = new PdfRectangle(0, 0, 500, 0);
var font = GetFont();
if (font.Encoding == null)
{
return false;
}
var characterName = GetCharacterName(characterIdentifier);
boundingBox = font.GetCharacterBoundingBox(characterName) ?? new PdfRectangle(0, 0, 500, 0);

View File

@@ -157,7 +157,7 @@
{
var widths = new Dictionary<int, double>();
if (!dict.TryGet(NameToken.W, out var widthsItem) || !(widthsItem is ArrayToken widthArray))
if (!dict.TryGet(NameToken.W, pdfScanner, out ArrayToken widthArray))
{
return widths;
}