Commit Graph

208 Commits

Author SHA1 Message Date
Laurenz 59f67b79c7 Remove image store 2022-09-19 12:49:36 +02:00
Laurenz 30be75c668 Renaming
`Face` -> `Font`
`FaceId` -> `FontId`
`SourceFile` -> `Source`
2022-09-19 11:36:59 +02:00
Laurenz 4ec3bcee48 Remove pins and memoization 2022-09-19 11:16:05 +02:00
Laurenz 4817c62dfb Split up PDF exporter 2022-06-14 21:36:33 +02:00
Laurenz 20b990d297 Anti-aliased image rendering 2022-06-14 17:20:31 +02:00
Laurenz c81e2a5f56 Many fixes 2022-06-14 13:53:02 +02:00
Laurenz 7660978ee5 Move `Arc` into `Frame` 2022-06-12 20:51:31 +02:00
Laurenz 6e3b1a2c80 Make all fields of `Frame` private 2022-06-12 17:26:18 +02:00
Laurenz ed6550fdb0 Bump dependencies 2022-06-10 23:54:16 +02:00
Laurenz 6aff11057b Non-outlined headings 2022-06-09 13:45:36 +02:00
Martin Haug 72d3f3fffa CR: Whoever said orange is the new pink was seriously disturbed. 2022-06-08 19:26:20 +02:00
Martin Haug 9dca4c2f78 Preallocate Page Refs 2022-06-08 17:05:07 +02:00
Martin Haug 55dce19f49 Restructure PDF structure writing 2022-06-08 16:36:50 +02:00
Martin Haug 4640585fbd First iteration of outline items 2022-06-04 12:57:45 +02:00
Martin Haug 4e3036afcb Sub- and superscripts
Fixes to PDF export I guess
Also improved rendition for non-Latin scripts
2022-05-31 22:56:08 +02:00
Laurenz 97858e5992 Basic manual tracking 2022-05-31 10:13:34 +02:00
Laurenz 757615dc42 Fix color space definitions 2022-05-30 10:31:05 +02:00
Martin Haug 26a427a321 Fix `FontFile3` dictionary for OpenType-Fonts 2022-05-30 10:28:06 +02:00
Laurenz 1a7ce3da02 Luma color 2022-05-27 16:09:43 +02:00
Laurenz f8009b5b59 Reuse location type 2022-05-27 14:34:27 +02:00
Laurenz 66d8f4569a Locate me! 2022-05-26 11:59:53 +02:00
Martin Haug 99cb655832 Intra-document links 2022-05-27 12:56:20 +02:00
Laurenz 0170913d54 Rebrand queries as memoization 2022-05-25 21:56:22 +02:00
Laurenz c010cbc17d Move route from context to VM 2022-05-25 13:59:06 +02:00
Laurenz 362a7f2a8a Thread-local query cache 2022-05-25 10:55:08 +02:00
Martin Haug 84bd3454df Write language and direction for PDFs 2022-05-11 16:25:49 +02:00
Laurenz a247653cd0 Fix wrong table padding in subsetting 2022-05-09 09:41:13 +02:00
Martin Haug 49b8574b8d Fix CFF font bug 2022-05-07 17:23:44 +02:00
Martin Haug f07395f9a4 Move rounding logic out of exporters 2022-05-02 17:20:47 +02:00
Martin Haug 5f1499d380 Add round corners and change arguments 2022-05-01 11:50:34 +02:00
Laurenz 29eb13ca62 Sum color and length into stroke 2022-04-09 12:02:35 +02:00
Laurenz 712c00ecb7 Em units 2022-04-08 15:45:14 +02:00
Laurenz 4bb6240b40 Make `Relative` generic 2022-04-07 18:04:29 +02:00
Laurenz 20b4d590b3 Fix wrong `search_range` computation 2022-04-05 17:03:24 +02:00
Laurenz 23d108c8e0 Font fallback 2022-04-03 13:55:58 +02:00
Laurenz f2f473a81f Query cache 2022-02-23 17:17:00 +01:00
Laurenz e1f29d6cb9 Rework the core context 2022-02-23 14:53:55 +01:00
Laurenz 2bf32c51bc Remove layout cache 2022-02-22 12:42:02 +01:00
Laurenz 9730e785a8 Tidy up 2022-02-07 14:19:13 +01:00
Martin Haug fe70db1f4c New color stuff
- CMYK function
- More default colors
- Interpret RGB values as sRGB
2022-02-08 21:12:09 +01:00
Laurenz 20b1a38414 Switch from `Rc` to `Arc` 2022-01-31 16:47:00 +01:00
Laurenz 3739ab7720 Export into rendered images 2022-01-24 17:39:49 +01:00
Laurenz f5dcb84e36 Make clippy a bit happier 2021-12-30 12:00:12 +01:00
Martin Haug 7c829c5c1b Bump pdf-writer, svg2pdf and error messages
Co-Authored-By: Laurenz <laurmaedje@gmail.com>
2021-12-07 00:06:54 +01:00
Martin Haug f15ee7efb6 Add SVG capabilities 2021-12-06 14:58:57 +01:00
Laurenz 2982020480 Bump pdf-writer 2021-12-04 21:55:23 +01:00
Martin Haug d971ac9a8c Add a producer info for the PDF 2021-12-02 17:24:52 +01:00
Laurenz 3a15922d2f X/Y abstractions 2021-11-26 16:32:06 +01:00
Laurenz 304d9dd110 Small style changes 2021-11-24 17:00:10 +01:00
Laurenz 8a88f71cb1 Transformations 2021-11-23 22:04:08 +01:00
Laurenz 0a974d86ba Welcome to Tigerland 2021-11-22 15:26:56 +01:00
Laurenz cef46e6c40 Strokes 2021-11-20 15:51:07 +01:00
Laurenz 9a800daa82 Image fit modes 2021-11-16 21:32:29 +01:00
Laurenz 0e0f340502 Revert page and inline levels 2021-11-16 10:41:30 +01:00
Laurenz 63c274e7f6 Make clippy happier and remove `Str` 2021-11-15 17:06:43 +01:00
Laurenz 5b344b663a Reorganize modules
Instead of separating functionality into layout and library, everything lives in the library now. This way, related things live side by side and there are no duplicate file names in the two directories.
2021-10-31 15:52:35 +01:00
Laurenz d4cc8c775d Move paint and colors into `geom` 2021-10-10 20:26:58 +02:00
Laurenz c18321a4c2 Bugfix and tidying 2021-09-15 13:05:00 +02:00
Laurenz d2618acd8d Bump pdf-writer 2021-09-09 12:16:55 +02:00
Laurenz 411aba5b6f Subset CFF subrs referenced by FD array 2021-08-29 14:46:51 +02:00
Laurenz d101612414 Primitive CFF1 subsetting
The subsetting strategy is somewhat crazy for now: Simply zero the glyph data for all unused glyphs. While the CFF table itself doesn't shrink, the actual embedded font is compressed and greatly benefits from the repeated zeros.

This already compresses the fonts a lot (~90% for NotoSerifCJK), but they are still quite large.

Therefore, the plan of action:
- First, find more data that can be zeroed out.
- Then _maybe_ see whether we can instead properly rebuild the subsetted font.
2021-08-28 23:53:46 +02:00
Laurenz 73b63ffb99 Refactor subsetter
- Gracefully handle failed subsetting of one table
- Remove need for creating a ttf-parser face
2021-08-27 14:11:49 +02:00
Laurenz dff2175558 Subset post table 2021-08-27 14:08:32 +02:00
Laurenz 0471e51bc4 Compress all PDF streams 2021-08-25 13:45:49 +02:00
Laurenz f2882bf854 Support decoding of mac roman names
This allows discovery of Apple fonts without unicode name entries.
2021-08-25 13:24:30 +02:00
Laurenz 821536b253 Subset glyf and loca tables 2021-08-25 12:12:47 +02:00
Laurenz 6f84cf3c22 Basic subsetting architecture
Constructs a brand new font file where only necessary tables are contained.
2021-08-24 23:43:51 +02:00
Laurenz 7a2e3c80b5 PDF bug fixes
- Write correct subtype for CID Font
- Write CIDToGIDMap attribute
- Deduplicate CMap pairings
- Bump pdf-writer for string primitive fix
2021-08-24 17:18:50 +02:00
Laurenz 148a06c070 Switch from state to decorations for underline/strikethrough/overline 2021-08-24 00:41:15 +02:00
Martin d546453880
Links! (#43)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
2021-08-23 23:56:33 +02:00
Laurenz 0806af4aec Kerned PDF output 2021-08-23 13:21:44 +02:00
Laurenz c0377de653 Shorter/clearer field name for geometry types
Size { width, height } => Size { w, h }
Spec { horizontal, vertical } => Spec { x, y }
Gen { cross, main } => Gen { inline, block }
2021-08-21 19:08:47 +02:00
Laurenz 3932bb2cb9 New source loading architecture 2021-08-09 11:26:41 +02:00
Laurenz 9488b1b850 Main context struct 2021-07-21 11:28:29 +02:00
Laurenz fd0b89a1d8 Rename Fill to Paint 2021-07-08 22:33:44 +02:00
Martin 80a9b300d1 Ref count the frames 2021-06-18 13:01:55 +02:00
Laurenz 3330767c20 Remove props in favor of using state for everything 2021-06-11 11:30:18 +02:00
Martin Haug c28708aa19 Text decorations 2021-06-10 23:15:51 +02:00
Laurenz 7218892c72 Refactor path handling 2021-06-01 12:55:07 +02:00
Laurenz 0bfee5b777 Refactored loading and cache architecture 2021-05-28 12:46:43 +02:00
Laurenz e8057a5385 Make pdf module top-level 🧱 2021-03-24 21:48:25 +01:00
Laurenz 73615f7e3c Text shaping 🚀
- Shapes text with rustybuzz
- Font fallback with family list
- Tofus are shown in the first font

Co-Authored-By: Martin <mhaug@live.de>
2021-03-24 17:12:34 +01:00
Laurenz 898728f260 Square, circle and ellipse 🔵 2021-03-20 20:19:30 +01:00
Martin 6cb9fe9064
Text colors 🦩 (#18) 2021-03-19 22:36:13 +01:00
Laurenz 54a9ccb1a5 Configurable font edges ⚙
Adds top-edge and bottom-edge parameters to the font function. These define how
the box around a word is computed. The possible values are:
- ascender
- cap-height (default top edge)
- x-height
- baseline (default bottom edge)
- descender

The defaults are chosen so that it's easy to create good-looking designs with
vertical alignment. Since they are much tighter than what most other software
uses by default, the default leading had to be increased to 50% of the font size
and paragraph spacing to 100% of the font size.

The values cap-height and x-height fall back to ascender in case they are zero
because this value may occur in fonts that don't have glyphs with cap- or
x-height (like Twitter Color Emoji). Since cap-height is the default top edge,
doing no fallback would break things badly.

Removes softness in favor of a simple boolean for pages and a more finegread u8
for spacing. This is needed to make paragraph spacing consume line spacing
created by hard line breaks.
2021-03-19 13:20:58 +01:00
Martin Haug bd12d135ca Merge text and shape PDF loops 🎡 2021-03-19 11:05:23 +01:00
Laurenz bbb9ed07ff Better line spacing calculations ↕
- Only add line spacing between lines. Previously, line spacing was added below
  every line, making `#box[word]` higher than just `word`.
- Compute box height of text as `ascender - descender` so that the full word is
  contained in the box.
2021-03-10 10:20:01 +01:00
Laurenz a2fcc1bf28 Small fixes ♻ 2021-02-11 22:24:42 +01:00
Laurenz c80e13579f Dry-clean visitor with a macro 🏜 2021-02-07 13:14:28 +01:00
Martin Haug 80e076814d Merge `rect` and `box` 🦚 2021-02-06 12:30:44 +01:00
Martin Haug 8469bad748 Add rectangle function 🎛 2021-02-04 21:30:18 +01:00
Laurenz aae67bd572 Move and rename many things 🚛 2021-01-03 00:12:09 +01:00
Laurenz 6f111f9410 Test [font] 🧣 2020-12-17 15:43:30 +01:00
Laurenz 0cfce1de7e Switch to miniz_oxide 🔼 2020-12-11 12:37:20 +01:00
Laurenz fdc1b378a3 Compress images in PDFs ⚙ 2020-11-30 22:07:08 +01:00
Laurenz 21857064db Export alpha channel into PDF 🧊 2020-11-28 00:04:40 +01:00
Laurenz 982e7671a6 Embed each image only once into the PDF 🥔 2020-11-27 23:17:25 +01:00
Laurenz 475ca7a62e Basic environment and resource loader 🏞 2020-11-27 22:35:42 +01:00
Laurenz bc997b7c33 Export images in PDF 🖼 2020-11-27 20:01:54 +01:00
Laurenz 761931405c Use newly stabilized intra doc links ↩ 2020-11-24 16:12:41 +01:00