tecnickcom/tc-lib-pdf-font

PHP library containing PDF page formats and definitions

Maintainers

Package info

github.com/tecnickcom/tc-lib-pdf-font

Homepage

pkg:composer/tecnickcom/tc-lib-pdf-font

Statistics

Installs: 796 483

Dependents: 4

Suggesters: 0

Stars: 21

Open Issues: 1


README

Font import, metrics, and stack management utilities for PDF generation.

Latest Stable Version Build Coverage License Downloads

Donate via PayPal

If this library helps your PDF pipeline, please consider supporting development via PayPal.

Overview

tc-lib-pdf-font provides font import and runtime font-stack services used by PDF composition engines.

It bridges static font assets and runtime document composition by handling metrics, encodings, and font program references in a PDF-friendly way. This modular design lets applications evolve font workflows independently from the rest of the rendering stack.

Namespace \Com\Tecnick\Pdf\Font
Author Nicola Asuni info@tecnick.com
License GNU LGPL v3 - see LICENSE
API docs https://tcpdf.org/docs/srcdoc/tc-lib-pdf-font
Packagist https://packagist.org/packages/tecnickcom/tc-lib-pdf-font

Features

Font Processing

  • Import support for core, Type1, and TrueType sources
  • Font metadata extraction and normalization
  • Utilities for subset and output dictionary generation

Runtime Font Stack

  • Font stack insertion and switching
  • Glyph width/bounding-box helpers
  • Character replacement and fallback handling

Requirements

  • PHP 8.1 or later
  • Extensions: json, pcre, zlib
  • Composer

Installation

composer require tecnickcom/tc-lib-pdf-font

Quick Start

<?php

require_once __DIR__ . '/vendor/autoload.php';

$font = new \Com\Tecnick\Pdf\Font\Import('/path/to/font.ttf');
$metrics = $font->getFontMetrics();

var_dump($font->getFontName(), $metrics['type']);

For larger examples, refer to test/OutputTest.php and the conversion tooling in this repository.

Development

make deps
make help
make qa

Font generation helpers are also available through Make targets such as fonts.

Packaging

make rpm
make deb

For system packages, bootstrap with:

require_once '/usr/share/php/Com/Tecnick/Pdf/Font/autoload.php';

Contributing

Contributions are welcome. Please review CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.

Contact

Nicola Asuni - info@tecnick.com