← Trifold
Engine source (MPL-2.0)
Trifold reads Publisher files with libmspub and librevenge 0.0.6, both under the Mozilla Public License 2.0, compiled to WebAssembly. librevenge is used unchanged. libmspub is used at commit 33709dc22b22f81eb6804c304fe322ca80ad43a5 with the changes below, which are offered here under the same licence.
To get the source as compiled: git clone https://github.com/LibreOffice/libmspub.git && cd libmspub && git checkout 33709dc22b22f81eb6804c304fe322ca80ad43a5, then apply the patches in order with git apply.
What the changes do
1. 01-libmspub-metadata-fix.patch: a damaged document summary no longer stops the whole file from opening; the metadata is skipped instead. 2. 02-libmspub-lists-and-hyphenation.patch:
- Bullets and numbering. The parser read the list settings from the wrong block, so every list lost its bullet or number type, and lists were never passed on. Paragraphs in a list now come out as list elements inside list levels, with the bullet character (the Symbol font's bullet becomes U+2022) or the number format, delimiter and start value. A paragraph also inherits the list of the style it is based on.
- The numbering delimiter (block 0x58) is read.
- Hyphenation. The MCLD chunk of the Quill stream holds one record per story, in the order of the STRS chunk: block 0 says whether the story hyphenates automatically (block type 0x0a: yes, 0x02: no) and block 1 is the hyphenation zone in EMU. Spans of a story get
fo:hyphenate, and paragraphs of a hyphenated story get librevenge:hyphenation-zone.
3. 03-libmspub-tabs-wrap-and-tables.patch:
- Tab stops. Each tab stop record holds its position (block 0) and, when it is not a left tab, its alignment (block 1: 1 right, 2 center, 3 decimal). Paragraphs get
style:tab-stops, from the paragraph or else from the style it is based on. - Wrapping. Block 0x04 of a shape's record says how text flows around it; a low byte of 0 means text does not wrap around the shape, which comes out as
style:wrap "none" in the shape's style. The distances kept between the shape and the wrapped text (OfficeArt properties 0x384 to 0x387) come out as fo:margin-left, -top, -right and -bottom. - Table borders. Publisher stores them as shapes of their own, without a position: the anchor names the table (0x6802) and a run along its grid lines (0x2001: 1 along a row line, 2 along a column line; 0x2004 to 0x2007: start row, start column, end row, end column). The shape's fill color is the border's color and its line width the border's width. The table gets them as
librevenge:table-borders. - Table cells. Blocks 0x0a to 0x0d of a cell record are its left, right, top and bottom margins, and block 0x07 its vertical alignment (1 middle, 2 bottom). Cells get
fo:padding-* and style:vertical-align.