Commit Graph

795 Commits

Author SHA1 Message Date
Laurenz 6d26e15fbe Support `else if` 2021-09-30 19:07:06 +02:00
Laurenz 9e95502622 No hashtag before else anymore 2021-09-30 18:28:25 +02:00
Laurenz 989d344d3d Implement `Display` for `Tracepoint` 2021-09-29 00:10:39 +02:00
Laurenz a0065eef86 Make file system loader serializable 2021-09-29 00:10:21 +02:00
Laurenz 0e89facb53 Allow linear values for text edges 2021-09-28 10:53:54 +02:00
Laurenz f1ab290572 Refactor line reordering from callback to iterator 2021-09-27 22:45:29 +02:00
Laurenz ed0c804017 Add spacing capabilities to stack function
- Named argument `spacing` controls spacing between any two template arguments
- Arbitrary linears in the list can produce arbitrary spacing
2021-09-27 22:23:26 +02:00
Laurenz e10b3d838a Fix panic due to bad alignments in stack function 2021-09-27 13:45:18 +02:00
Laurenz ff37a2893d More useful incremental checks
Co-Authored-By: Martin <mhaug@live.de>
2021-09-27 11:40:28 +02:00
Laurenz 1982a0639e Expand all but last region for broken up auto rows 2021-09-27 11:39:31 +02:00
Laurenz 6c478face4 Fix paragraph constraints
Co-Authored-By: Martin <mhaug@live.de>
2021-09-27 11:38:18 +02:00
Laurenz 19e17cc6ac Simplify decoration handling 2021-09-26 12:43:45 +02:00
Laurenz a493b9533a More useful `Debug` impls 2021-09-26 12:24:24 +02:00
Laurenz 72eb243e26 Simplify source file loading logic 2021-09-25 23:44:33 +02:00
Laurenz 5594868f8b Prevent paragraph from overflowing due to trailing linebreak 2021-09-25 23:35:27 +02:00
Laurenz ea921aca5d Blocks directly in template also scope 2021-09-15 13:12:07 +02:00
Laurenz 5de791d9e6 Rename `SyntaxTree` to `Markup`
Also `SyntaxNode` -> `MarkupNode`.
2021-09-15 13:05:01 +02:00
Laurenz c18321a4c2 Bugfix and tidying 2021-09-15 13:05:00 +02:00
Laurenz 87e776fceb Add `BoolExt` trait with `flip` method 2021-09-14 12:27:21 +02:00
Laurenz 18190f377a Reimplement `Debug` for layout nodes 2021-09-10 15:10:35 +02:00
Laurenz b0b4607725 Set the correct base for grid cells 2021-09-10 15:10:34 +02:00
Laurenz 50a464488c Fix fr rows in infinite region 2021-09-10 15:10:34 +02:00
Laurenz f592662aa0 Rename `Arguments` to `Args` 2021-09-10 12:27:33 +02:00
Laurenz d2618acd8d Bump pdf-writer 2021-09-09 12:16:55 +02:00
Laurenz 7f48e8fe66 Make user-facing "debug" representation use Debug instead of Display 2021-08-31 16:25:12 +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
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 17ea0d4ba9 Make font fallback disableable 2021-08-27 14:08:31 +02:00
Laurenz 7eeafbd464 Font family things
- Better default font family order
- Remove weird leading dots from font family names
- Public API for retrieving all found font families
2021-08-27 14:08:31 +02:00
Laurenz 0001a965d7 Parse command line arguments with pico-args 2021-08-27 14:08:17 +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 0dd4ae0a7a Prune derives 2021-08-21 17:30:21 +02:00
Laurenz f38eb10c2b Make better use of existing variables in grid 2021-08-21 15:28:44 +02:00
Laurenz f71c38b38d Turn backlog into iterator 2021-08-21 15:28:26 +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
Martin fdab7158c9
Pattern properties (#42)
Included in this package are:
* Code review I: The unnamed review.
* Code Review II: How I met your review.
* Code Review III: Code, the final frontier. These are the voyages of the USS Review ...
2021-08-19 15:07:11 +02:00
Martin c44ecbfbd2
Move to exclusively oneshot benchmarks with Iai fork (#41) 2021-08-18 18:12:26 +02:00
Laurenz 011865ab5c Memory loader 2021-08-18 14:25:49 +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 c53d98a22f More logical ordering and naming 2021-08-17 12:49:48 +02:00
Laurenz 9a798ce6f6 Make percentages for h and v relative to area instead of font size 2021-08-17 00:17:28 +02:00
Laurenz 9462fb17b3 Convert single-field structs to tuple structs 2021-08-16 19:15:03 +02:00
Laurenz cb0aab3cfa Change how functions are called 2021-08-16 18:14:58 +02:00
Laurenz ba6b91e2ee Editable source files 2021-08-16 14:40:02 +02:00
Laurenz 7e6e7e928c Adjust macros to new version 2021-08-14 23:53:57 +02:00
Laurenz 6ae6d86b9c Separate type for string values 2021-08-14 15:55:39 +02:00
Laurenz fcb4e45118 Fix bug on unix again 2021-08-13 19:37:51 +02:00
Laurenz f6814b7732 Optimize memory sizes 2021-08-13 18:17:24 +02:00
Laurenz 6a3385e4e7 Argument collection and spreading 2021-08-13 16:55:45 +02:00
Laurenz 144f208821 Add file information to spans 2021-08-13 14:33:58 +02:00
Laurenz d002cdf451 Named arguments for user defined functions 2021-08-12 16:07:42 +02:00
Laurenz ccb4be4da4 Make range-end exclusive 2021-08-12 14:54:52 +02:00
Laurenz eaa3cbaa9c Array and dictionary indexing 2021-08-12 13:56:23 +02:00
Laurenz 8207c31aec Minor refactorings
- Reorder parser methods and use `Pos` everywhere
- Remove tab special handling for columns and adapt heading/list/enum indent handling
- Don't panic when a file has an empty path
2021-08-10 11:28:12 +02:00
Laurenz 3932bb2cb9 New source loading architecture 2021-08-09 11:26:41 +02:00
Laurenz 3c92bad9a7 Pretty-printed diagnostics with traceback 2021-08-01 00:00:36 +02:00
Laurenz fbd3d19113 Call args span now includes parens 2021-07-31 22:41:06 +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 42a27b48df Change derive order 2021-07-29 22:27:10 +02:00
Laurenz 2c6127dea6 Refactor state 2021-07-29 13:28:19 +02:00
Laurenz 7d15dc634b Move font family and refactor alignment 2021-07-29 12:28:54 +02:00
Laurenz 853361338b Better addition and iteration for array, dict and template 2021-07-29 12:01:06 +02:00
Laurenz 312dcd070c Move EcoString and OptionExt into util 2021-07-29 11:35:49 +02:00
Laurenz 6ebe621834 Use last instead of next_back 2021-07-27 18:53:09 +02:00
Laurenz 39a561f2bb Slightly more expressive method name 2021-07-26 00:29:41 +02:00
Laurenz 7aa3d2c2d6 No more excessive region cloning 2021-07-26 00:29:37 +02:00
Laurenz 56cbf96fe2 Move incremental test into separate function 2021-07-26 00:08:08 +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 dcfbf95220 Fix comment 2021-07-25 01:03:38 +02:00
Laurenz adb71ee040 Move and refactor 2021-07-25 01:03:38 +02:00
Laurenz 927f1154fa More efficient function representation 2021-07-21 16:55:32 +02:00
Laurenz 929f4d64fe Switch Loader from Option to io::Result 2021-07-21 12:27:40 +02:00
Laurenz b0e5212973 Fs builder methods + tidy up 2021-07-21 11:28:33 +02:00
Laurenz 9488b1b850 Main context struct 2021-07-21 11:28:29 +02:00
Laurenz 8000783f95 FileId instead of Path + FileHash 2021-07-20 18:35:05 +02:00
Laurenz 5edbd3a5b5 Use array's IntoIterator impl and nested or patterns
*yay*
2021-07-16 12:07:15 +02:00
Laurenz 81f2f8f4c3 Optimize scanner and tokenizer 2021-07-13 15:24:26 +02:00
Laurenz 9fe9b95b7f Simpler casting 2021-07-11 13:20:53 +02:00
Laurenz 891e0c5fa6 Remove warnings from parsing and casting 2021-07-10 23:14:46 +02:00
Laurenz 982ce85976 Move comparisons into standard traits 2021-07-10 23:10:35 +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 4fb58acafd Fix bound 2021-07-09 10:27:45 +02:00
Laurenz 0c74290519 Compare functions and templates by identity 2021-07-08 23:36:20 +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 551e3af9d0 Replace using with from 2021-07-08 21:16:16 +02:00
Laurenz 5c327e249e Switch to = for headings once again 2021-07-08 20:03:13 +02:00
Laurenz f85e5aac64 URL special case for line comments 2021-07-08 19:37:38 +02:00
Laurenz 5a500fb8a7 Range operator 2021-07-08 19:12:07 +02:00
Laurenz c5635d8a3f Handle missing arguments to with expr 2021-07-08 18:56:52 +02:00
Laurenz 44d8028b49 Allow wide calls only directly in templates 2021-06-30 22:49:11 +02:00
Laurenz 17e8946884
Remove color literals (#39) 2021-06-30 22:32:24 +02:00
Laurenz 911b581834 Optimize scanner performance 2021-06-30 16:43:11 +02:00
Laurenz 65c0c5607e Make clippy a bit happier 2021-06-30 11:48:51 +02:00
Laurenz 470f8001a1 No more collisions between syntax::Tree and layout::Tree 2021-06-30 11:40:27 +02:00
Laurenz 45812b7001
Merge pull request #35 from typst/wide-calls
Wide calls
2021-06-30 11:04:53 +02:00
Laurenz 1c43d8af12 Bump dependencies 2021-06-30 00:52:50 +02:00
Laurenz 32a6b673bc Make use of wide calls 2021-06-29 13:49:50 +02:00
Laurenz b89cd128ae Wide calls 2021-06-29 13:49:50 +02:00
Martin Haug 21d919e2d2 Put incremental compilation behind feature 2021-06-29 12:33:24 +02:00
Laurenz 6d0911d7a8 Mutable visitor 2021-06-29 10:54:34 +02:00
Laurenz 8ea05739af Make values smaller
Reduced from 48 bytes to 32 bytes on 64-bit architectures.
2021-06-28 21:57:18 +02:00
Martin Haug e9960b8942 Code review: Reverse temperature 2021-06-27 18:58:31 +02:00
Martin 6f518c1728 Adjust comments
Co-authored-by: Laurenz <laurmaedje@gmail.com>

Update tests/typ/layout/stack.typ

Co-authored-by: Laurenz <laurmaedje@gmail.com>
2021-06-27 18:58:28 +02:00
Martin Haug 9bd8b7ddac Code review, new stack test 2021-06-27 18:06:39 +02:00
Martin 57bd3e23c7
Apply suggestions from code review
Co-authored-by: Laurenz <laurmaedje@gmail.com>
2021-06-27 17:08:40 +02:00
Martin Haug 6b6cdae7ce Testing for incremental
Also, constraint bugfixes.
2021-06-27 12:31:27 +02:00
Laurenz f64c772b6d Fix capturing bug 2021-06-27 12:05:36 +02:00
Laurenz 422b8e640f With expressions 2021-06-26 18:07:05 +02:00
Laurenz d53c933e4d Add box and block functions 2021-06-26 15:47:37 +02:00
Laurenz 784018124d Remove unused template name field 2021-06-26 15:35: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 62ecd31af2 Streamline template evaluation 2021-06-18 13:08:39 +02:00
Martin 80a9b300d1 Ref count the frames 2021-06-18 13:01:55 +02:00
Martin 7db78d83be Levels 2021-06-18 13:00:36 +02:00
Laurenz 2a30c20f0e Flip outdated expression names 2021-06-18 12:47:59 +02:00
Laurenz bca035172c Join semantics 2021-06-18 11:59:05 +02:00
Laurenz 8b6391040e Remove eat_ prefix 2021-06-18 11:58:43 +02:00
Laurenz 6967c6c80a Len function for strings, arrays and dictionaries 2021-06-18 10:50:08 +02:00
Laurenz 2e87808cdd Setter method 2021-06-17 14:32:24 +02:00
Martin e14e804789
Constraints (#31) 2021-06-17 14:18:43 +02:00
Laurenz e2cdda67dc Refactor grid row layout 2021-06-15 16:34:41 +02:00
Laurenz a61ee46ed2 Refactor column resolving 2021-06-13 00:22:39 +02:00
Laurenz 4c37ebb936 Give up on not implementing Eq and Ord 2021-06-12 18:24:31 +02:00
Martin fec1f41106
Allow grid cells to span multiple regions. (#30) 2021-06-12 18:19:18 +02:00
Laurenz 4017b5a9f6 Push some nodes directly into the stack 2021-06-11 14:42:20 +02:00
Laurenz 4dbd9285c9 Basic enums 2021-06-11 14:00:06 +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 bce553a991 Tidy up 2021-06-09 22:44:40 +02:00
Martin Haug 29cfef0a6d Add a grid layouter 2021-06-09 22:44:40 +02:00