95 Commits

Author SHA1 Message Date
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
Laurenz
f105663037 Basic image support 🖼
- [image] function
- Image rendering in tests
- Supports JPEG and PNG
- No PDF export so far
2020-11-20 16:36:22 +01:00
Laurenz
2e6e6244cc Switch to pdf-writer ⬆️ 2020-11-19 23:46:51 +01:00
Laurenz
d3bc4ec073 Refactor layouting base 🪁 2020-10-11 22:38:30 +02:00
Laurenz
92c01da360 Switch back to custom geometry types, unified with layout primitives 🏞 2020-10-10 22:19:36 +02:00
Laurenz
13230db68c Fix some clippy warnings ✔ 2020-10-07 19:28:34 +02:00
Laurenz
335fa2d118 Small improvements 🍪 2020-10-04 23:31:35 +02:00
Laurenz
c1dd872b34 Remove unncessary wrappers and typedefs 🛑 2020-10-04 19:57:39 +02:00
Laurenz
6672f8f7df Remove Typesetter in favor of typeset function 🎯 2020-10-04 18:18:55 +02:00
Laurenz
0fc25d732d Port to kurbo 🎋 2020-10-03 13:23:59 +02:00
Laurenz
7143e10afc Streamline font handling a bit 📜 2020-09-30 13:18:42 +02:00
Laurenz
181f756a9e Format everything with rustfmt! 💚 2020-08-30 22:18:55 +02:00
Laurenz
2a92428ff6 Do as Dolores says 2020-08-27 21:47:26 +02:00
Laurenz
dbfb3d2ced Formatting, documentation and small improvements 🧽 2020-08-03 16:04:55 +02:00