npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@telazer/font-loader

v1.0.2

Published

A library for loading fonts

Readme

Telazer - FontLoader

GitHub

For more helpers and utilities, check out the Telazer NPM Page

A lightweight TypeScript utility for dynamically loading fonts in the browser, with support for CSS Fonts Level 4 metric overrides (ascentOverride, descentOverride, lineGapOverride) to fine-tune font baselines and line spacing.


Installation

npm install @telazer/font-loader

Key Features

  • Dynamically load fonts via the FontFace API

  • Exposes each font as a CSS variable: var(--font-<key>) for easy use in stylesheets

  • Supports standard @font-face descriptors:

    • weight
    • style
    • stretch
    • display
  • Supports CSS Fonts Level 4 overrides for adjusting font metrics:

    • ascentOverride (baseline up/down)
    • descentOverride (descenders)
    • lineGapOverride (line spacing)

Quick Start

import FontLoader from '@telazer/font-loader';

await FontLoader.load([
  {
    key: 'MyFont',
    url: '/fonts/MyFont.woff2',
    weight: 400,
    style: 'normal',
    display: 'swap',
    ascentOverride: 115, // nudges text slightly down
    descentOverride: 10,
    lineGapOverride: 0,
  },
]);

// Now available in CSS:
body {
  font-family: var(--font-MyFont), sans-serif;
}

Font Metric Overrides

| Property | Example | Effect | | ----------------- | ------- | ----------------------------------------------------------- | | ascentOverride | 115 | Increases ascent → shifts glyphs down (more space above). | | descentOverride | 10 | Controls space below baseline (descenders like "y", "g"). | | lineGapOverride | 0 | Extra space between lines (0 removes gap, >0 adds spacing). |

Notes:

  • Values are interpreted as percentages of the font’s em square.
  • 100 = use the font’s built-in metrics.
  • <100 reduces space, >100 increases space.
  • Negative values are invalid and ignored.

API

FontLoader.load(fonts: FontLoadOptions[]): Promise<void>

Loads one or more fonts and exposes them via CSS variables.

FontLoadOptions

export interface FontLoadOptions {
  key: string; // Unique identifier for font-family (used in CSS var)
  url: string; // URL to font file (.woff2 recommended)

  weight?: string | number; // "normal", "bold", 100–900
  style?: string; // "normal", "italic", "oblique"
  stretch?: string; // "condensed", "expanded", "100%"
  display?: string; // "auto" | "swap" | "block" | "fallback" | "optional"

  ascentOverride?: number; // ≥0, adjusts baseline (100 = default, >100 = down, <100 = up)
  descentOverride?: number; // ≥0, adjusts descender space
  lineGapOverride?: number; // ≥0, adjusts line spacing (0 = none)
}

Examples

// Simple load
await FontLoader.load([
  { key: 'Roboto', url: '/fonts/roboto.woff2' }
]);

// Italic + custom overrides
await FontLoader.load([
  {
    key: 'RobotoItalic',
    url: '/fonts/roboto-italic.woff2',
    style: 'italic',
    ascentOverride: 110,
  },
]);

// Using in CSS
.title {
  font-family: var(--font-RobotoItalic), sans-serif;
}

Development

git clone https://github.com/Telazer/font-loader
npm install
npm run watch
npm test
npm run build

License

MIT License

Copyright (c) 2025 Telazer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.