MCPcopy
hub / github.com/unjs/fontaine / filterRequiredMetrics

Function filterRequiredMetrics

packages/fontaine/src/metrics.ts:15–24  ·  view source on GitHub ↗
(font: RequiredFontMetrics)

Source from the content-addressed store, hash-verified

13type RequiredFontMetrics = Pick<Font, 'ascent' | 'descent' | 'lineGap' | 'unitsPerEm' | 'xWidthAvg'> & { category?: string }
14
15function filterRequiredMetrics(font: RequiredFontMetrics): FontFaceMetrics {
16 return {
17 ascent: font.ascent,
18 descent: font.descent,
19 lineGap: font.lineGap,
20 unitsPerEm: font.unitsPerEm,
21 xWidthAvg: font.xWidthAvg,
22 category: font.category,
23 }
24}
25
26/**
27 * Retrieves the font metrics for a given font family from the metrics collection. Uses caching to avoid redundant calculations.

Callers 2

getMetricsForFamilyFunction · 0.85
readMetricsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected