Linux Portable Core
The portable core compiles the existing object model, simple-object parser, Direct File I/O helpers, content-stream interpreter, PDF value helpers, xref and trailer writer, Flate backend, and AES primitives into native Linux programs with Free Pascal
HPDFPlatform provides real POSIX mapped files and positional reads, temporary-file creation, worker synchronization, and operating-system random bytes; the Windows adapter preserves the existing native file and mapping behavior
Acceptance scope
Tests/Linux/Run-PortableCoreTests.sh builds a native x86_64 ELF console executable, clears desktop display variables, checks for GUI library dependencies, and runs eight groups of regressions with a timeout
The checks cover parser escapes and indirect references, invariant PDF values and stream filters, mapped windows and sparse-file offsets above 4 GiB, compressed asynchronous spill streams, Flate and AES known answers, MD5 file hashes, operating-system random IVs, valid classic xref serialization, Direct File page counts and object lookup, and content-stream text and glyph positions
The generated one-page fixture is written by the existing writer and independently read through the shared Direct File helpers; content checks use both the existing Latin-1 identity resolver and the page font resolver with encoding differences and explicit widths
Font data and text decoding
HPDFFontData separates the existing glyph-name, encoding, and sfnt CMap decoding from GDI; Windows embedded glyph rendering and the existing HPDFTextExtraction decoder use the same implementation
THPDFTrueTypeData exposes supported CMap lookup, reverse glyph-to-Unicode mapping, and hmtx horizontal advances for a single-font sfnt image
HPDFBaseFontMetrics uses canonical standard-font advances for twelve exact Helvetica/Times/Courier names and supported decoded characters, retains the Windows GDI and Linux Fontconfig fallback for other fonts, and preserves explicit PDF widths
Platform and font helper contracts
THPDFPlatformHandle is a signed native-width handle and HPDFInvalidFileHandle is -1; HPDFOpenReadOnlyFile and HPDFCloseFile manage read handles, while HPDFFileSize and HPDFReadFileAt use Int64 positions and callers must handle short reads
HPDFMappingGranularity supplies the required offset alignment; HPDFCreateReadOnlyMapping returns zero on failure, HPDFMapReadOnly maps the requested range, and HPDFUnmapReadOnly / HPDFCloseMapping release the view and mapping
HPDFCreateTemporaryFile exclusively creates a file whose path and cleanup belong to the caller; HPDFInitializeLock / HPDFDeleteLock manage native critical sections
THPDFPlatformEvent aliases TEvent; HPDFCreateEvent, HPDFWaitEvent, HPDFSignalEvent, and HPDFResetEvent manage synchronization, and the caller frees events after the worker stops
HPDFSecureRandomBytes fills the requested buffer from the operating system or raises an exception
HPDFGlyphNameToUnicode, HPDFUnicodeToGlyphName, HPDFStdEncGlyphName, HPDFMacExpertEncGlyphName, and HPDFBaseEncToUnicode retain existing name and encoding behavior; HPDFBaseFontFamilyToken removes subset and style suffixes, while HPDFIsStandardTextFont recognizes Helvetica, Times, and Courier aliases
HPDFMeasureBaseFontWidths uses canonical supported standard-font advances before Windows GDI or Linux Fontconfig and shared sfnt horizontal metrics; THPDFTrueTypeData and THPDFUnicodeByGID provide the shared font-data API
Shared Direct File types
HPDFDirectFileTypes owns the existing THPDFKeyType, THPDFProtection, THPDFProtectOptions, THPDFDirectXrefEntry, THPDFDirectObjectSource, and THPDFDirectFileState definitions
This separation lets HPDFDirectFileIO use the same records and permission types without importing the component and GUI implementation
HPDFDoc retains aliases and enum-value constants under the original names; enum ordinals and record layouts are unchanged
Linux program initialization
Native Free Pascal programs must place cthreads first in the uses list before using worker threads; the portable-core test also loads cwstring to supply the Unicode conversion manager
Use FPC 3.3.1 or later with its matching FCL and paszlib units, a C runtime, Fontconfig with installed TrueType fonts, and the file, ldd, and timeout tools; FPC_EXE and HPDF_LINUX_OUTPUT select the compiler and isolated output directory
The minimum supported FPC version is 3.3.1 on every platform; new acceptance records the actual compiler build and source identity, while older compiler results remain historical evidence
Native document integrations
The native headless document API loads classic, xref-stream, hybrid and compressed-object graphs, resolves page and Form resources, extracts Unicode text, edits supported AcroForm fields, imports pages and publishes incremental revisions with preserved source bytes
The versioned Linux C ABI exposes actual ELF document handles and synchronous C callbacks for these native operations; THotPDF remains the separate Windows component integration
Native document workflows provide HTML import, visible and invisible page text, actual Tesseract OCR and raster PDF/A-4 conversion; page imports and validated text/vector archival conversion preserve original resources, and explicit archival font repair adds bounded substitute embedding
See Tests/Linux/Readme.en-us.md for platform adapter contracts, Direct File type ownership, regression boundaries and links to the native workflow and deployment evidence
The headless document now accepts the bounded Standard AES-256 R5/R6 profile described by THPDFHeadlessAES256Security, including owner/user permissions, compressed objects and encrypted incremental form saves
See native Cairo rendering and atomic native signature publication for runtime dependencies, supported content, budgets, permissions, source identity and output contracts
Unicode form appearances support multiline text, comb cells, rotations, password masks and optional HarfBuzz/FriBidi shaping; separate native APIs handle choice and button fields, supplied font families and typed rich text with preserved encrypted revisions
Native signing workflows include PEM/PFX identities, new signature fields, visible appearances and certification; explicit timestamp transport, trust and validated revocation evidence retain their documented cryptographic and publication requirements
Remaining capability boundaries
The headless document security profile supports Standard AES-256 R5/R6; other security handlers remain outside that profile rather than becoming supported through the portable-core adapter
Broader annotation rendering, general rich-text CSS/layout, complete FDF action and resource graphs, and general dynamic XFA compatibility remain active in the capability completion plan; the implemented native integrations above are available independently of that remaining work