2.2.0 • Published 3 days ago
@capsizecss/unpack v2.2.0
@capsizecss/unpack
Unpack the capsize font metrics directly from a font file.
npm install @capsizecss/unpack
Usage
fromBlob
Takes a file blob and returns the resolved font metrics.
import { fromBlob } from '@capsizecss/unpack';
const metrics = await fromBlob(file);
fromUrl
Takes a url string and returns the resolved font metrics.
import { fromUrl } from '@capsizecss/unpack';
const metrics = await fromUrl(url);
fromFile
Takes a file path string and returns the resolved font metrics.
import { fromFile } from '@capsizecss/unpack';
const metrics = await fromFile(filePath);
Font metrics
The font metrics object returned contains the following properties:
Property | Type | Description |
---|---|---|
familyName | string | Font family name as authored by font creator |
capHeight | number | The height of capital letters above the baseline |
ascent | number | The height of the ascenders above baseline |
descent | number | The descent of the descenders below baseline |
lineGap | number | The amount of space included between lines |
unitsPerEm | number | The size of the font’s internal coordinate grid |
xHeight | number | The height of lower case letters |
xAvgCharWidth | number | The average character width of all non-zero width characters |
Thanks
- Devon Govett for creating Fontkit, which does all the heavy lifting of extracting the font metrics under the covers.
- SEEK for giving us the space to do interesting work.
License
MIT.
2.2.0
4 days ago
2.1.0
2 months ago
0.0.0-add-subset-support-20240304225850
2 months ago
2.0.1
2 months ago
0.0.0-metrics-xwidthavg-inc-space-20240305000813
2 months ago
0.0.0-add-subset-support-20240304043732
2 months ago
2.0.0
3 months ago
0.0.0-metrics-frequency-data-20240215031405
3 months ago
0.0.0-master-20240214212615
3 months ago
0.0.0-crackle-20240208083429
3 months ago
0.0.0-crackle-20240208032212
3 months ago
0.0.0-crackle-20240208001447
3 months ago
0.0.0-add-language-support-v2-20231129052138
5 months ago
0.0.0-add-language-support-20231121023926
6 months ago
0.0.0-x-width-avg-20230123213508
1 year ago
1.0.0
1 year ago
0.0.0-x-width-avg-20221117062448
1 year ago
0.0.0-createfontstack-20221110224822
1 year ago
0.0.0-createfontstack-20221107121943
2 years ago
0.0.0-x-avg-char-width-20221107122037
2 years ago
0.0.0-x-avg-char-width-20221019035511
2 years ago
0.0.0-createfontstack-20221108001254
2 years ago
0.2.1
1 year ago
0.2.0
2 years ago
0.0.0-createfontstack-20221107222828
2 years ago
0.0.0-x-avg-char-width-20221118004523
1 year ago
0.0.0-x-width-avg-20221130043939
1 year ago
0.0.0-x-avg-char-width-20221011114126
2 years ago
0.0.0-x-avg-char-width-20221011221538
2 years ago
0.1.0
3 years ago