Skip to content
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

merged_metrics boundingbox is nil #167

Open
shrikanth-bluesapling opened this issue Nov 21, 2019 · 2 comments
Open

merged_metrics boundingbox is nil #167

shrikanth-bluesapling opened this issue Nov 21, 2019 · 2 comments

Comments

@shrikanth-bluesapling
Copy link

shrikanth-bluesapling commented Nov 21, 2019

Hello!

Thank you for the gem, it's come very handy in a lot of cases. I'm having an issue with textbox and a registered font, in this case, Roboto. When I load up a pdf with roboto and register the font, attempting to create a textbox raises the following error:

NoMethodError (undefined method ``[]' for nil:NilClass)

After a bit of debugging, I've figured out that the problem is with this line:

height = metrics_array.map { |m| m ? m[:boundingbox][3] : 0 } .max

From fonts.rb:141.

From what I can tell, when the font Robot is being registered the font metrics aren't being loaded appropriately, so the wx field is present but the boundingbox field is not.

@boazsegev
Copy link
Owner

Hi @shrikanth-bluesapling ,

Thank you for opening this issue.

I'm super busy this month, but I'll try to get o it as soon as I can.

Could you send me a file (to extract the fond) and an example script that would reproduce the issue? Thanks!

Kindly,
Bo.

@shrikanth-bluesapling
Copy link
Author

Thanks for the response. I've attached a sample pdf I use to get the font. I managed to get the font working by using ttfunk to manually extract metrics, but it tended to overestimate sizes and messed up alignment and the like.
roboto_sample.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants