Download the PHP package laurentmuller/fpdf2-make-font without Composer

On this page you can find all versions of the php package laurentmuller/fpdf2-make-font. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fpdf2-make-font

FPDF2 Make Font

This repository is used within FPDF2 to create fonts.

All code is copied from the FPDF created by Olivier PLATHEY.

Function:

Parameters:

The first parameter is the name of the font file. The extension must be either .ttf, .otf or .pfb and determines the font type. If your Type1 font is in ASCII format (.pfa), you can convert it to binary (.pfb) with the help of Type 1 utilities. For Type1 fonts, the corresponding .afm file must be present in the same directory.

The encoding defines the association between a code (from 0 to 255) and a character. The first 128 are always the same and correspond to ASCII; the following are variable. Encodings are stored in .map files. The available encoding ones are:

Of course, the font must contain the characters corresponding to the selected encoding.

The third parameter indicates whether the font should be embedded in the PDF or not. When a font is not embedded, it is searched in the system. The advantage is that the PDF file is smaller; but if it is not available, then a substitution font is used. So you should ensure that the required font is installed on the client systems. Embedding is the recommended option to guarantee a correct rendering.

The last parameter indicates whether sub-setting should be used, that is to say, whether only the characters from the selected encoding should be kept in the embedded font. As a result, the size of the PDF file can be greatly reduced, especially if the original font was big.

After you have called the function (create a new file for this and include make.php), a .php file is created, with the same name as the font file. You may rename it if you wish. If the case of embedding, the font file is compressed and gives a second file with .z as extension except if the compression function is not available (it requires Zlib). You may rename it too, but in this case you have to change the variable $file in the .php file accordingly.

Example:

Which gives the files comic.php and comic.z.

Then copy the generated files to the font directory. If the font file could not be compressed, copy it directly instead of the .z version.

Another way to call makeFont() is through the command line:

Declaration of the font in the script:

The second step is straightforward. You only need to call the addFont() method:

And the font is now available (in regular and underlined styles), usable like the others. If we had worked with Comic Sans MS Bold (comicbd.ttf), we would have written:

Full Example:

Now let's see a complete example. We will use the Ceviche One font. The first step is the generation of the font files:

The script produces the following output:

Alternatively, we could have used the command line:

We can now copy the two generated files to the font directory and write the script:

Symfony

A Symfony application has been created to generate fonts.

Code Quality

SymfonyInsight Codacy PHP-Stan Psalm CodeFactor Codecov

Actions

PHP-CS-Fixer PHPStan PHPUnit Psalm Rector Lint StyleCI


All versions of fpdf2-make-font with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-zip Version *
ext-zlib Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laurentmuller/fpdf2-make-font contains the following files

Loading the files please wait ....