Commit a7f5553
committed
add C++ parser for the font shorthand
This is the first part needed for the new font stack, which will
look like the FontFace-based API the browsers have. FontFace uses
a parser for font-family, font-size, etc., so I will need deeper
control over the parser.
FontFace will be implemented in C++ and I didn't want to carry
over the awkward (and slow) switching between JS and C++. So here
it is. I used Claude to generate initial classes and busy work,
but it's been heavily examined and heavily modified.
Caching aside, this is 3x faster in the benchmarks, which use
random names to bypass the cache, and still a full 2x as fast when
the JS version has a cached value. Those results were a bit
inconsistent, so I'm not sure how much I trust them, but I expect
this parser to have a stable performance profile nonetheless, so
I'm not going to add any caching.
It's also far more correct than what we had!1 parent a53ae0f commit a7f5553
File tree
12 files changed
+1130
-210
lines changed- lib
- src
- test
12 files changed
+1130
-210
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| |||
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
76 | | - | |
77 | 74 | | |
78 | 75 | | |
79 | 76 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
694 | 696 | | |
695 | 697 | | |
696 | 698 | | |
| 699 | + | |
697 | 700 | | |
698 | 701 | | |
699 | 702 | | |
| |||
749 | 752 | | |
750 | 753 | | |
751 | 754 | | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
752 | 789 | | |
753 | 790 | | |
754 | 791 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
2575 | 2576 | | |
2576 | 2577 | | |
2577 | 2578 | | |
2578 | | - | |
2579 | | - | |
2580 | 2579 | | |
2581 | 2580 | | |
2582 | | - | |
2583 | | - | |
2584 | | - | |
| 2581 | + | |
| 2582 | + | |
2585 | 2583 | | |
2586 | | - | |
2587 | | - | |
2588 | | - | |
2589 | | - | |
2590 | | - | |
2591 | | - | |
2592 | | - | |
2593 | | - | |
2594 | | - | |
2595 | | - | |
2596 | | - | |
2597 | | - | |
2598 | | - | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
2599 | 2587 | | |
2600 | 2588 | | |
2601 | 2589 | | |
2602 | 2590 | | |
2603 | | - | |
2604 | | - | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
2605 | 2595 | | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
2606 | 2602 | | |
2607 | 2603 | | |
2608 | 2604 | | |
| |||
2617 | 2613 | | |
2618 | 2614 | | |
2619 | 2615 | | |
2620 | | - | |
| 2616 | + | |
2621 | 2617 | | |
2622 | 2618 | | |
2623 | 2619 | | |
2624 | 2620 | | |
2625 | | - | |
| 2621 | + | |
2626 | 2622 | | |
2627 | 2623 | | |
2628 | 2624 | | |
| |||
0 commit comments