Commit Graph

29 Commits

Author SHA1 Message Date
Laurenz 7d15dc634b Move font family and refactor alignment 2021-07-29 12:28:54 +02:00
Laurenz 88d3be2581 Remove PageState::new 2021-07-25 23:41:04 +02:00
Laurenz c97b3078eb Merge font and par state into text state 2021-07-25 12:10:44 +02:00
Laurenz ec5384c97f State-based monospace handling 2021-07-25 01:16:38 +02:00
Laurenz 02b586cc36 Add lots of Eq impls 2021-07-08 23:16:02 +02:00
Laurenz fd0b89a1d8 Rename Fill to Paint 2021-07-08 22:33:44 +02:00
Laurenz 7e2c217cbc Rename some library arguments
- font
  - color -> fill
  - shorthands for families and size
- decoration functions
  - color -> stroke
  - strength -> thickness
  - position -> offset
  - invert offsets: now positive goes downwards just like the rest of typst
2021-07-08 21:42:36 +02:00
Laurenz 63cf361496 Make font take everything as keyword arguments 2021-06-25 18:14:19 +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 5afb42ad89 Lists with indent-based parsing
- Unordered lists with indent-based parsing and basic layout using stacks
- Headings are now also indent based
- Removes syntax functions since they will be superseded by select & transform
2021-06-09 00:37:13 +02:00
Martin Haug e27f6c1014 Add hash impls for all nodes
This prepares the incremental PR.

Co-Authored-By: Laurenz <laurmaedje@gmail.com>
2021-05-26 22:57:29 +02:00
Laurenz 8d67c0ca5e Convert font units to lengths earlier 2021-05-17 23:06:31 +02:00
Laurenz c975d0d5e9 Tidy up layouting code 2021-05-17 22:55:31 +02:00
Laurenz 6292d25afb Reengineer font and resource loading 🏞 2021-04-23 17:46:14 +02:00
Laurenz 3d2ee54848 Refactor and comment ♻ 2021-04-07 01:08:07 +02:00
Laurenz 76fc4cca62 Refactor alignments & directions 📐
- Adds lang function
- Refactors execution context
- Adds StackChild and ParChild enums
2021-03-25 21:32:33 +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 98336bfafb Better font family definitions ✒ 2021-03-22 14:08:50 +01:00
Martin 6cb9fe9064
Text colors 🦩 (#18) 2021-03-19 22:36:13 +01:00
Laurenz 264a7dedd4 Scheduled maintenance 🔨
- New naming scheme
  - TextNode instead of NodeText
  - CallExpr instead of ExprCall
  - ...
- Less glob imports
- Removes Value::Args variant
- Removes prelude
- Renames Layouted to Fragment
- Moves font into env
- Moves shaping into layout
- Moves frame into separate module
2021-03-19 17:57:31 +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
Laurenz 584a43277d Rename ChildAlign to LayoutAligns ✏ 2021-03-12 14:12:30 +01:00
Laurenz c1b1dbcc09 Better expansion behaviour 🐪
This makes expansion behaviour inheritable by placing it into the area and passing it down during layouting instead of computing some approximation of what we want during execution.
2021-03-11 10:48:29 +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 5157c1e276 Documentation fixes ✔ 2021-03-03 23:32:29 +01:00
Laurenz d5d187a8c2 Replace default fonts 🆕 2021-03-02 17:31:41 +01:00
Laurenz 790dc9e667 Cleaning 🧹 2021-02-12 22:55:26 +01:00
Laurenz 06ca740d01 Split evaluation and execution 🔪 2021-02-09 19:46:57 +01:00