mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-07-31 04:29:37 +08:00
Disable automatic whole-line Bidi segment reversal for text extraction, preserving the original logical ordering of text segments on the page to match Acrobat behavior and prevent semantic phrase reversals in mixed English/Hebrew sentences. Then update FPDFTextEmbedderTest.ActualTextRtl test expectations to match this behavior change. TAG=agy CONV=f944b222-25e8-4814-ac19-fc1a0101da16 Bug: 525087036 Change-Id: Ia48be8bb74ed60e4bd1bd34b34461ea5d46b3db0 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/152910 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Andy Phan <andyphan@chromium.org>
core/
This directory contains the internal C++ implementation of the PDF specification. These modules are for internal use and may change without notice.
Subdirectories
PDFium's core is divided into several subdirectories, each with a specific responsibility:
- fdrm/ (Rights Management): Provides cryptography primitives used for PDF security and encryption handling.
- fpdfapi/ (PDF spec implementation): The central module that understands the PDF format, covering parsing, logical page representation, rendering coordination, and document editing.
- fpdfdoc/ (Document Logic): Implements higher-level document features such as Bookmarks, Annotations, Interactive Forms (AcroForms), and Links.
- fpdftext/ (Text Extraction): Specialized logic for extracting text, identifying reading order, and performing text searches within a page.
- fxcodec/ (Codecs): Responsible for decoding various PDF
stream formats. It depends on
fxgefor managing target bitmaps. - fxcrt/ (Common Runtime): The foundational layer providing base types, string handling, custom containers, and memory management utilities. It has no dependencies on other core modules.
- fxge/ (Graphics Engine): Handles rendering primitives (paths, glyphs, bitmaps), font management abstractions (FreeType, Skia, AGG), and device drivers for different platforms.
Architectural Flow: Life of a Page
Building a rendered page involves several layers working in concert:
- Parsing:
fpdfapi/parserreads raw bytes and builds the PDF object graph (Dictionaries, Streams, etc.). - Decoding: As content is accessed,
fxcodecdecodes compressed data streams. - Logical Representation:
fpdfapi/pageinterprets the objects into higher-level constructs like paths, text objects, and images. - Rendering:
fpdfapi/rendertraverses the page objects and issues drawing commands tofxge. - Rasterization:
fxgeuses its rendering backend (e.g., AGG or Skia) to convert these primitives into final pixels in a device buffer.
Coordinate Systems
PDF documents use User Space, a coordinate system where the origin (0,0) is
typically at the bottom-left of the page. Rendering devices (managed by fxge)
usually use Device Space, where the origin is at the top-left.
core/ handles the complex affine transformations needed to map between these
spaces, taking into account page rotation, scaling, and the specific
transformation matrices (CTM) defined within content streams.