All Projects → Finesse → web-fonts-repository

Finesse / web-fonts-repository

Licence: MIT license
A simple webfont hosting. Google Fonts alternative for your own fonts.

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to web-fonts-repository

Urbanist
Urbanist is a low-contrast, geometric sans-serif inspired by Modernist design and typography.
Stars: ✭ 374 (+277.78%)
Mutual labels:  fonts, google-fonts, webfont
Linearicons
Linearicons is the highest quality set of line icons, matching with minimalist UI designs in iOS.
Stars: ✭ 64 (-35.35%)
Mutual labels:  fonts, webfont
Fontsource
Self-host Open Source fonts in neatly bundled NPM packages.
Stars: ✭ 836 (+744.44%)
Mutual labels:  fonts, google-fonts
Gftools
Misc tools for working with the Google Fonts library
Stars: ✭ 132 (+33.33%)
Mutual labels:  fonts, google-fonts
font-picker-react
✏️ Font selector component for Google Fonts
Stars: ✭ 126 (+27.27%)
Mutual labels:  fonts, google-fonts
fontless
🚀🔒 Host your own Google Fonts.
Stars: ✭ 63 (-36.36%)
Mutual labels:  fonts, google-fonts
Google Fonts Module
Google Fonts module for NuxtJS
Stars: ✭ 98 (-1.01%)
Mutual labels:  fonts, google-fonts
Work Sans
A grotesque sans.
Stars: ✭ 1,319 (+1232.32%)
Mutual labels:  fonts, google-fonts
Webfont
Awesome generator of webfont
Stars: ✭ 170 (+71.72%)
Mutual labels:  fonts, webfont
Yrsa Rasa
Yrsa & Rasa: fonts for Latin and Gujarati
Stars: ✭ 200 (+102.02%)
Mutual labels:  fonts, google-fonts
typefaces
Collection of Google fonts as typeface data for usage with three.js, react-three-fiber, and other tools.
Stars: ✭ 53 (-46.46%)
Mutual labels:  fonts, google-fonts
argo
The administrative discovery interface for Stanford's Digital Object Registry
Stars: ✭ 19 (-80.81%)
Mutual labels:  application, repository
eczar
Eczar: fonts for Devanagari and Latin
Stars: ✭ 52 (-47.47%)
Mutual labels:  fonts, google-fonts
Awesome Fonts
Curated list of fonts and everything
Stars: ✭ 798 (+706.06%)
Mutual labels:  fonts, google-fonts
Chart Releaser
Hosting Helm Charts via GitHub Pages and Releases
Stars: ✭ 253 (+155.56%)
Mutual labels:  repository, hosting
Inkwell
An inkwell to use custom fonts on the fly.
Stars: ✭ 146 (+47.47%)
Mutual labels:  fonts, google-fonts
seed-fonts
WordPress plugin that helps you use web fonts (@font-face) easier. You can use 5 ready-generated Thai-English web fonts, or use your own collection.
Stars: ✭ 20 (-79.8%)
Mutual labels:  fonts, google-fonts
vite-plugin-webfont-dl
⚡ Webfont Download Vite Plugin - Make your Vite site load faster
Stars: ✭ 69 (-30.3%)
Mutual labels:  google-fonts, webfont
Fonts
A curation of fonts from all over the world.
Stars: ✭ 144 (+45.45%)
Mutual labels:  fonts
Bellota-Font
An ornamented Sans Serif font family
Stars: ✭ 21 (-78.79%)
Mutual labels:  webfont

Web fonts repository

Latest Stable Version Total Downloads PHP from Packagist Test Status Maintainability Test Coverage

A simple webfont hosting inspired by Google Fonts. It runs on your server, stores and distributes webfont files and generates CSS on-the-go for embedding fonts on web pages.

Quick start

Requirements

  1. HTTP server supporting PHP ≥ 7.0
  2. Composer (required for installation)

Installation

1. Download the source code

Run the following code in the console:

composer create-project finesse/web-fonts-repository webfonts

Where webfonts is a path to a directory where the repository should be installed.

Or you can make some things manually:

  1. Download the source code from GitHub and extract it.
  2. Open a terminal and go to the source code root.
  3. Install the libraries by running in the terminal:
    composer install
  4. Prepare the repository by running in the terminal:
    composer run-script post-create-project-cmd

2. File permissions

Give the user behalf which the web server runs permissions to write inside the logs directory.

You can just run this in the console:

# Don't do it in production!
chmod 777 logs

3. Web server

Make the directory public be the document root of the web server. Or just open http://localhost/public if you installed the repository to the web server root.

Make all the requests to not-existing files be handled by public/index.php. If your server is Apache, it's already done.

Make the server add the Access-Control-Allow-Origin: * HTTP-header to the font files. Otherwise some browsers will reject using fonts from the repository.

  • Apache: all you need to do is to make sure that the mod_header.c module is on (run the a2enmod headers command and restart the server to turn it on).
  • Nginx: use this instruction.

Setup

Put your font files (woff, woff2, ttf, otf, eot, svg) to the public/fonts directory. You may separate them by subdirectories. You can convert webfont files using Transfonter.

All settings go to the file config/settings-local.php. If you don't have it, copy it from the file config/settings-local.php.example.

Parameters:

displayErrorDetails

Whether errors details should be sent to browser. Anyway errors are written to the file logs/app.log. You should turn it off on production server.

logger/level

How many messages should be logged to the file. The value is one of the \Psr\Log\LogLevel constants. You can read more about log levels here.

fonts

The list of fonts available in the repository. Simple example:

return [
    // ...
    'fonts' => [
        'Open Sans' => [
            'styles' => [
                '300' => 'OpenSans/opensans-light.*',
                '300i' => 'OpenSans/opensans-light-italic.*',
                '400' => 'OpenSans/opensans-regular.*',
                '400i' => 'OpenSans/opensans-regular-italic.*',
            ]
        ],
        'Roboto' => [
            'styles' => [
                '300' => 'Roboto/roboto-light.*',
                '400' => 'Roboto/roboto-regular.*',
                '500' => 'Roboto/roboto-medium.*',
                '700' => 'Roboto/roboto-bold.*',
            ]
        ]
    ]
];

The fonts array keys are the font families names. The styles arrays keys are the styles names. The numbers in the style names are the font weights, i stands for italic.

The font file paths are given relative to the public/fonts directory. The file paths are the glob search patterns. It means that the repository should consider all files matching the pattern as font files.

You can find more examples and possibilities here.

Usage

Add a <link> tag to the HTML code of the page on which you want to embed a font:

<link rel="stylesheet" href="http://web-fonts-repository.local/css?family=Open+Sans:400,400i,700,700i|Roboto:300,400" />

Where http://web-fonts-repository.local is the root URL of an installed web fonts repository.

The required fonts are specified the same way as on Google Fonts. Font families are divided by |, families styles are divided by ,, family name is separated from styles list using :.

You may omit the styles list. In this case the regular style (400) is used.

<link rel="stylesheet" href="http://web-fonts-repository.local/css?family=Open+Sans" />

You can specify a value for the font-display style property using display parameter. Example:

<link rel="stylesheet" href="http://web-fonts-repository.local/css?family=Open+Sans&display=swap" />

Then embed a font in a CSS code:

body {
    font-family: 'Open Sans', sans-serif;
}

Versions compatibility

The project follows the Semantic Versioning.

It means that patch versions are fully compatible (i.e. 1.2.1 and 1.2.2), minor versions are backward compatible (i.e. 1.2.1 and 1.3.2) and major versions are not compatible (i.e. 1.2.1 and 3.0). The pre-release versions (0.*) are a bit different: patch versions are backward compatible and minor versions are not compatible.

License

MIT. See the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].