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

styled_width_of on cell/text.rb should use with_font, shouldn't it? #42

Closed
nalanj opened this issue Feb 28, 2015 · 2 comments
Closed

styled_width_of on cell/text.rb should use with_font, shouldn't it? #42

nalanj opened this issue Feb 28, 2015 · 2 comments

Comments

@nalanj
Copy link

nalanj commented Feb 28, 2015

I was running into some column width sizing issues, and it looks like styled_width_of ends up using the font size for the current font on the pdf, not necessarily the font being used within the cell. Am I seeing that correctly?

@jessedoyle
Copy link
Contributor

Hi everyone, I'm going to bump this issue because I just encountered it as well.

I just double-checked with pry and styled_width_of definitely appears use the document's base font size and the document's base font.

I believe the cell's font and size should be used if specified.

Furthermore, it looks like the M character is naively used as a font's widest character (link). This won't work well for icon fonts or any fonts with unusual character glyphs.

jessedoyle added a commit that referenced this issue Nov 10, 2015
jessedoyle added a commit that referenced this issue Nov 15, 2015
Use a cell's specified font to determine text cell content width. #42
@jessedoyle
Copy link
Contributor

Fix merged to master in 810ccda.

In the future, we should also look at calculating a font's widest character for styled_width_of_single_character instead of using the M character.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Mar 8, 2022
- a fix for prawnpdf/prawn-table#42 is already incorporated into the code base
- remove assertion exception for prawn-table 0.2.2
- drop recommendation to use development version of prawn-table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants