Get detailed font metrics
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- computer-graphics
Research direction
Read pdfkit/lib/mixins/fonts.js, starting after currentLineHeight(includeGap). Confirm how the current font and font size are represented, then add the requested font metric getters. Done means the five metrics are available through getters and are scaled consistently with the current font size.
Written by the indexing model from the issue text.
Description
Feature Request
Feature description
I would like to have more font metric information to render initials, etc. in form of a few getter functions.
The new methods should be placed after the currentLineHeight(includeGap) method in the pdfkit/lib/mixins/fonts.js file.
I already use them locally:
currentFontAscender() { return (this._font.ascender) / 1000 * this._fontSize; },
currentFontDescender() { return (this._font.descender) / 1000 * this._fontSize; },
currentFontLineGap() { return (this._font.lineGap) / 1000 * this._fontSize; },
currentFontXHeight() { return (this._font.xHeight) / 1000 * this._fontSize; },
currentFontCapHeight() { return (this._font.capHeight) / 1000 * this._fontSize; },
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 18
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from foliojs/pdfkit
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Upgrade codemirror Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·