Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Tc Lib Pdf Font

Tc Lib Pdf Font Laravel Package

tecnickcom/tc-lib-pdf-font

Font import, metrics, and runtime font-stack utilities for PDF generation in PHP. Supports core, Type1, and TrueType fonts, glyph width and bounding-box helpers, character fallback, and composite font encoding.

View on GitHub
Deep Wiki
Context7

PHP library containing PDF font methods and utilities

Frequently asked questions about Tc Lib Pdf Font
What is tc-lib-pdf-font used for?
tc-lib-pdf-font is the font import, metrics, and runtime font-stack layer used by the tc-lib-pdf ecosystem. It reads core, Type1, and TrueType font files, normalizes their metrics, generates subset and output dictionaries, and manages a runtime font stack with glyph width, bounding-box, and fallback helpers. It does not render PDFs itself, so in most Laravel applications you get it transitively through tecnickcom/tc-lib-pdf rather than installing it on its own.
How do I install tc-lib-pdf-font in a Laravel app?
Run composer require tecnickcom/tc-lib-pdf-font. It requires PHP 8.2 or later with the json and zlib extensions, is PSR-4 autoloaded under the \Com\Tecnick\Pdf\Font namespace, and ships no Laravel service provider or config file to publish. You instantiate its classes directly, typically from inside a tc-lib-pdf composition layer, so there is nothing to register in config/app.php.
Does tc-lib-pdf-font support Laravel 10 and Laravel 11, and which PHP version does it need?
The package is framework-agnostic and has no Laravel coupling, so it works with Laravel 10 and 11 as long as your runtime satisfies PHP 8.2 or later. Laravel 10 and 11 only require PHP 8.1, so confirm your server images and CI pipeline are on 8.2 before adding it. The json and zlib extensions must also be enabled.
Should I require tc-lib-pdf-font directly or use tc-lib-pdf instead?
tc-lib-pdf-font is a single-responsibility leaf library that feeds a composition engine, so requiring it directly only makes sense if you are deliberately building your own rendering layer on top of the tc-lib primitives. Otherwise depend on tecnickcom/tc-lib-pdf and treat the font library as an internal detail. Do not migrate from TCPDF, mPDF, or dompdf to this package alone, and do not plan to run two tecnickcom/tc-lib-* PDF stacks in one application because Composer will conflict over the shared namespace.
Which font formats, encodings, and metrics does tc-lib-pdf-font handle?
It imports core, Type1, and TrueType font sources, including TTF and OTF files, and normalizes their metadata. It provides glyph width and bounding-box helpers, character replacement and fallback handling, subset and output dictionary generation, and glyph index encoding for composite fonts including supplementary planes. An optional injectable cache lets you reuse computed TrueType font subsets.
How do I set up font fallback for CJK, RTL, or emoji text with tc-lib-pdf-font?
The runtime font stack supports insertion and switching, plus character replacement and fallback, and composite font glyph index encoding across supplementary planes. That is the mechanism you use to chain a Latin font to CJK, RTL, or emoji-capable fonts. Test deliberately with text that triggers fallback, because silent glyph substitution can produce wrong widths and corrupt layout without throwing an exception.
Is it safe to let users upload fonts that tc-lib-pdf-font will parse?
Treat font import as a parser attack surface, because it processes untrusted binary files and that is a well-known exploit class. Any flow where a user supplies a font must validate the file type, enforce a size cap, and ideally convert or normalize it out of band before the library parses it. Store fonts in a controlled location such as local disk or object storage and restrict who is authorized to add them.
Can I use tc-lib-pdf-font with Laravel Octane, Swoole, or long-running queue workers?
There is no Laravel integration to configure, but long-running workers are the real risk: check whether the font stack or metric caches are held in static or singleton state. If they are, Octane and Swoole will leak fonts and metrics across requests unless you resolve the library per request or reset it explicitly. Run a two-request smoke test under Octane before deploying.
What is the license and maintenance status of tc-lib-pdf-font?
The README declares GNU LGPL v3, but Packagist tooling has been observed reporting an unrecognized license string, so confirm the license with legal before commercial distribution. Maintenance is single-maintainer and sponsor-funded, and the project sits inside the much larger TCPDF ecosystem, so due diligence should measure the parent package rather than this leaf module. Verify release provenance as well, because a published release date can look anomalous, and confirm the tag maps to an auditable commit.
How do I test font subsetting and glyph widths before shipping?
Build a fixture document that embeds a font, mixes scripts to trigger the fallback chain, and asserts glyph widths and bounding boxes against known expected values. Snapshot the extracted text and layout, because the failure mode to catch is wrong glyph widths after subsetting, which corrupts output visually without throwing an exception. Run that test on every upgrade of the tc-lib-pdf family, since its modules are released in lockstep.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator