mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 11:44:51 +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);
|
boundingBox = matrix.Transform(boundingBox);
|
||||||
|
|
||||||
var width = matrix.TransformX(widths[characterCode - firstChar]);
|
var width = matrix.TransformX(GetWidth(characterCode, boundingBox));
|
||||||
|
|
||||||
var result = new CharacterBoundingBox(boundingBox, width);
|
var result = new CharacterBoundingBox(boundingBox, width);
|
||||||
|
|
||||||
@@ -135,6 +135,23 @@
|
|||||||
|
|
||||||
return result;
|
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)
|
private PdfRectangle GetBoundingBoxInGlyphSpace(int characterCode)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user