mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 19:05:01 +08:00
use missing width for type 1 fonts when not in pdf array
This commit is contained in:
@@ -127,7 +127,7 @@
|
||||
|
||||
boundingBox = matrix.Transform(boundingBox);
|
||||
|
||||
var width = matrix.TransformX(widths[characterCode - firstChar]);
|
||||
var width = matrix.TransformX(GetWidth(characterCode, boundingBox));
|
||||
|
||||
var result = new CharacterBoundingBox(boundingBox, width);
|
||||
|
||||
@@ -135,6 +135,23 @@
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private decimal GetWidth(int characterCode, PdfRectangle boundingBox)
|
||||
{
|
||||
var widthIndex = characterCode - firstChar;
|
||||
|
||||
if (widthIndex >= 0 && widthIndex < widths.Length)
|
||||
{
|
||||
return widths[widthIndex];
|
||||
}
|
||||
|
||||
if (fontDescriptor?.MissingWidth != null)
|
||||
{
|
||||
return fontDescriptor.MissingWidth;
|
||||
}
|
||||
|
||||
return boundingBox.Width;
|
||||
}
|
||||
|
||||
private PdfRectangle GetBoundingBoxInGlyphSpace(int characterCode)
|
||||
{
|
||||
|
Reference in New Issue
Block a user