179 Commits

Author SHA1 Message Date
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
d1ecb7e52e Add move function 2021-10-28 16:51:57 +02:00
Laurenz
5c534fb428 Simplify node construction 2021-10-26 17:14:11 +02:00
Laurenz
fb0cd3df6e Fr in stack and par 2021-10-26 14:56:10 +02:00
Laurenz
3968181622 Replace .. syntax with range function 2021-10-25 13:38:32 +02:00
Laurenz
1e74f7c407 New ShapeNode
Replaces `BackgroundNode` and `FixedNode`
2021-10-23 20:22:47 +02:00
Laurenz
9ac125dea8 Rename State to Style and move it into its own module 2021-10-10 21:04:10 +02:00
Laurenz
d4cc8c775d Move paint and colors into geom 2021-10-10 20:26:58 +02:00
Laurenz
3d0dcbea18 Error on out-of-range values in rgb 2021-10-05 19:55:15 +02:00
Laurenz
0a23bfbc23 Add assert function 2021-10-05 19:37:38 +02:00
Laurenz
0e89facb53 Allow linear values for text edges 2021-09-28 10:53:54 +02:00
Laurenz
f592662aa0 Rename Arguments to Args 2021-09-10 12:27:33 +02:00
Laurenz
3481d8cc81 More utility functions
- join("a", "b", "c", sep: ", ")
- int("12")
- float("31.4e-1")
- str(10)
- sorted((3, 2, 1))
2021-08-31 12:59:53 +02:00
Laurenz
ee84bf7408 Add abs() function 2021-08-30 16:59:09 +02:00
Laurenz
ff25573224 Lower- and uppercase string conversion functions 2021-08-30 16:39:16 +02:00
Laurenz
e4e79990da Allow body for font function once again 2021-08-29 15:09:54 +02:00
Martin
d546453880
Links! (#43)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
2021-08-23 23:56:33 +02:00
Laurenz
a6f260ca39 Refactor layouting a bit
Notably:
- Handle aspect ratio in fixed node
- Inline constraint inflation into pad node
2021-08-19 15:52:15 +02:00
Laurenz
594809e35b Library functions behave more imperatively
- Templates scope state changes
- State-modifying function operate in place instead of returning a template
- Internal template representation contains actual owned nodes instead of a pointer to a syntax tree + an expression map
- No more wide calls
2021-08-17 22:20:37 +02:00
Laurenz
6ae6d86b9c Separate type for string values 2021-08-14 15:55:39 +02:00
Laurenz
1ee1d078e2 Fatal errors
- Makes errors fatal, so that a phase is only reached when all previous phases were error-free
- Parsing still recovers and can produce multiple errors
- Evaluation fails fast and can thus produce only a single error (except for parse errors due to an import)
- The single error that could occur during execution is removed for now
- Removes Value::Error variant
2021-07-30 18:49:19 +02:00
Laurenz
7d15dc634b Move font family and refactor alignment 2021-07-29 12:28:54 +02:00
Laurenz
312dcd070c Move EcoString and OptionExt into util 2021-07-29 11:35:49 +02:00
Laurenz
9fe9b95b7f Simpler casting 2021-07-11 13:20:53 +02:00
Laurenz
6a4823461f Reference-count complex values
Rename some nodes types
2021-07-10 23:10:17 +02:00
Laurenz
36b3067c19 Eco string 🌱 2021-07-10 13:07:39 +02:00
Laurenz
fd0b89a1d8 Rename Fill to Paint 2021-07-08 22:33:44 +02:00
Laurenz
d53c933e4d Add box and block functions 2021-06-26 15:47:37 +02:00
Laurenz
285c2f617b Cleanse library
- Remove doc-comments for Typst functions from library
- Reduce number of library source files
2021-06-26 13:06:37 +02:00
Laurenz
63cf361496 Make font take everything as keyword arguments 2021-06-25 18:14:19 +02:00
Laurenz
6967c6c80a Len function for strings, arrays and dictionaries 2021-06-18 10:50:08 +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
Martin Haug
29cfef0a6d Add a grid layouter 2021-06-09 22:44:40 +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
Laurenz
14f093bfee A few predefined colors for testing 2021-05-23 22:59:25 +02:00
Laurenz
cd25b40281 Stack function 2021-05-23 22:36:34 +02:00
Laurenz
7025590405 Rename _new to new and typify to value 2021-05-18 16:53:11 +02:00
Laurenz
72434f0695 Min and max functions 2021-05-18 16:31:22 +02:00
Laurenz
6292d25afb Reengineer font and resource loading 🏞 2021-04-23 17:46:14 +02:00
Laurenz
9c040a9d2b Move around test cases 🚚 2021-03-29 14:51:54 +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
Laurenz
39f55481ed More consistent documentation 📝 2021-03-22 10:48:29 +01:00
Laurenz
5e08028fb3 Syntax functions 🚀
This adds overridable functions that markup desugars into. Specifically:
- \ desugars into linebreak
- Two newlines desugar into parbreak
- * desugars into strong
- _ desugars into emph
- = .. desugars into heading
- `..` desugars into raw
2021-03-21 17:50:56 +01:00
Laurenz
898728f260 Square, circle and ellipse 🔵 2021-03-20 20:19:30 +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
ca3df70e2a Add basic paragraph function 📑
Allows to change:
- (paragraph) spacing
- leading
- word-spacing
2021-03-19 13:32:12 +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