Free plan

Font convert

Convert a font file for websites, or see what it contains
POST
/v1/documents/font

About this tool

A font is the style of letters used on screen. This tool changes a font file between the common types TTF, OTF, WOFF and WOFF2. WOFF2 is the smallest and best for web pages. It can also describe the font: its names, licence and the characters it supports. The shapes of the letters are not changed.
For example, you have a desktop font and want a small web font so your website can use it.

How to use it

  1. Choose this tool.
  2. Add your font file with Upload or drag and drop.
  3. Choose the type to convert to, or choose to only describe the font.
  4. Press Generate.
  5. Download the new font file or read the description.

What you get back

You get a converted font file to download, and the font details on screen if you asked for them. Check the font licence allows web use.
GOOD TO KNOW
A WOFF2 made by another tool with the glyf transform cannot be unpacked here (400 with the reason): convert from the original TTF or OTF. Counts as one document.
TEST IT LIVE

Try Font convert in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/font
Tool ID
documents.font
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/font" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'to=woff2' \
  -F 'compression_level=0' \
  -F 'index=0'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.font({
    "file": 'document.pdf',
    "to": "woff2",
    "compression_level": 0,
    "index": 0
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->font([
    'file' => 'document.pdf',
    'to' => 'woff2',
    'compression_level' => 0,
    'index' => 0,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Convert a font between TTF, OTF, WOFF and WOFF2, or describe it: names, license, metrics, weight, and the characters it covers. The glyphs are never changed, only the wrapper.

Font convert works from text and settings, so no file is needed. Every input is optional.

Font convert is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/font with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.