Welcome to Fontbrain

Fontbrain is the largest database of fonts in the world with the coolest tools available and the coolest tools to come, all available through an API.

We've created several urls that interact with the API using a dummy font. These urls are available throughout the manual and also summarized here:

This demo uses libraries that we've developed to interact with the API. They are available here:

Table Of Contents

Try it out

Title Description
Home Returns to the homepage of the API manual
Reset This will delete the font from all the API's and delete all the images. Use this to completely start over. You can use some of the other get functions to test if it was successful.
Get from archives Gets the dummy font from our archive system and places the font file in the fonts API.
Push Push a font to the fonts API. The fonts API will then push it to the images API and the assimilator API.
Assimilate Assimilates a font by creating system fonts, generating data about features, glyphs, signatures etc. If assimilation fails more than 5 times it will ignore the request. If another request in in process to assimilate the font, this request will wait until it is finished up to a limit. If the limit is reached it will return failure. If it finished before the limit, it will return success.
Get font info
Get dummy font assimilation info
Get Font Signature data Signature data is helpful for matching font to each other.
Get Image Gets an image paths and information from the API. If it doesn't exist it will generate it. Compression happens later as the server can get to it.
Get Image File Returns the actual file of the image instead of the paths and outputs to the browser. You will need to use the back button to return to the manual.
Get fonts scale Get the current scale of the font.
Update font scale
Get generation stats
Test Drive
Delete the font and all the records
Delete images for font
Delete Test Font This will delete the file that we use for testing. You would want to use this before running the function that gets a font from the archives.


API Response

If the call was successful, only the actual response will show. If the call failed, the entire response, including errors will be displayed.

No API call was made.

Overview

There are 3 APIs available:

  • fonts.fontbrain.com
  • assimilator.fontbrain.com
  • imgs.fontbrain.com

fonts.fontbrain.com

A repository of every font we have with basic data about the font.

Only super users can push and pull fonts from this API. This API is mostly for the other two APIs to get font files and font info neccessary to generate images and data. There are some fonts that we have files for, but the information is not complete. If the fonts API needs a font that it doesn't have, it will get it from the archives, use the name table to populate the information the best it can.

assimilator.fontbrain.com

Takes a font file and creates all the data necessary for displaying fonts in a font commerce website. This includes information about the glyphs, OpenType features, language support, metrics, glyph signatures and optimized font files for image generation.

Any font added to the assimilator will be assimilated in the order it was received. Fonts that fail the assimilation process will be rejected after 5 attempts. Once a font is assimilated, the data is stored and remains available. If the data for a font is not requested after 1 month, the font is removed from the system.

imgs.fontbrain.com

Generates font images of the font. A checksum of the font and a recipe are sent to the API and a path to the image is returned. Recipes can be registered so that images are pre-generated when the system receives a new font. Images are compressed after generation as the system can get to them.

Fontbrain Fonts API

Tables

fonts example

Database field Example data Comments
checksum 2516b34268d5abb314bd31734f2391d0 A unique checksum of the font file.
family_name Sofia Pro This is the name used in some of the font image types when a font is representing the family
name Sofia Pro The name of the font (minus the stylename). This name is used in some of the image types when the image is clearly displaying the font and not the family.
style_name Black The stylename of the font
writing_system 3 The id of the writing system from the writing_systems table.
format otf the format of the source font
case mixed values can be mixed, upper, or lower
numerals Y if the font contains the numerals, the value should be set to Y
punctuation Y if the font contains the punctuation, the value should be set to Y
adddate 2017-07-17 15:34:27
editdate 2017-07-17 15:34:27

writing_systems example

Database field Example data Comments
id 3 Matches the writing_system field in the fonts database
key latin
name Latin

writing_systems data

3 latin Latin
4 arabic Arabic
5 bengali Bengali
6 devanagari Devanagari
7 gujarati Gujarati
8 gurmukhi Gurmukhi
9 hebrew Hebrew
10 japanese Japanese
11 tamil Tamil
12 thai Thai
13 dingbat Dingbat
14 kannada Kannada

Playground

Link Description
Try it Get font info from fonts.fontbrain.com from our dummy font

Codeigniter Fontbrain Libraries

In a nutshell

  • Place the fontbrain libraries in your libraries folder
  • Place the Rest_requester library in your libraries folder
  • Place the fontbrain_api.php file in your config folder
  • Configure setting for your application
  • Load a library in your application
  • Make a request

Download libraries

To use the libraries, first you have to configure them. Open or create a configuration file called fontbrain_api.php. It should look something like this:


$config = array(
	'api_key'                   => 'Your api key here',
	'secret_key'                => 'Your secret api key here',
	'debugging_mode'            => FALSE,
	'timeout'                   => 30,
	'fontbrain_images_url'      => 'https://imgs.fontbrain.com/index.php/',
	'fontbrain_fonts_url'       => 'https://fonts.fontbrain.com/index.php/',
	'fontbrain_assimilator_url' => 'https://assimilator.fontbrain.com/index.php/',
);

Make sure you add your API key and your API secret key.

Libraries

Besides the Fontbrain libraries found in the repo in libraries/fontbrain, they are dependant on a library called Rest_requester.