Skip to main content

f_office/
lib.rs

1//! Public API of F-Office.
2//!
3//! F-Office renders Office Open XML documents the way Microsoft Office does, starting with
4//! Word's DOCX format. This crate opens a file and lays it out into a display list, which
5//! `f-office-raster` draws as pixels, or writes it as a PDF file. The other `f-office-*` crates
6//! are internal and have no stability promise before 1.0.
7
8use std::fmt;
9
10pub mod edit;
11mod incremental;
12mod pictures;
13#[cfg(any(test, feature = "development"))]
14pub mod suite;
15
16pub use incremental::{LayoutContinuation, LayoutProgress, PreparedDocument};
17
18#[cfg(any(test, feature = "development"))]
19use f_office_docx::PlacedLine;
20use f_office_docx::TextMap;
21use f_office_fonts::FontDb;
22use f_office_opc::Package;
23
24/// The configuration: the setup of Word's machine and the user's choice of fonts, and the types
25/// of its keys.
26pub use f_office_docx::configuration;
27/// Why a target's ID names no target, or the configuration or the target's profile does not
28/// read: the error of `Target::from_str` and of [`Error::Configuration`].
29pub use f_office_docx::configuration::Error as ConfigurationError;
30pub use f_office_docx::{
31    ART_PICTURES_BYTE_LIMIT, ART_PICTURES_CLIP_DEPTH_LIMIT, ART_PICTURES_COMMAND_LIMIT,
32    ART_PICTURES_REACH_LIMIT, ART_PICTURES_SHAPE_LIMIT, ART_PICTURES_SIZE_LIMIT, Address,
33    AddressError, AddressStep, ArtPictures, ArtPicturesError, ArtPicturesFault, CellPlace,
34    Configuration, DateTime, EndHyphen, LineTextEnd, LineTurn, LinkTarget, NumberSeparators,
35    NumberSeparatorsError, StoryBookmark, StoryLink, StoryParagraph, Target, TextBlock,
36    TextBlockKind, TextCluster, TextLine, TextStory,
37};
38pub use f_office_fonts::FontDb as FontDatabase;
39pub use f_office_opc::{Limits, RandomAccessRead, XmlLimits};
40pub use f_office_paint::{DisplayList, ImageFault, ImageFormat, Page};
41pub use f_office_units::Length;
42pub use f_office_warnings::Name;
43
44/// The warnings of the DOCX layout, which [`Warning::Docx`] holds, and the types of their
45/// fields.
46pub mod docx {
47    pub use f_office_docx::{
48        ChartReason, Drawing, DrawingMlFeature, DrawingMlWarning, Feature, GroupTransform, Limit,
49        MetafileRecordType, MetafileWarning, NoteKind, ReadAs, Reason, SubstituteLayout,
50        ValuePlace, Warning,
51    };
52    pub use f_office_fonts::ShapeFailure;
53}
54
55/// The warnings of the PDF writer, which [`Warning::Pdf`] holds.
56pub mod pdf {
57    pub use f_office_pdf::Warning;
58}
59
60// A finished display list, and the document that holds
61// it, stay `Send + Sync`.
62const _: () = {
63    const fn shared<T: Send + Sync>() {}
64    shared::<DisplayList>();
65    shared::<Document>();
66};
67
68/// Timing spans of the rendering stages: `open` (the package),
69/// `docx` (reading the parts and the layout), `layout` (the layout passes inside `docx`) and
70/// `pdf` (writing the PDF file), recorded on a thread that called [`timing::arm`].
71#[cfg(feature = "timing")]
72pub mod timing {
73    pub use f_office_docx::timing::{arm, take};
74}
75
76/// Why a document could not be rendered.
77#[derive(Clone, Debug, PartialEq, Eq)]
78#[non_exhaustive]
79pub enum Error {
80    /// The package could not be read.
81    Package(f_office_opc::Error),
82    /// The DOCX content could not be laid out.
83    Docx(f_office_docx::Error),
84    /// The pages could not be written as PDF.
85    Pdf(f_office_pdf::Error),
86    /// The configuration or the target's profile does not read.
87    Configuration(ConfigurationError),
88}
89
90impl fmt::Display for Error {
91    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
92        f.write_str(match self {
93            Self::Package(_) => "the package could not be read",
94            Self::Docx(_) => "the DOCX content could not be laid out",
95            Self::Pdf(_) => "the pages could not be written as PDF",
96            Self::Configuration(_) => "the configuration or the target's profile does not read",
97        })
98    }
99}
100
101impl std::error::Error for Error {
102    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
103        Some(match self {
104            Self::Package(error) => error,
105            Self::Docx(error) => error,
106            Self::Pdf(error) => error,
107            Self::Configuration(error) => error,
108        })
109    }
110}
111
112/// What a rendering left out of the file, or drew in another way than the file asks, while it
113/// went on with the rest. A warning holds no content of the document, only the names that the
114/// file uses to point at a part or a font, cut and with printable characters only ([`Name`]).
115#[derive(Clone, Debug, PartialEq, Eq, Hash)]
116#[non_exhaustive]
117pub enum Warning {
118    /// A warning of the DOCX layout.
119    Docx(docx::Warning),
120    /// A warning of the PDF writer.
121    Pdf(pdf::Warning),
122    /// A picture whose file the target's PDF writer writes again, such as each JPEG file at
123    /// its quality, and that keeps its own file because its data does not decode.
124    PictureNotWrittenAgain {
125        /// The picture's format.
126        format: ImageFormat,
127    },
128    /// An edit changed a package that holds a digital signature, which no longer matches the
129    /// changed parts ([`edit::apply`]).
130    SignatureBroken,
131    /// A deleted block held the reference of a footnote or an endnote, whose note stays in its
132    /// part ([`edit::apply`]).
133    NoteKept,
134}
135
136impl Warning {
137    /// The warning's kind, a short name that stays the same across versions and holds no name
138    /// of the file, such as `font-substituted`, for a caller that counts warnings or writes them
139    /// where the names of the file may not go.
140    #[must_use]
141    pub fn kind(&self) -> &'static str {
142        match self {
143            Self::Docx(warning) => warning.kind(),
144            Self::Pdf(warning) => warning.kind(),
145            Self::PictureNotWrittenAgain { .. } => "picture-not-written-again",
146            Self::SignatureBroken => "signature-broken",
147            Self::NoteKept => "note-kept",
148        }
149    }
150}
151
152impl fmt::Display for Warning {
153    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
154        match self {
155            Self::Docx(warning) => warning.fmt(f),
156            Self::Pdf(warning) => warning.fmt(f),
157            Self::PictureNotWrittenAgain { format } => write!(
158                f,
159                "a picture in {format} format keeps its own file, which the target's PDF writer \
160                 writes again: its data does not decode"
161            ),
162            Self::SignatureBroken => f.write_str(
163                "the package holds a digital signature, which the edits break: sign the new file again",
164            ),
165            Self::NoteKept => f.write_str(
166                "a deleted block held the reference of a footnote or an endnote, and the note stays in its part: delete it with a raw edit if it must go",
167            ),
168        }
169    }
170}
171
172/// The warnings of a call, each distinct warning once with the number of times it came.
173pub type Warnings = f_office_warnings::Warnings<Warning>;
174
175/// The value of a call with its warnings.
176pub type Warned<T> = f_office_warnings::Warned<T, Warning>;
177
178/// The error chain of `error`: its own text, then the text of each cause that
179/// [`source`](std::error::Error::source) gives, joined by `: `. Each error of F-Office writes only
180/// its own text and gives its cause through `source`, so a place that shows an error to a person
181/// writes this, so that the cause stays visible.
182#[must_use]
183pub fn error_chain(error: &dyn std::error::Error) -> String {
184    let mut text = error.to_string();
185    let mut cause = error.source();
186    while let Some(next) = cause {
187        text.push_str(": ");
188        text.push_str(&next.to_string());
189        cause = next.source();
190    }
191    text
192}
193
194/// Choices for opening a document that the document itself does not make. Start from
195/// [`Options::default`] and set the fields that differ, so that a new field breaks no caller.
196/// The default lays out for the default target with its defaults.
197#[derive(Clone, Debug, PartialEq, Eq)]
198#[non_exhaustive]
199pub struct Options {
200    /// The local date and time that `DATE` and `TIME` fields show, as Word shows the time of
201    /// printing. Without it, they show the results stored in the file, so that the same file
202    /// always gives the same pages.
203    pub now: Option<DateTime>,
204    /// The configuration of the pages: the target and the setup of Word's machine, such as the
205    /// resolution of the printer that Word lays out for ([`Configuration::of`]).
206    pub configuration: Configuration,
207    /// The development override of the target profile's values, such as quirk variants,
208    /// after the configuration.
209    #[cfg(any(test, feature = "development"))]
210    pub overrides: f_office_docx::profile::Overrides,
211    /// The limits that protect the readers against a hostile file: those of the ZIP file and
212    /// those of each XML part. A limit of the ZIP file that the file breaks stops the document
213    /// ([`Error::Package`]), with an error that names the limit. An XML part that breaks a limit
214    /// does not read, and the part policy decides: the main document part and the package's
215    /// relationships stop the document ([`Error::Docx`]), and another part is skipped with a
216    /// warning.
217    pub limits: Limits,
218}
219
220impl Default for Options {
221    fn default() -> Self {
222        Self {
223            now: None,
224            configuration: Configuration::of(Target::default()),
225            #[cfg(any(test, feature = "development"))]
226            overrides: f_office_docx::profile::Overrides::default(),
227            limits: Limits::default(),
228        }
229    }
230}
231
232impl Options {
233    /// Options for the base target, used by internal layout unit tests written against the base
234    /// profile.
235    #[cfg(test)]
236    pub(crate) fn base() -> Self {
237        Self {
238            configuration: Configuration::of(Target::base()),
239            ..Self::default()
240        }
241    }
242
243    /// The options of the layout: the same choices without the limits, which the package
244    /// carries to every reader of its parts.
245    fn layout(&self) -> f_office_docx::Options {
246        let mut layout = f_office_docx::Options::default();
247        layout.now = self.now;
248        layout.configuration = self.configuration.clone();
249        #[cfg(any(test, feature = "development"))]
250        {
251            layout.overrides = self.overrides.clone();
252        }
253        layout
254    }
255}
256
257/// A DOCX file opened and laid out once for a target: its display list, which an output draws or
258/// writes, the places of its lines, and the text blocks of its body. It holds no state of the
259/// parse or the layout: what the layout left out or drew in another way comes out of
260/// [`Document::open`] beside it.
261#[derive(Clone, Debug)]
262pub struct Document {
263    list: DisplayList,
264    #[cfg(any(test, feature = "development"))]
265    lines: Vec<PlacedLine>,
266    #[cfg(any(test, feature = "development"))]
267    tables: Vec<f_office_docx::TableColumns>,
268    text_blocks: Vec<TextBlock>,
269    text_map: TextMap,
270}
271
272impl Document {
273    /// Opens a DOCX file and lays it out into pages for the target of `options`, with the
274    /// warnings of what it left out or drew in another way. The layout runs once, here.
275    ///
276    /// # Errors
277    ///
278    /// Returns an error when the file is not a readable DOCX package or its content cannot be
279    /// laid out, or when the configuration or the target's profile does not read.
280    pub fn open(docx: &[u8], fonts: &FontDb, options: &Options) -> Result<Warned<Self>, Error> {
281        Self::open_with_art(docx, fonts, &ArtPictures::new(), options)
282    }
283
284    /// Opens a DOCX file as [`Document::open`] does, with the pictures of the art page borders
285    /// `art`, which the caller adds beside the fonts ([`ArtPictures::add`]). A page border's side
286    /// of an art style whose picture `art` lacks is not drawn, with a warning.
287    ///
288    /// # Errors
289    ///
290    /// As [`Document::open`].
291    pub fn open_with_art(
292        docx: &[u8],
293        fonts: &FontDb,
294        art: &ArtPictures,
295        options: &Options,
296    ) -> Result<Warned<Self>, Error> {
297        Self::open_with((docx, fonts, art), &options.limits, &options.layout())
298    }
299
300    /// Opens a DOCX file from disk and lays it out into pages for the target of `options`,
301    /// reading only the ZIP central directory and the parts needed for layout without loading
302    /// the entire file into memory.
303    ///
304    /// # Errors
305    ///
306    /// Returns an error when the file cannot be opened as a DOCX package, its content cannot be
307    /// laid out, or the configuration or target profile does not read.
308    #[cfg(not(target_arch = "wasm32"))]
309    pub fn open_file(
310        path: &std::path::Path,
311        fonts: &FontDb,
312        options: &Options,
313    ) -> Result<Warned<Self>, Error> {
314        Self::open_file_with_art(path, fonts, &ArtPictures::new(), options)
315    }
316
317    /// Opens a DOCX file from disk as [`Document::open_file`] does, with art page-border
318    /// pictures `art`.
319    ///
320    /// # Errors
321    ///
322    /// As [`Document::open_file`].
323    #[cfg(not(target_arch = "wasm32"))]
324    pub fn open_file_with_art(
325        path: &std::path::Path,
326        fonts: &FontDb,
327        art: &ArtPictures,
328        options: &Options,
329    ) -> Result<Warned<Self>, Error> {
330        let package =
331            f_office_docx::timing::span("open", || Package::open_file(path, &options.limits))
332                .map_err(Error::Package)?;
333        Self::open_package((&package, fonts, art), &options.layout())
334    }
335
336    /// Opens a DOCX package from a caller-provided random-access byte source (such as a browser
337    /// `File.slice()` or OPFS sync handle) without copying the whole archive into memory.
338    ///
339    /// # Errors
340    ///
341    /// As [`Document::open`].
342    pub fn open_source(
343        source: std::sync::Arc<dyn RandomAccessRead>,
344        fonts: &FontDb,
345        options: &Options,
346    ) -> Result<Warned<Self>, Error> {
347        Self::open_source_with_art(source, fonts, &ArtPictures::new(), options)
348    }
349
350    /// Opens a DOCX package from a random-access byte source as [`Document::open_source`] does,
351    /// with art page-border pictures `art`.
352    ///
353    /// # Errors
354    ///
355    /// As [`Document::open`].
356    pub fn open_source_with_art(
357        source: std::sync::Arc<dyn RandomAccessRead>,
358        fonts: &FontDb,
359        art: &ArtPictures,
360        options: &Options,
361    ) -> Result<Warned<Self>, Error> {
362        let package =
363            f_office_docx::timing::span("open", || Package::open_source(source, &options.limits))
364                .map_err(Error::Package)?;
365        Self::open_package((&package, fonts, art), &options.layout())
366    }
367
368    /// Opens a DOCX file within `limits` with its fonts and art pictures, and lays it out with
369    /// the layout's own options, as [`Document::open_with_art`] does.
370    fn open_with(
371        (docx, fonts, art): (&[u8], &FontDb, &ArtPictures),
372        limits: &Limits,
373        layout: &f_office_docx::Options,
374    ) -> Result<Warned<Self>, Error> {
375        let package = f_office_docx::timing::span("open", || Package::open(docx, limits))
376            .map_err(Error::Package)?;
377        Self::open_package((&package, fonts, art), layout)
378    }
379
380    /// Lays out an already-indexed OPC `package` with `fonts`, `art`, and `layout`.
381    fn open_package(
382        (package, fonts, art): (&Package, &FontDb, &ArtPictures),
383        layout: &f_office_docx::Options,
384    ) -> Result<Warned<Self>, Error> {
385        let laid_out = f_office_docx::timing::span("docx", || {
386            f_office_docx::layout_lines(package, (fonts, art), layout)
387        })
388        .map_err(|error| match error {
389            f_office_docx::Error::Configuration(error) => Error::Configuration(error),
390            error => Error::Docx(error),
391        })?;
392        let mut warnings = laid_out.warnings.map(Warning::Docx);
393        #[cfg(not(any(test, feature = "development")))]
394        let f_office_docx::LaidOut {
395            mut list,
396            lines: _,
397            text_blocks,
398            text_map,
399            tables: _,
400            writer,
401        } = laid_out.value;
402        #[cfg(any(test, feature = "development"))]
403        let f_office_docx::LaidOut {
404            mut list,
405            lines,
406            text_blocks,
407            text_map,
408            tables,
409            writer,
410        } = laid_out.value;
411        // The target's PDF writer decides how the page size is written, and which picture files
412        // it writes again.
413        writer.finish(&mut list);
414        list = pictures::write_pictures_again(
415            list,
416            pictures::Rewriting {
417                quality: writer.jpeg_quality(),
418                jpeg_share: writer.jpeg_share(),
419                jpeg_sample: writer.jpeg_sample(),
420                crop: writer.picture_crop(),
421                alpha_mix: writer.alpha_mix(),
422                resampling: &|pixels, palette, image| {
423                    writer.resampled_size(pixels, (image.width, image.height), palette)
424                },
425            },
426            &mut warnings,
427        );
428        // It then writes each picture's matrix with its own digits, at the place where the
429        // picture is drawn after a crop.
430        writer.place_pictures(&mut list);
431        Ok(Warned::new(
432            Self {
433                list,
434                #[cfg(any(test, feature = "development"))]
435                lines,
436                #[cfg(any(test, feature = "development"))]
437                tables,
438                text_blocks,
439                text_map,
440            },
441            warnings,
442        ))
443    }
444
445    /// The display list of the pages, the only border between the layout and an output.
446    #[must_use]
447    pub fn display_list(&self) -> &DisplayList {
448        &self.list
449    }
450
451    /// The pages in order: the pages of the display list ([`Document::display_list`]).
452    #[must_use]
453    pub fn pages(&self) -> &[Page] {
454        self.list.pages()
455    }
456
457    /// The number of pages.
458    #[must_use]
459    pub fn page_count(&self) -> usize {
460        self.pages().len()
461    }
462
463    /// The page at `index`, counted from 0, or none past the last page.
464    #[must_use]
465    pub fn page(&self, index: usize) -> Option<&Page> {
466        self.pages().get(index)
467    }
468
469    /// The width and the height of the page at `index`, counted from 0, without drawing it, or
470    /// none past the last page.
471    #[must_use]
472    pub fn page_size(&self, index: usize) -> Option<(Length, Length)> {
473        self.page(index).map(|page| (page.width(), page.height()))
474    }
475
476    /// The paragraphs and tables of the body in the order of the document, each with its
477    /// address, which counts from 1, its kind with its style and text, and the indices of the
478    /// pages that its lines lie on, which count from 0 as [`Document::page`] does. The pages are
479    /// those of this document's layout, so of the configuration that it was opened with
480    /// ([`Options::configuration`]): the same file can give other pages for another target.
481    /// The paragraphs of a table's cells follow the table. Headers, footers, notes and text
482    /// boxes are not text blocks.
483    #[must_use]
484    pub fn text_blocks(&self) -> &[TextBlock] {
485        &self.text_blocks
486    }
487
488    /// The text map of the page at `index`, counted from 0 (**Text map**): its lines in reading
489    /// order, the header first, then the body, the endnotes, the frames, the text boxes, the
490    /// footnotes and the footer.
491    /// Each line names its story and its paragraph in [`Document::story_text`], with its range
492    /// of the paragraph's text, its line box and its clusters in visual order with their edges
493    /// on the page. It is empty past the last page.
494    #[must_use]
495    pub fn text_map(&self, index: usize) -> Vec<TextLine> {
496        self.text_map.page(index)
497    }
498
499    /// The text maps of the pages at `indices`, each as [`Document::text_map`] gives it, from
500    /// one read of each story on them: a viewer that needs many pages, such as for a search,
501    /// reads the body once and not once for each page.
502    #[must_use]
503    pub fn text_maps(&self, indices: &[usize]) -> Vec<Vec<TextLine>> {
504        self.text_map.pages(indices)
505    }
506
507    /// The text of `story` by paragraph (**Story text**): the texts of the paragraph's laid out
508    /// lines joined, so that a field gives its shown result, a list label is given as drawn,
509    /// hidden text is left out, and an automatic hyphen at a wrap is not in it.
510    #[must_use]
511    pub fn story_text(&self, story: TextStory) -> Vec<StoryParagraph> {
512        self.text_map.story(story)
513    }
514
515    /// Writes the pages as a PDF file, with the fonts subset and embedded, and with the warnings
516    /// of the PDF writer.
517    ///
518    /// Each page becomes one PDF page of the same size, with every glyph at its laid out position
519    /// and with its text, so that a viewer can search and copy it. The same document and fonts
520    /// always give the same bytes.
521    ///
522    /// # Errors
523    ///
524    /// Returns an error when the pages cannot be written as PDF.
525    pub fn write_pdf(&self, fonts: &FontDb) -> Result<Warned<Vec<u8>>, Error> {
526        let pdf = f_office_docx::timing::span("pdf", || f_office_pdf::write_pdf(&self.list, fonts))
527            .map_err(Error::Pdf)?;
528        Ok(Warned::new(pdf.value, pdf.warnings.map(Warning::Pdf)))
529    }
530
531    /// Streams the pages directly as a PDF 1.7 document into `writer` without buffering the
532    /// complete PDF bytes in memory.
533    ///
534    /// # Errors
535    ///
536    /// Returns an error when the pages cannot be written as PDF or when writing to `writer` fails.
537    pub fn write_pdf_to<W: std::io::Write>(
538        &self,
539        fonts: &FontDb,
540        writer: &mut W,
541    ) -> Result<Warned<()>, Error> {
542        let pdf = f_office_docx::timing::span("pdf", || {
543            f_office_pdf::write_pdf_to(&self.list, fonts, writer)
544        })
545        .map_err(Error::Pdf)?;
546        Ok(Warned::new((), pdf.warnings.map(Warning::Pdf)))
547    }
548}
549
550#[cfg(test)]
551mod tests {
552    use super::{Document, Error, FontDb, Options, error_chain};
553
554    #[test]
555    fn says_the_warnings_of_the_output_with_their_kinds() {
556        use super::{ImageFault, ImageFormat, Warning, pdf};
557        let skipped = Warning::Pdf(pdf::Warning::ImageSkipped {
558            format: ImageFormat::Wmf,
559            fault: ImageFault::Format,
560        });
561        assert_eq!(skipped.kind(), "pdf-image-skipped");
562        assert_eq!(
563            skipped.to_string(),
564            "an image in WMF format is left out of the PDF: the output draws no image of this \
565             format"
566        );
567        let kept = Warning::PictureNotWrittenAgain {
568            format: ImageFormat::Jpeg,
569        };
570        assert_eq!(kept.kind(), "picture-not-written-again");
571        assert_eq!(
572            kept.to_string(),
573            "a picture in JPEG format keeps its own file, which the target's PDF writer writes \
574             again: its data does not decode"
575        );
576    }
577
578    #[test]
579    fn rejects_a_file_that_is_not_a_package_for_every_target() {
580        let error = Document::open(b"not a zip", &FontDb::new(), &Options::default()).unwrap_err();
581        assert!(matches!(error, Error::Package(_)));
582        assert_ne!(error.to_string(), "");
583        // The same error, with the same text and cause, for every target.
584        for target in super::Target::all() {
585            let options = Options {
586                configuration: super::Configuration::of(target),
587                ..Options::default()
588            };
589            let with = Document::open(b"not a zip", &FontDb::new(), &options).unwrap_err();
590            assert!(matches!(with, Error::Package(_)));
591            assert_eq!(error_chain(&with), error_chain(&error));
592        }
593    }
594
595    #[test]
596    fn gives_the_pdf_error_as_its_cause() {
597        let error = Error::Pdf(f_office_pdf::Error::NoPages);
598        assert_eq!(error.to_string(), "the pages could not be written as PDF");
599        let cause = std::error::Error::source(&error).map(ToString::to_string);
600        assert_eq!(cause.as_deref(), Some("the display list has no page"));
601    }
602
603    #[test]
604    fn writes_the_error_chain_down_to_the_first_cause() {
605        let error = Document::open(b"not a zip", &FontDb::new(), &Options::default()).unwrap_err();
606        let chain = error_chain(&error);
607        assert!(
608            chain.starts_with("the package could not be read: unreadable ZIP package: "),
609            "{chain}"
610        );
611        let docx = Error::Docx(f_office_docx::Error::Package(
612            f_office_opc::Error::NoMainDocument,
613        ));
614        assert_eq!(
615            error_chain(&docx),
616            "the DOCX content could not be laid out: the package could not be read: package has \
617             no main document"
618        );
619        let leaf = f_office_pdf::Error::NoPages;
620        assert_eq!(error_chain(&leaf), "the display list has no page");
621    }
622}
623
624#[cfg(test)]
625mod comment_tests;
626#[cfg(test)]
627mod layout_tests;
628#[cfg(test)]
629mod pdf_tests;
630#[cfg(test)]
631mod picture_tests;
632#[cfg(test)]
633mod test_fonts;
634#[cfg(test)]
635mod text_block_tests;