mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 02:44:58 +08:00
fix issue with null encodings for cid fonts
This commit is contained in:
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user