Unicode data tables and constants used by the Tecnick text stack.
💖 Part of the tc-lib-pdf / TCPDF ecosystem (100M+ installs). Sponsor its maintenance →
tc-lib-unicode-data is a data-centric package that provides Unicode lookup tables, mappings, and constants consumed by tc-lib-unicode and related libraries.
It externalizes large Unicode datasets into a dedicated package so runtime libraries can stay focused on algorithms instead of data distribution. Versioned data updates also become easier to manage and review as Unicode standards evolve.
| Namespace | \Com\Tecnick\Unicode\Data |
| Author | Nicola Asuni info@tecnick.com |
| License | GNU LGPL v3 - see LICENSE |
| API docs | https://tcpdf.org/docs/srcdoc/tc-lib-unicode-data |
| Packagist | https://packagist.org/packages/tecnickcom/tc-lib-unicode-data |
- Unicode property and identity constants
- Script/category mapping data
- Bracket, mirroring, and shaping-related tables
- Runtime dependency for higher-level Unicode processing
- Pure data distribution, no heavy runtime logic
- Deterministic, versioned updates
Arabic, Bracket, Mirror, Pattern and Type are generated from the Unicode Character Database; Type::UNICODE_VERSION reports the version they derive from.
| Class | UCD source | Content |
|---|---|---|
Type |
extracted/DerivedBidiClass.txt |
Bidi_Class of every code point (UAX #9) |
Pattern |
extracted/DerivedBidiClass.txt |
Regular expressions matching right-to-left and Arabic text |
Mirror |
BidiMirroring.txt |
Bidi_Mirroring_Glyph values used by rule L4 |
Bracket |
BidiBrackets.txt |
Paired brackets used by rule N0 |
Arabic |
ArabicShaping.txt, UnicodeData.txt |
Joining types, presentation forms and ligatures |
Type::UNI only lists the code points whose Bidi_Class is not L; Type::getType() resolves any code point, including the blocks whose unassigned code points default to R, AL or ET.
\Com\Tecnick\Unicode\Data\Type::getType(0x05D0); // 'R'
\Com\Tecnick\Unicode\Data\Type::getBidiClass(0x0660); // BidiClass::AN
\Com\Tecnick\Unicode\Data\Arabic::getJoiningType(0x0628); // 'D'To rebuild the tables from a newer UCD release:
make gendata UCDVERSION=17.0.0
make qaType::UNIno longer contains the code points whose Bidi_Class isL: read it throughType::getType()instead ofType::UNI[$ord] ?? $fallback.Type::getBidiClass()returnsBidiClass::Lfor the code points that are not listed, andnullonly for the explicit formatting codes (LRE, LRO, RLE, RLO, PDF, LRI, RLI, FSI, PDI).Pattern::RTLandPattern::ARABICare code point based (umodifier) and require a valid UTF-8 subject.Mirror::UNIfollowsBidiMirroring.txt: the quotation marks U+2018, U+2019, U+201C, U+201D, U+301D and U+301E are no longer mirrored.Arabic::SUBSTITUTErows always hold the four[isolated, final, initial, medial]forms, repeating the isolated and final ones where the letter has no initial or medial form.Arabic::ENDis derived from the Joining_Type property and now lists every character that does not join to the following one.Arabic::JOININGandArabic::getJoiningType()expose the Joining_Type property.
- PHP 8.2 or later
- Composer
composer require tecnickcom/tc-lib-unicode-data<?php
require_once __DIR__ . '/vendor/autoload.php';
echo md5(\Com\Tecnick\Unicode\Data\Identity::CIDHMAP);make deps
make help
make qamake rpm
make debFor system packages, bootstrap with:
require_once '/usr/share/php/Com/Tecnick/Unicode/Data/autoload.php';Contributions are welcome. Please review CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.