-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Letter GlyphRectangle with Height == 0 #287
Comments
Hi @simonedd, have you tried compiling and testing this document with the current master? Some fixes have been push to fix bbox height recently - but your document might be another case of this issue |
Yes, I tested with the latest version. |
The issue comes from the I've added the following property Then in the PdfPig/src/UglyToad.PdfPig/PdfFonts/CidFonts/Type0CidFont.cs Lines 89 to 118 in 68dd3f5
I've amended the code as follow: public PdfRectangle GetBoundingBox(int characterIdentifier)
{
// TODO: correct values
if (characterIdentifier < 0)
{
throw new ArgumentException($"The provided character identifier was negative: {characterIdentifier}.");
}
if (fontProgram == null)
{
return Descriptor?.BoundingBox ?? new PdfRectangle(0, 0, 1000, 1.0 / scale);
}
if (fontProgram.TryGetBoundingBox(characterIdentifier, out var boundingBox))
{
return boundingBox;
}
if (Widths.TryGetValue(characterIdentifier, out var width))
{
return new PdfRectangle(0, 0, width, 1.0 / scale);
}
if (defaultWidth.HasValue)
{
return new PdfRectangle(0, 0, defaultWidth.Value, 1.0 / scale);
}
return new PdfRectangle(0, 0, 1000, 1.0 / scale);
} This is the result, which seems to be in line with what Acrobat reader displays (Letters in blue, words in red): I am really not sure it would work for every document. I'll try to push a PR if I manage to have a better understanding. |
closed as fixed in 0.1.5 |
unicode character has height 0 |
Hi,
In this document, all the letters have a GlyphRectangle with a Height equals to zero.
A1-RU-101-S.pdf
The text was updated successfully, but these errors were encountered: