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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@here/harp-fontcatalog-generator

v0.1.4

Published

Scripts used to generate a font catalog for harp.gl

Downloads

52

Readme

@here/harp-fontcatalog-generator Build Status

This module contains the necessary scripts and resources to generate a font catalog to be used with the harp.gl renderer. It includes the NotoSans-Regular font as part of the package because the script uses a glyph from that font as a fallback, in case some glyph from the font that it processes is missing.

For information about coding style or contributing, please refer to the information main project harp.gl.

Development

Prerequisites

  • Node.js - Please see nodejs.org for installation instructions
  • Yarn - Please see yarnpkg.com for installation instructions.

Download dependencies

Run:

yarn install

to download and install all required packages and set up the yarn workspace.

Installation

You can install it with yarn or with npm:

yarn add @here/harp-fontcatalog-generator

or

npm install @here/harp-fontcatalog-generator

Run unit tests in Node.js environment

Run:

yarn test

FontCatalog Description

To generate your own FontCatalog assets to use with harp.gl, you need to supply a JSON file containing your FontCatalog description. This file is composed of the following paremeters:

  • name: FontCatalog's name (Default: Default).
  • size: FontCatalog's glyph pixel size (Default: 32).
  • distance: FontCatalog's glyph pixel distance (Default: 8).
  • type: FontCatalog's glyph type, which could be regular SDF or MSDF (Default: SDF).
  • fontsDir: Relative path to the directory where all the .ttf font files for this FontCatalog are stored.
  • fonts: Array containing all the fonts to be included in this FontCatalog. Every font entry is composed of:
    • name: Font's name.
    • bold: Font's bold variant (Optional).
    • italic: Font's italic variant (Optional).
    • boldItalic: Font's boldItalic variant (Optional).
    • blocks: Array containing the specific Unicode Blocks of this font for which we want to generate glyphs (Optional).

The size, distance and type parameters influence how SDF glyphs are rasterize, and thus, can affect the quality of the output FontCatalog. To learn more about Font SDF Rasterization, visit the msdfgen repository.

FontCatalog Generation

After installing the package, just run:

harp-fontcatalog-generator -- -i <PATH_TO_DESCRIPTION> -o <OUTPUT_PATH>

Which will output assets in the following directory structure:

├── <NAME>_Assets
│   ├── Extra
│   │   ├── Specials.json
│   │   └── Specials.png
│   ├── FontA
│   │   ├── Basic_Latin.json
│   │   ├── Basic_Latin.png
│   │   └── ...
│   ├── FontB
│   │   ├── Basic_Latin.json
│   │   ├── Basic_Latin.png
│   │   └── ...
│   └── ...
├── <NAME>_BoldAssets (if any)
│   └── ...
├── <NAME>_ItalicAssets (if any)
│   └── ...
├── <NAME>_BoldItalicAssets (if any)
│   └── ...
└── <NAME>_FontCatalog.json

To use these assets with your harp.gl theme files, copy all of them to your resources folder and reference them from the theme with a relative path:

"fontCatalogs": [
    {
        "name": "<NAME>",
        "url": "./<NAME>_FontCatalog.json"
    }
]

License

Copyright (C) 2018-2019 HERE Europe B.V.

Unless otherwise noted in a LICENSE file for specific files or directories, the code in this repository is licensed under Apache 2.0 license.

See the LICENSE file in the root of this project for license details.