Compare commits
1241
Commits
1da46c61d6
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f78aff25c5 | ||
|
|
473b3beace | ||
|
|
bf42a88dff | ||
|
|
0b4aa49a71 | ||
|
|
ac5f691a48 | ||
|
|
5b86a7ac7e | ||
|
|
5b9eca1d60 | ||
|
|
aed7010cba | ||
|
|
b081c951af | ||
|
|
c008c52964 | ||
|
|
57c05d9635 | ||
|
|
41a459b4ca | ||
|
|
6acd82dbfa | ||
|
|
465a574124 | ||
|
|
9a6c162b46 | ||
|
|
c42a1a72aa | ||
|
|
1cf985469c | ||
|
|
a5dba52acb | ||
|
|
fe86163767 | ||
|
|
8b6dab8d52 | ||
|
|
29193c03bc | ||
|
|
9841e88900 | ||
|
|
fb557c09c6 | ||
|
|
7f51f01bd4 | ||
|
|
29aa6dc0a9 | ||
|
|
6d0b2faceb | ||
|
|
8bb47a5ead | ||
|
|
51db480b34 | ||
|
|
d249ec7eba | ||
|
|
330c4bde51 | ||
|
|
ecb0f60960 | ||
|
|
893b46baae | ||
|
|
050ff5bde2 | ||
|
|
4162c88826 | ||
|
|
061e484001 | ||
|
|
ffd84cd15b | ||
|
|
a8dfa14b7e | ||
|
|
57ce7116ad | ||
|
|
0117449023 | ||
|
|
f387b1db61 | ||
|
|
d8af3518a7 | ||
|
|
9f4cc64c8f | ||
|
|
a1585339b9 | ||
|
|
84ad682939 | ||
|
|
fb5cb5ada9 | ||
|
|
9c93ff9750 | ||
|
|
b37856eeb0 | ||
|
|
48d42052b8 | ||
|
|
4791c42403 | ||
|
|
c23dabb449 | ||
|
|
79bfee5ab1 | ||
|
|
f09bb04a32 | ||
|
|
d6e66cad12 | ||
|
|
9efededf6d | ||
|
|
9da75c82f5 | ||
|
|
52db77885d | ||
|
|
e9893a5c1b | ||
|
|
745c33fd44 | ||
|
|
91bb864d8c | ||
|
|
e3be6dcd09 | ||
|
|
6a47d450f3 | ||
|
|
93d3d38983 | ||
|
|
c6b5c9ed56 | ||
|
|
373204a8d8 | ||
|
|
8aa079ec25 | ||
|
|
90f174283e | ||
|
|
cb6525ffca | ||
|
|
74eb1e9fc4 | ||
|
|
d6ab5a025f | ||
|
|
c09d545da6 | ||
|
|
11c8ad1eaa | ||
|
|
6939ff71ff | ||
|
|
e7ab132520 | ||
|
|
ff52a9f66b | ||
|
|
bbeeca0317 | ||
|
|
7d460e0fa1 | ||
|
|
af6466cd98 | ||
|
|
dcc6a3984c | ||
|
|
d627614af8 | ||
|
|
d875b69280 | ||
|
|
5ad5c40002 | ||
|
|
c0e2346b05 | ||
|
|
009fde04f7 | ||
|
|
e20acc3eb9 | ||
|
|
e14361fec6 | ||
|
|
c02f678bf7 | ||
|
|
d9143ddbd1 | ||
|
|
7707cd9b09 | ||
|
|
2fa11fb971 | ||
|
|
4fb0f2c89b | ||
|
|
de4bd1fa76 | ||
|
|
975dbc8060 | ||
|
|
cb8ed90df2 | ||
|
|
0e71c15b01 | ||
|
|
ba548ef05d | ||
|
|
2007ac5627 | ||
|
|
c094d9a81d | ||
|
|
09cd19594c | ||
|
|
d4e78bc29a | ||
|
|
115e1f0fe0 | ||
|
|
b472f66d04 | ||
|
|
11fd66713b | ||
|
|
e72104eab3 | ||
|
|
01c6f1d4bd | ||
|
|
4ae4275cf3 | ||
|
|
a864c6c5ca | ||
|
|
509f229a52 | ||
|
|
3bb2330676 | ||
|
|
d9edc6c6e7 | ||
|
|
34325317d2 | ||
|
|
69efe0b895 | ||
|
|
da48cf9cad | ||
|
|
ca3730338e | ||
|
|
526ec9b3b0 | ||
|
|
ab6b1093ec | ||
|
|
2846f7f1e7 | ||
|
|
aae23d837e | ||
|
|
b22e127e93 | ||
|
|
885911485e | ||
|
|
e2af618e65 | ||
|
|
23ec506fa3 | ||
|
|
82e54894c4 | ||
|
|
84d6f3ae51 | ||
|
|
b640b26eff | ||
|
|
c0970bdbf6 | ||
|
|
60d67bbb7b | ||
|
|
868814288c | ||
|
|
fd5ab59f42 | ||
|
|
46ef76f890 | ||
|
|
aa780a800b | ||
|
|
65204a7dae | ||
|
|
1ad9c4db82 | ||
|
|
c2e1e64a60 | ||
|
|
6a118d3b60 | ||
|
|
c1c3c25b3f | ||
|
|
861c9dbfc9 | ||
|
|
5a2df6781a | ||
|
|
0f10163b5b | ||
|
|
8cd0263b97 | ||
|
|
f14669ae39 | ||
|
|
af19a26c23 | ||
|
|
e95d1264da | ||
|
|
70ebacb056 | ||
|
|
d87464fde3 | ||
|
|
342bedf9b4 | ||
|
|
51451813dc | ||
|
|
d12c4b034b | ||
|
|
57a7097857 | ||
|
|
c2d3312e5a | ||
|
|
7ff988031f | ||
|
|
d944552188 | ||
|
|
9da2ee41cd | ||
|
|
c2f18f50dc | ||
|
|
1307bbcf0c | ||
|
|
140bb19849 | ||
|
|
520e8eede2 | ||
|
|
e10e0cce53 | ||
|
|
58012d9397 | ||
|
|
4c532f9396 | ||
|
|
1fe0ac9dd5 | ||
|
|
de481fd762 | ||
|
|
38c567623a | ||
|
|
5edd4ae4ec | ||
|
|
a90d53c992 | ||
|
|
f88a16d101 | ||
|
|
0f6aa1f33d | ||
|
|
02d4c3116a | ||
|
|
9e13cca481 | ||
|
|
9ae7c6a6df | ||
|
|
bd840df538 | ||
|
|
eb0afccc03 | ||
|
|
76df2d6832 | ||
|
|
048478c346 | ||
|
|
4e16531a62 | ||
|
|
fc6d704edf | ||
|
|
b88283f493 | ||
|
|
a0922d0105 | ||
|
|
5a4271364a | ||
|
|
45ea5d4297 | ||
|
|
330ecdd03c | ||
|
|
cc0246016d | ||
|
|
4a77540e46 | ||
|
|
7e5428ec35 | ||
|
|
97319d751b | ||
|
|
c52ad71bad | ||
|
|
3e9a639f1d | ||
|
|
fa27e0985f | ||
|
|
2b82172bfb | ||
|
|
c97e0e7279 | ||
|
|
20986b2fd5 | ||
|
|
515dbe6181 | ||
|
|
8be7867b37 | ||
|
|
cc147e93d8 | ||
|
|
dd695a8945 | ||
|
|
6826efbeb1 | ||
|
|
5df90f113c | ||
|
|
d11ac0cba1 | ||
|
|
22e3ba993d | ||
|
|
a93d1bb902 | ||
|
|
767c8ffced | ||
|
|
a31de14eb2 | ||
|
|
821631778e | ||
|
|
01b3931ae0 | ||
|
|
dba73f1f47 | ||
|
|
7070cc6b82 | ||
|
|
01ef302fb0 | ||
|
|
2bd6e19519 | ||
|
|
794c2f9b2c | ||
|
|
facecbf790 | ||
|
|
c548ca8e9f | ||
|
|
752af43f32 | ||
|
|
651fab42f1 | ||
|
|
d17680fcd8 | ||
|
|
ce8a780031 | ||
|
|
05e633bb14 | ||
|
|
b681f9791a | ||
|
|
70822cbd94 | ||
|
|
3caf1eced2 | ||
|
|
28dfba5a5e | ||
|
|
9527d3bbec | ||
|
|
45b79fc5a5 | ||
|
|
614f09aa9b | ||
|
|
b008c0693a | ||
|
|
9b80a782cf | ||
|
|
2d036b807e | ||
|
|
1e4c113b27 | ||
|
|
91b3e6a8fe | ||
|
|
12d9eb6a54 | ||
|
|
4ad66c120d | ||
|
|
584b708487 | ||
|
|
4bd7f1e08e | ||
|
|
3ff339341b | ||
|
|
75d3667397 | ||
|
|
d02777a1fc | ||
|
|
3ed2c2cd54 | ||
|
|
1822ab2d32 | ||
|
|
f66a5a7e20 | ||
|
|
6675ab639a | ||
|
|
6ebcb75794 | ||
|
|
003d5d8726 | ||
|
|
22154b53a6 | ||
|
|
58bcfca7b7 | ||
|
|
e113033b8a | ||
|
|
6d2a4921cf | ||
|
|
413939911f | ||
|
|
555a029505 | ||
|
|
297431a547 | ||
|
|
c6701204ec | ||
|
|
278b1f35e2 | ||
|
|
d1ddf4bfeb | ||
|
|
a6ba70aa46 | ||
|
|
514a2d3344 | ||
|
|
b93d5f55da | ||
|
|
b647bd8dcd | ||
|
|
60d7411dfe | ||
|
|
7f74251c8a | ||
|
|
d46d6d79a8 | ||
|
|
432c1d2ba7 | ||
|
|
13ab32247d | ||
|
|
862801ee5f | ||
|
|
307303d596 | ||
|
|
5c2ba9fad0 | ||
|
|
a958954308 | ||
|
|
4f4a4567ea | ||
|
|
2bced813a2 | ||
|
|
6d54af5350 | ||
|
|
ebbc9e2c17 | ||
|
|
1dd745afcb | ||
|
|
4777d66fc8 | ||
|
|
361e8d070f | ||
|
|
6e573dc1ce | ||
|
|
091458d329 | ||
|
|
4eeb5686b8 | ||
|
|
ca60c66a17 | ||
|
|
600160f624 | ||
|
|
e4a265ca6c | ||
|
|
3a3913a385 | ||
|
|
0a21eb27a7 | ||
|
|
225736ce80 | ||
|
|
4575150f92 | ||
|
|
592d1ef2a3 | ||
|
|
0ff8597ab4 | ||
|
|
ae59cc1cc1 | ||
|
|
1038fcf709 | ||
|
|
ae6ddb47d0 | ||
|
|
a1ed9498bc | ||
|
|
1ba46a9f61 | ||
|
|
287d4a7cf0 | ||
|
|
e77b15d8bd | ||
|
|
da277611e8 | ||
|
|
45455c4cc0 | ||
|
|
6438c3475d | ||
|
|
50bd410574 | ||
|
|
24ea6ef7ee | ||
|
|
1c02d8af25 | ||
|
|
7e67494863 | ||
|
|
10a08c4597 | ||
|
|
959dd4f24a | ||
|
|
37ae9b5e9e | ||
|
|
2368db1d71 | ||
|
|
11063c65dd | ||
|
|
ee22f25ee0 | ||
|
|
901a50c36c | ||
|
|
48c980c871 | ||
|
|
3ffa452fd1 | ||
|
|
3faac740bd | ||
|
|
ab50ca7dad | ||
|
|
41af3d8d22 | ||
|
|
f6c493e462 | ||
|
|
b5e87a8706 | ||
|
|
eda01fb689 | ||
|
|
75d156f0cf | ||
|
|
d587405d2e | ||
|
|
393fba42d8 | ||
|
|
fc6786d9f4 | ||
|
|
8d3a2f8f27 | ||
|
|
28668ea10f | ||
|
|
38e4822370 | ||
|
|
5163fc9854 | ||
|
|
062a2b9f60 | ||
|
|
366c381310 | ||
|
|
9ce878efd4 | ||
|
|
5aa7dc7331 | ||
|
|
72ed779749 | ||
|
|
3706afa483 | ||
|
|
d2d9f3d37f | ||
|
|
c79d44f99f | ||
|
|
a83b6b8404 | ||
|
|
026bb15d9b | ||
|
|
649a2f4d6f | ||
|
|
ba634496fe | ||
|
|
67eba7b407 | ||
|
|
43231a48c0 | ||
|
|
69de8a6599 | ||
|
|
742afb7d9c | ||
|
|
06463399bb | ||
|
|
bb1a166c4c | ||
|
|
0abf700817 | ||
|
|
31364ae33e | ||
|
|
60aec30595 | ||
|
|
f4b003bd27 | ||
|
|
a53d9c9bf9 | ||
|
|
b6567f67e2 | ||
|
|
d8e3b06426 | ||
|
|
2741546ca8 | ||
|
|
91f9d76b16 | ||
|
|
e1ae10f2ce | ||
|
|
bf4e758fba | ||
|
|
e34558efb8 | ||
|
|
96b40c1c2e | ||
|
|
a9f3cab8dc | ||
|
|
828b9716a1 | ||
|
|
a89277fe1a | ||
|
|
7cd221e7a9 | ||
|
|
59308eb01a | ||
|
|
eabebfa687 | ||
|
|
13b85b542a | ||
|
|
16a795bca2 | ||
|
|
2c81e7cb44 | ||
|
|
9efd2b61be | ||
|
|
01b3f518cb | ||
|
|
8fef7df187 | ||
|
|
c6743e2f9e | ||
|
|
fe0784cdc6 | ||
|
|
d28e21e3d4 | ||
|
|
e262bc0091 | ||
|
|
d3175bcd1c | ||
|
|
4ae362e4dd | ||
|
|
049365d595 | ||
|
|
43f8c979cf | ||
|
|
ba61faf142 | ||
|
|
b7a8637835 | ||
|
|
b8573a2e70 | ||
|
|
f39733a283 | ||
|
|
d4c16b69b4 | ||
|
|
905b63d1ef | ||
|
|
1959b18f82 | ||
|
|
c4392e72a3 | ||
|
|
730b04bce5 | ||
|
|
c742e21a81 | ||
|
|
35015853b4 | ||
|
|
af20ce8dc9 | ||
|
|
e41492b2a0 | ||
|
|
0f23eb4a83 | ||
|
|
423b202c54 | ||
|
|
764436fc71 | ||
|
|
53bf50b0e9 | ||
|
|
b169216275 | ||
|
|
676eb7f323 | ||
|
|
02742d201f | ||
|
|
68ec9941dc | ||
|
|
8f231d5752 | ||
|
|
1b0f4c8ab3 | ||
|
|
eb2cb561bd | ||
|
|
d5de8b9fe6 | ||
|
|
742986e4dd | ||
|
|
802526c352 | ||
|
|
764bc18850 | ||
|
|
9181bf49fe | ||
|
|
0562b13be8 | ||
|
|
3780aef88c | ||
|
|
8b742dacb3 | ||
|
|
37b956c0a6 | ||
|
|
fd9ee0740b | ||
|
|
e9bbd4bd87 | ||
|
|
2ef5e29329 | ||
|
|
fc328a56c6 | ||
|
|
13d0dd2fb7 | ||
|
|
192788ec4b | ||
|
|
576626fe04 | ||
|
|
aa2f3cb0af | ||
|
|
bbedf7676c | ||
|
|
d00402a745 | ||
|
|
16dd2e1f62 | ||
|
|
c2310d85ac | ||
|
|
d2f0fe97c5 | ||
|
|
c5bf150449 | ||
|
|
5c281d70cc | ||
|
|
a084845184 | ||
|
|
ca806341a8 | ||
|
|
6b89ab1dd7 | ||
|
|
7528ea26e2 | ||
|
|
da30705cd0 | ||
|
|
d124c646a1 | ||
|
|
9231c3a7d6 | ||
|
|
86e95881e7 | ||
|
|
e2e80e8728 | ||
|
|
30f1df03ca | ||
|
|
7407d4ed42 | ||
|
|
b1e3e03f00 | ||
|
|
fab26234fc | ||
|
|
254fd4a9a1 | ||
|
|
8d70868781 | ||
|
|
21943410e9 | ||
|
|
1058122388 | ||
|
|
c49afbdecb | ||
|
|
a50023691b | ||
|
|
263fa36fb5 | ||
|
|
c14c374d5d | ||
|
|
c89f972a25 | ||
|
|
7975671882 | ||
|
|
0075352832 | ||
|
|
dff0483bca | ||
|
|
f71a12573e | ||
|
|
59ba5ac247 | ||
|
|
58c35c85b9 | ||
|
|
a451df620c | ||
|
|
25c7659afe | ||
|
|
e53ce3b601 | ||
|
|
82c3e24d18 | ||
|
|
f5ddad30a2 | ||
|
|
c3aa4e9dad | ||
|
|
3b28ea6693 | ||
|
|
a5871774ec | ||
|
|
4d713df3dd | ||
|
|
8a5411af1d | ||
|
|
1d1009395b | ||
|
|
4068366190 | ||
|
|
8307fc8918 | ||
|
|
3df130a6b3 | ||
|
|
0e386f8fdc | ||
|
|
4ad15f1f0b | ||
|
|
abf5e90578 | ||
|
|
e8f7e37cf7 | ||
|
|
7fbcb326d5 | ||
|
|
dc9428e87e | ||
|
|
1227d82f02 | ||
|
|
5dda1a948a | ||
|
|
48e86fb214 | ||
|
|
1e4eb2d5ab | ||
|
|
9da0f136a4 | ||
|
|
ae810867f7 | ||
|
|
22d5332658 | ||
|
|
9f642a2bbd | ||
|
|
85d5c87b12 | ||
|
|
f05723808c | ||
|
|
d3baa78e1e | ||
|
|
723b9e220f | ||
|
|
0a4bc0ade5 | ||
|
|
c25c38f16a | ||
|
|
0728d78b29 | ||
|
|
c399481c6a | ||
|
|
6139621653 | ||
|
|
ebb178bff5 | ||
|
|
5fbcc34ddd | ||
|
|
6c6963cac7 | ||
|
|
53a299bd58 | ||
|
|
c3ae52452d | ||
|
|
c3e02f0586 | ||
|
|
16b61cd368 | ||
|
|
4024fa7435 | ||
|
|
8bdeffa646 | ||
|
|
28aed153fe | ||
|
|
88a03ec1a1 | ||
|
|
b3fbbc8dda | ||
|
|
65a132d7b1 | ||
|
|
93ecf76ea3 | ||
|
|
7a9e28d0f4 | ||
|
|
05e1bd096b | ||
|
|
d791e3a0f2 | ||
|
|
47dcdfec47 | ||
|
|
57424015de | ||
|
|
53dcedfea2 | ||
|
|
2ef284e585 | ||
|
|
9005194c54 | ||
|
|
cc00b6332c | ||
|
|
54a0926552 | ||
|
|
b16e5a53e8 | ||
|
|
24d5390d25 | ||
|
|
9d10def2f5 | ||
|
|
e48a64da7a | ||
|
|
34d54d91a4 | ||
|
|
b056b11ba9 | ||
|
|
619eb19f72 | ||
|
|
81da180ab7 | ||
|
|
371f05baaa | ||
|
|
a56d441513 | ||
|
|
621a8abb92 | ||
|
|
d4de3a3f35 | ||
|
|
9aa743b601 | ||
|
|
d1b66af251 | ||
|
|
7547c0abc4 | ||
|
|
def93b6cf5 | ||
|
|
4b28d65006 | ||
|
|
5a1a04d029 | ||
|
|
95a6a1291a | ||
|
|
56faec6046 | ||
|
|
15b5437987 | ||
|
|
7a615a8639 | ||
|
|
21d48866de | ||
|
|
1b7baa0257 | ||
|
|
ebf2070295 | ||
|
|
2f9b18c95c | ||
|
|
8ac2e828df | ||
|
|
1bb28cf141 | ||
|
|
83f49db49e | ||
|
|
e09e413892 | ||
|
|
41c68baa5d | ||
|
|
7271e2ee12 | ||
|
|
80a5e8272d | ||
|
|
3770de0804 | ||
|
|
40abb7bef3 | ||
|
|
0d9ed56a55 | ||
|
|
3087a9a116 | ||
|
|
eaebb1edbf | ||
|
|
13de893c46 | ||
|
|
dc49b92a47 | ||
|
|
2408736c5e | ||
|
|
6efb210781 | ||
|
|
1d891b2c6a | ||
|
|
7c98c61b7a | ||
|
|
991498b0e1 | ||
|
|
f6a41c9f59 | ||
|
|
8e884e6db1 | ||
|
|
9d57ca604e | ||
|
|
97e883f51d | ||
|
|
c9982a7675 | ||
|
|
fce3a3b0a0 | ||
|
|
b7d18dff37 | ||
|
|
3a089c6175 | ||
|
|
7d05268983 | ||
|
|
f147ccc8c5 | ||
|
|
71dc8ca59b | ||
|
|
8ecbd5e720 | ||
|
|
e039cfb8a9 | ||
|
|
aa072f58d8 | ||
|
|
20d23ce68d | ||
|
|
b191f7d66c | ||
|
|
20813a6607 | ||
|
|
22f95c1536 | ||
|
|
2476c1893f | ||
|
|
3d33ee9dc3 | ||
|
|
9aa7198aed | ||
|
|
f11561f15f | ||
|
|
337f1f6de6 | ||
|
|
3d1ace51ae | ||
|
|
ca433d256d | ||
|
|
6c771e0820 | ||
|
|
c57de1e03c | ||
|
|
1e8b2367ca | ||
|
|
c290b6f38d | ||
|
|
090f389589 | ||
|
|
313ea366d6 | ||
|
|
55d34dc259 | ||
|
|
fb111806e2 | ||
|
|
0c8228eced | ||
|
|
0340878909 | ||
|
|
8e274a252d | ||
|
|
d89b71bfbc | ||
|
|
39f02b83c0 | ||
|
|
ba05af11f2 | ||
|
|
e6a12fae9a | ||
|
|
994c360ec0 | ||
|
|
3d01fbe589 | ||
|
|
90cf2236ee | ||
|
|
09b6c2b810 | ||
|
|
d362d189ac | ||
|
|
e81c82cf61 | ||
|
|
9873c84416 | ||
|
|
3156d1488a | ||
|
|
d1d6672503 | ||
|
|
269c633233 | ||
|
|
2126ba8436 | ||
|
|
77d76af4a7 | ||
|
|
7dbcea2319 | ||
|
|
fe1a001e62 | ||
|
|
2018e5f8b8 | ||
|
|
d88e74cd29 | ||
|
|
eebe6deac5 | ||
|
|
a25c3aace3 | ||
|
|
e4720407a9 | ||
|
|
d011806343 | ||
|
|
cb00e21127 | ||
|
|
c95cfa5967 | ||
|
|
352c44a9b1 | ||
|
|
7e3877df98 | ||
|
|
ea89bc1522 | ||
|
|
8f429b892b | ||
|
|
69dc0a4863 | ||
|
|
1ab2a29bfa | ||
|
|
4cb456743a | ||
|
|
a888421f0e | ||
|
|
0d8125f854 | ||
|
|
99eb24c153 | ||
|
|
676a6976f8 | ||
|
|
ded738d445 | ||
|
|
4352922240 | ||
|
|
c74d604c40 | ||
|
|
a0f4a35c94 | ||
|
|
206591c725 | ||
|
|
fa93b198bf | ||
|
|
863f3e1b80 | ||
|
|
028137a9ad | ||
|
|
9ad404acee | ||
|
|
f98964f6b6 | ||
|
|
20a2b1fa1f | ||
|
|
7ba66392ea | ||
|
|
a4c4864d2b | ||
|
|
5f98c199a5 | ||
|
|
863e7c1a81 | ||
|
|
8686b9a35e | ||
|
|
0b611b6b1e | ||
|
|
ab5e857705 | ||
|
|
d237e0cc9b | ||
|
|
569160f805 | ||
|
|
52a74755f7 | ||
|
|
e926bc9eb3 | ||
|
|
29d363d47a | ||
|
|
4edc951958 | ||
|
|
59b6ca571b | ||
|
|
971190df26 | ||
|
|
a28e8926c7 | ||
|
|
c9a074b1fe | ||
|
|
7350fb7cd4 | ||
|
|
87d5f55be2 | ||
|
|
6d0794ef3a | ||
|
|
8bd725e9ff | ||
|
|
18c0288db0 | ||
|
|
81e6a2befc | ||
|
|
4f59f6e98c | ||
|
|
0200967982 | ||
|
|
0b2265580f | ||
|
|
9dea19d5aa | ||
|
|
bb26825e12 | ||
|
|
54efd62e40 | ||
|
|
51e039f9bf | ||
|
|
697d84aab3 | ||
|
|
0a91f7e9db | ||
|
|
f1e0b75499 | ||
|
|
25eef7097b | ||
|
|
d2497dd079 | ||
|
|
4d71094fba | ||
|
|
a11a9ec641 | ||
|
|
df977704c5 | ||
|
|
1b147235b0 | ||
|
|
ae61d11859 | ||
|
|
7dd94d7fbe | ||
|
|
a9ab265be4 | ||
|
|
16b9ea4a79 | ||
|
|
70ef8f3c8c | ||
|
|
fa99aaccfa | ||
|
|
60281dc9ca | ||
|
|
aaa1ed8213 | ||
|
|
a969b5acdf | ||
|
|
8bf56bac09 | ||
|
|
22c81cbb88 | ||
|
|
0ea4bd65e8 | ||
|
|
0b4c2ec394 | ||
|
|
eaa0122901 | ||
|
|
ed7c30c6a1 | ||
|
|
7231b66fdc | ||
|
|
7e006cea86 | ||
|
|
067917eae5 | ||
|
|
0327e64d24 | ||
|
|
de00eadcad | ||
|
|
482217c017 | ||
|
|
3723036710 | ||
|
|
e3e230042a | ||
|
|
9cd8721846 | ||
|
|
d379d941bb | ||
|
|
2640884721 | ||
|
|
ea0468783e | ||
|
|
19c492b11d | ||
|
|
0dbca4305b | ||
|
|
f23a841e79 | ||
|
|
fd6217b3c7 | ||
|
|
a923ec0970 | ||
|
|
1a74ece3ba | ||
|
|
e43d5fcaaa | ||
|
|
9195d090de | ||
|
|
6aa9d70a49 | ||
|
|
c6860b7b4a | ||
|
|
9ae86d9c86 | ||
|
|
5b160f9780 | ||
|
|
2868a8f0d3 | ||
|
|
78ffd054d4 | ||
|
|
04446e673f | ||
|
|
cca108dc15 | ||
|
|
476be05163 | ||
|
|
a9614ccee2 | ||
|
|
32ca78bff5 | ||
|
|
9aacb91184 | ||
|
|
46f86c771e | ||
|
|
0f8aff7290 | ||
|
|
ae69eba64d | ||
|
|
00f95fdd09 | ||
|
|
9b44d68440 | ||
|
|
fe9e93f796 | ||
|
|
4b0e4eba0c | ||
|
|
6d5a3eb686 | ||
|
|
11cfa44c2b | ||
|
|
91a75820a4 | ||
|
|
b30bafca2b | ||
|
|
fbb316baa9 | ||
|
|
4ac3add870 | ||
|
|
0651e15111 | ||
|
|
874a327dca | ||
|
|
8610a6c016 | ||
|
|
8955babea8 | ||
|
|
b2f5b67b07 | ||
|
|
f48b10340a | ||
|
|
64325d4b87 | ||
|
|
a7f3680a13 | ||
|
|
491d4e528a | ||
|
|
6c81a07766 | ||
|
|
e99fab2086 | ||
|
|
568442a75b | ||
|
|
6a4483cf4d | ||
|
|
a5da5c9521 | ||
|
|
e008741aa5 | ||
|
|
aae046a2f0 | ||
|
|
ac1bf660af | ||
|
|
4ca3302367 | ||
|
|
9599436447 | ||
|
|
67eb719cbd | ||
|
|
a9fbc9b850 | ||
|
|
5c04fa83ab | ||
|
|
ea06e299d6 | ||
|
|
d4efee043c | ||
|
|
6176edccc4 | ||
|
|
d982e9266c | ||
|
|
17efd542f7 | ||
|
|
b947f476da | ||
|
|
5ff94d8f92 | ||
|
|
569bec31b6 | ||
|
|
925c916ea5 | ||
|
|
2783dfb284 | ||
|
|
6ae609b60e | ||
|
|
c494ad04ae | ||
|
|
9876895a84 | ||
|
|
aa4d86d735 | ||
|
|
6df38ced25 | ||
|
|
e303f7852f | ||
|
|
9140990a7d | ||
|
|
03925e3116 | ||
|
|
cce656a407 | ||
|
|
8c42f2de2f | ||
|
|
cb40cc4634 | ||
|
|
e229809581 | ||
|
|
66ceabad0e | ||
|
|
6446de6b6b | ||
|
|
a07d93510f | ||
|
|
a95cf8092e | ||
|
|
f7849f39c2 | ||
|
|
5f5fc393a4 | ||
|
|
6eef2f7a54 | ||
|
|
5b5fdab8a6 | ||
|
|
36f2aa12d7 | ||
|
|
4cf64a4d55 | ||
|
|
0e8999671b | ||
|
|
53fabe95db | ||
|
|
67898d6a8a | ||
|
|
df43cade62 | ||
|
|
f6726439ed | ||
|
|
bb897411d0 | ||
|
|
3cbfdabe03 | ||
|
|
f7e89c78a2 | ||
|
|
4c2aefd490 | ||
|
|
03afc828f3 | ||
|
|
8f675bcabd | ||
|
|
c9ad1e209a | ||
|
|
95e677b5c7 | ||
|
|
20011eadd3 | ||
|
|
8c3e410ffc | ||
|
|
3681fd95db | ||
|
|
c3e75bd244 | ||
|
|
d0ffeea94b | ||
|
|
d1b93ac9be | ||
|
|
4153657d0a | ||
|
|
f980ed7f56 | ||
|
|
a93200cbfb | ||
|
|
91171f2a90 | ||
|
|
d4906a3cc5 | ||
|
|
de84ffc979 | ||
|
|
0805f3c932 | ||
|
|
1dc3e95a04 | ||
|
|
23956a012b | ||
|
|
49079f7e70 | ||
|
|
c3bb8af8a9 | ||
|
|
01ed1b7c21 | ||
|
|
bf31936146 | ||
|
|
66b2ccf380 | ||
|
|
4dd28b3aa7 | ||
|
|
17638996a1 | ||
|
|
fd9790cf28 | ||
|
|
a09b1d1d36 | ||
|
|
0f4c1f85ae | ||
|
|
bd28917f05 | ||
|
|
db1cc98338 | ||
|
|
a78e0c1d0d | ||
|
|
6b3145fd09 | ||
|
|
08a312be82 | ||
|
|
6f1310a876 | ||
|
|
2d73486dd1 | ||
|
|
2b2ccd511c | ||
|
|
247cbf2b9e | ||
|
|
4111080422 | ||
|
|
8007fd1b6c | ||
|
|
94559ee431 | ||
|
|
0102a20120 | ||
|
|
d596ef2a95 | ||
|
|
aea6c289ec | ||
|
|
de35d1bcae | ||
|
|
e823a1f415 | ||
|
|
bd462448d5 | ||
|
|
dc68e76cd3 | ||
|
|
f86b507615 | ||
|
|
e00e0038c1 | ||
|
|
a6397fcfef | ||
|
|
96cd98f833 | ||
|
|
53436f8177 | ||
|
|
4f4171a6d1 | ||
|
|
be23fe9686 | ||
|
|
70b360e50e | ||
|
|
7a42ddc1bf | ||
|
|
d63db8d12d | ||
|
|
3df21201c2 | ||
|
|
97b72ac5d9 | ||
|
|
c6ebbea58d | ||
|
|
3b99f93ab8 | ||
|
|
59e77f4721 | ||
|
|
2a3393a61e | ||
|
|
66dfb10b60 | ||
|
|
594a57e414 | ||
|
|
140e1b4c50 | ||
|
|
54a8488fa2 | ||
|
|
c2ba59906c | ||
|
|
72f5436318 | ||
|
|
e632db02cf | ||
|
|
c54a56ad36 | ||
|
|
a4388942f0 | ||
|
|
52e3e0647c | ||
|
|
00c23a3511 | ||
|
|
448152cea4 | ||
|
|
f488dd3b6c | ||
|
|
14ca3b91d9 | ||
|
|
7b9d543e49 | ||
|
|
043ae7f072 | ||
|
|
6c3636c7c5 | ||
|
|
c5b3493998 | ||
|
|
aa081e3dc6 | ||
|
|
bc0d29ace4 | ||
|
|
ca36c94eb3 | ||
|
|
62d3c4154e | ||
|
|
c8805af755 | ||
|
|
47ef33c536 | ||
|
|
61cef7d16c | ||
|
|
7964765605 | ||
|
|
a2a2eafab5 | ||
|
|
4bec90cf8c | ||
|
|
6cf8221ba7 | ||
|
|
6305f059ac | ||
|
|
bcd3b6fa66 | ||
|
|
4be0ff5787 | ||
|
|
4acccaee86 | ||
|
|
b5ec36ae2a | ||
|
|
b7b75fbff1 | ||
|
|
daf9f5c57e | ||
|
|
8d319b3b0c | ||
|
|
5db7acaff2 | ||
|
|
fb33ac6327 | ||
|
|
169119a48d | ||
|
|
9599982b91 | ||
|
|
d4a9c6b4fd | ||
|
|
49bd9b63e6 | ||
|
|
8cb09ea5a8 | ||
|
|
295c934438 | ||
|
|
bd109d03c5 | ||
|
|
8993186005 | ||
|
|
24a96d1c7c | ||
|
|
3725cca9d7 | ||
|
|
4fbc43f5ff | ||
|
|
ac134b3c4e | ||
|
|
03aa1c5110 | ||
|
|
9726f5f736 | ||
|
|
1e2d4afd6b | ||
|
|
4414f27438 | ||
|
|
93330a85ef | ||
|
|
d2df1907be | ||
|
|
830e1f851b | ||
|
|
1014713ec0 | ||
|
|
521c87d952 | ||
|
|
7cb5b42429 | ||
|
|
763ae99e8e | ||
|
|
c6a58dd646 | ||
|
|
3d94e28dff | ||
|
|
8731ec2b9e | ||
|
|
06779fb8dd | ||
|
|
7385b8862a | ||
|
|
f2deac541e | ||
|
|
8cbd72663a | ||
|
|
ceb31c4612 | ||
|
|
506904bbdc | ||
|
|
68d2cef346 | ||
|
|
180c05e425 | ||
|
|
e052a0d0f3 | ||
|
|
aeacf53518 | ||
|
|
5b4eadb88f | ||
|
|
484375fa2b | ||
|
|
12d8ae805b | ||
|
|
c3277531d3 | ||
|
|
21cc743236 | ||
|
|
4166cb7e9b | ||
|
|
95760e4a1c | ||
|
|
ff97f386da | ||
|
|
93dd4e531b | ||
|
|
48d10f901d | ||
|
|
d81021d1a3 | ||
|
|
14a3775206 | ||
|
|
c2dbf405ab | ||
|
|
ea69301804 | ||
|
|
fe7fd68321 | ||
|
|
a8e7499ce3 | ||
|
|
ff3fff343d | ||
|
|
67915402a6 | ||
|
|
8251e35de2 | ||
|
|
5c0ffd41ac | ||
|
|
40ed26e339 | ||
|
|
6714591704 | ||
|
|
295093ae5a | ||
|
|
472f778e75 | ||
|
|
611e6fec96 | ||
|
|
a9e5f38ef7 | ||
|
|
fcfb7ec764 | ||
|
|
ccda740476 | ||
|
|
4772985ffe | ||
|
|
edf851438b | ||
|
|
cea9ccddef | ||
|
|
63593e7ff3 | ||
|
|
15880c884d | ||
|
|
f0e5f14a8c | ||
|
|
2c4d968659 | ||
|
|
ec9ce3b765 | ||
|
|
8468c36daa | ||
|
|
1633e441de | ||
|
|
6dd4f6bf83 | ||
|
|
6a7e79fa03 | ||
|
|
060405fca6 | ||
|
|
7e0090c7a5 | ||
|
|
77f05513ed | ||
|
|
dbccedb579 | ||
|
|
fab9a473fc | ||
|
|
875f8a7600 | ||
|
|
12288b51ee | ||
|
|
ac63a3db92 | ||
|
|
641fc1c14b | ||
|
|
5010e9ab10 | ||
|
|
2431f3a479 | ||
|
|
867bace1c9 | ||
|
|
a09398811f | ||
|
|
a703f2dcc0 | ||
|
|
f909e8199c | ||
|
|
84e2e9cadb | ||
|
|
7b19a423a2 | ||
|
|
afe59fc7b4 | ||
|
|
4fa6998f66 | ||
|
|
40264a61dd | ||
|
|
b9455e0438 | ||
|
|
72f7cfaf2a | ||
|
|
b281738084 | ||
|
|
51d82d7e43 | ||
|
|
9c486ee7f2 | ||
|
|
1236989edf | ||
|
|
c7b0124369 | ||
|
|
ae8f81b1a2 | ||
|
|
b8a135d2b6 | ||
|
|
9690dbdbed | ||
|
|
dc8282f707 | ||
|
|
df511602cf | ||
|
|
7376acffb2 | ||
|
|
f88fa7fd9d | ||
|
|
c72f612431 | ||
|
|
f3bbe4098b | ||
|
|
ab35e280f1 | ||
|
|
4de329c327 | ||
|
|
e05caa351b | ||
|
|
5a9571f792 | ||
|
|
6876935e60 | ||
|
|
495b615220 | ||
|
|
c00edaf357 | ||
|
|
0446a35b8c | ||
|
|
17d41cbffd | ||
|
|
3f1dd0c077 | ||
|
|
b004cd2efb | ||
|
|
34c4f0d84b | ||
|
|
7e45732602 | ||
|
|
5c0946f990 | ||
|
|
dc14761af7 | ||
|
|
e3d5ff3abf | ||
|
|
ea037d66bb | ||
|
|
e791c94cfe | ||
|
|
fb22be1a49 | ||
|
|
25adbc7bf0 | ||
|
|
0f7ffde050 | ||
|
|
6b74a17312 | ||
|
|
96c88d2787 | ||
|
|
d40595c7e5 | ||
|
|
03025de783 | ||
|
|
1d9b152beb | ||
|
|
4c64726e61 | ||
|
|
af50f1afa1 | ||
|
|
6e1ee13d68 | ||
|
|
493180125a | ||
|
|
159bb6a386 | ||
|
|
8b33051355 | ||
|
|
eac5bd649a | ||
|
|
da7f580bf0 | ||
|
|
431bbd14d4 | ||
|
|
7dd3961e21 | ||
|
|
b6fab85f61 | ||
|
|
946f8b1b76 | ||
|
|
38bacdfbd5 | ||
|
|
d07ff59d31 | ||
|
|
bdf3279aed | ||
|
|
69e80f6060 | ||
|
|
10ba5c7243 | ||
|
|
6116bf3553 | ||
|
|
30464dd214 | ||
|
|
0d3067a86d | ||
|
|
f18fc5187f | ||
|
|
60949cf91c | ||
|
|
cd3434ff8e | ||
|
|
76cc4035ea | ||
|
|
cefc3e5289 | ||
|
|
7802df54a3 | ||
|
|
51d65e6fad | ||
|
|
b17e16df08 | ||
|
|
af8a34c2e2 | ||
|
|
a0bb8be2ac | ||
|
|
33125d1f16 | ||
|
|
fd3f0ffae5 | ||
|
|
cd0ec782d5 | ||
|
|
3639dc0f20 | ||
|
|
792621d39b | ||
|
|
a00a2d5148 | ||
|
|
7250f7f5ca | ||
|
|
abffe4e7bc | ||
|
|
e650177585 | ||
|
|
c311938129 | ||
|
|
4e45a354fe | ||
|
|
247cc8bd37 | ||
|
|
e55b44beac | ||
|
|
40af634efd | ||
|
|
6465915dc1 | ||
|
|
4702bf6ceb | ||
|
|
3fb2b57f21 | ||
|
|
a6cf56da6c | ||
|
|
15741c0b9c | ||
|
|
4e892005cd | ||
|
|
833253a936 | ||
|
|
639f5e8f8b | ||
|
|
b11fc864f2 | ||
|
|
053468875e | ||
|
|
ebab0eca05 | ||
|
|
6769a6e80b | ||
|
|
63927110d9 | ||
|
|
41456b9d31 | ||
|
|
c545c7ff9a | ||
|
|
b6d55e63dc | ||
|
|
cd6baba53f | ||
|
|
9a7404c717 | ||
|
|
c98ec0056f | ||
|
|
753aac632d | ||
|
|
bf24a7c1da | ||
|
|
fe0defd671 | ||
|
|
9744e14809 | ||
|
|
336ca510c8 | ||
|
|
d973b2d1a0 | ||
|
|
17bd2d6237 | ||
|
|
bef442684e | ||
|
|
112a700c9b | ||
|
|
3724ab1a00 | ||
|
|
6af137b17e | ||
|
|
252963f0fa | ||
|
|
19ecb7fdc6 | ||
|
|
57c3282ff9 | ||
|
|
db72c7775d | ||
|
|
812c9d89dc | ||
|
|
cc9cdf1689 | ||
|
|
bf5dae3797 | ||
|
|
e6da4d2fa7 | ||
|
|
51beb682f0 | ||
|
|
99dbb5ebb0 | ||
|
|
b41a2a9a97 | ||
|
|
87a81f16cd | ||
|
|
d50b4bf560 | ||
|
|
54f610445b | ||
|
|
b1b633636a | ||
|
|
02218dbf42 | ||
|
|
b8c2be8837 | ||
|
|
261f0ea278 | ||
|
|
93bc5ac945 | ||
|
|
77f672f156 | ||
|
|
fcbbbb0ab4 | ||
|
|
65b50072af | ||
|
|
1e7cfd2c85 | ||
|
|
d55f4e4059 | ||
|
|
e1060924bf | ||
|
|
5d4920eb29 | ||
|
|
d248a84764 | ||
|
|
9ae7353376 | ||
|
|
f8dc31cae6 | ||
|
|
3afa8dc6c1 | ||
|
|
fb361b7df9 | ||
|
|
7fa81aa01d | ||
|
|
06cc88809e | ||
|
|
5fd5f92bb4 | ||
|
|
466abd4ce6 | ||
|
|
82542740e7 | ||
|
|
ac3e42a201 | ||
|
|
5862664c76 | ||
|
|
0864536d6d | ||
|
|
07a4dcdda1 | ||
|
|
e77181e997 | ||
|
|
f4d477695f | ||
|
|
3622d40043 | ||
|
|
972b7635d2 | ||
|
|
9e3164adf6 | ||
|
|
3be8cefe46 | ||
|
|
c1a7dedd6a | ||
|
|
64f4446113 | ||
|
|
7f25075742 | ||
|
|
c3ae426a10 | ||
|
|
b599f92516 | ||
|
|
682604ae44 | ||
|
|
3eb4e81956 | ||
|
|
34c8b7d6ec | ||
|
|
6e046575ac | ||
|
|
9b367e87ee | ||
|
|
769e3cdf17 | ||
|
|
69edbf56b6 | ||
|
|
8fea8880b5 | ||
|
|
4735d75c1f | ||
|
|
369472e7f7 | ||
|
|
79305d7c79 | ||
|
|
aaa9dee477 | ||
|
|
ec45ce0694 | ||
|
|
ea14b3edbf | ||
|
|
2076da8f21 | ||
|
|
05d7980561 | ||
|
|
88646c9453 | ||
|
|
4c2ec0a402 | ||
|
|
e4c5b0cb32 | ||
|
|
5d6d51536f | ||
|
|
3b270d749d | ||
|
|
2856506d65 | ||
|
|
b119c57e8e | ||
|
|
0d70318a12 | ||
|
|
d73d6334fc | ||
|
|
ec6826619b | ||
|
|
ae7e27116f | ||
|
|
4edd345a01 | ||
|
|
6c55686849 | ||
|
|
aed9b5bb5f | ||
|
|
f167b4f4d1 | ||
|
|
41c928788e | ||
|
|
6216201d7d | ||
|
|
08d31bb4d9 | ||
|
|
26f66d871a | ||
|
|
da77f19d0f | ||
|
|
d9befd4d87 | ||
|
|
7c4edbb1f1 | ||
|
|
6f71414d69 | ||
|
|
09414e1fe1 | ||
|
|
8c07d3442e | ||
|
|
247893282b | ||
|
|
0c615c8e82 | ||
|
|
6414770de7 | ||
|
|
9dc1f59f8e | ||
|
|
09781d40e9 | ||
|
|
a8b20563fb | ||
|
|
ff509c2d59 | ||
|
|
71bd01c82c | ||
|
|
2fca019237 | ||
|
|
87b6b6e44e | ||
|
|
d4e52dc225 | ||
|
|
ca5cb0b8af | ||
|
|
1da9e0dde9 | ||
|
|
d211889e93 | ||
|
|
7f1f202de1 | ||
|
|
3406f84e86 | ||
|
|
4991bdfcfc | ||
|
|
8d5cbc69ba | ||
|
|
e7bcdf6c53 | ||
|
|
6658a155fc | ||
|
|
7ad3c327ec | ||
|
|
5e9552d785 | ||
|
|
23cf1f13de | ||
|
|
5a54386dee | ||
|
|
a798221817 | ||
|
|
6d4aa37189 | ||
|
|
1b0ce27ed3 | ||
|
|
2c8d5e12d8 | ||
|
|
c7b7660049 | ||
|
|
b4ee4c1330 | ||
|
|
dd3a20890d | ||
|
|
be6f8859c2 | ||
|
|
4aa1714923 | ||
|
|
477e2124c8 | ||
|
|
269433abdb | ||
|
|
ed1da06685 |
No files matched your search
Generated
+811
-9
File diff suppressed because it is too large.
Load diff
+12
-1
@@ -11,13 +11,17 @@ name = "texrra"
|
||||
path = "src/main.rs"
|
||||
|
||||
[workspace]
|
||||
members = ["crates/texrra-core"]
|
||||
members = ["crates/texrra-core", "crates/texrra-tex-core"]
|
||||
|
||||
[dependencies]
|
||||
texrra-core = { path = "crates/texrra-core", features = ["serde"] }
|
||||
texrra-tex-core = { path = "crates/texrra-tex-core" }
|
||||
flate2 = "1.1"
|
||||
hayro-svg = { version = "=0.9.0", default-features = false, features = ["embed-cmaps"] }
|
||||
hyphenate = { path = "vendor/hyphenate" }
|
||||
genpdf = { version = "0.2.0", features = ["images"] }
|
||||
printpdf = "0.3.4"
|
||||
lopdf = "0.26"
|
||||
image = { version = "0.23.12", default-features = false, features = ["png", "jpeg", "bmp"] }
|
||||
common = { git = "https://github.com/jamespfennell/texcraft", rev = "c1dbf5dfe3a480daf73972c394ac8231e0c6ebd0", features = ["serde"] }
|
||||
boxworks = { git = "https://github.com/jamespfennell/texcraft", rev = "c1dbf5dfe3a480daf73972c394ac8231e0c6ebd0" }
|
||||
@@ -28,10 +32,17 @@ texlang-stdlib = { git = "https://github.com/jamespfennell/texcraft", rev = "c1d
|
||||
texlang-common = { git = "https://github.com/jamespfennell/texcraft", rev = "c1dbf5dfe3a480daf73972c394ac8231e0c6ebd0" }
|
||||
texcraft-stdext = { git = "https://github.com/jamespfennell/texcraft", rev = "c1dbf5dfe3a480daf73972c394ac8231e0c6ebd0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
sha2 = "0.10"
|
||||
rmp-serde = "1.3"
|
||||
tiny_http = "0.12"
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||
ttf-parser = "0.25.1"
|
||||
|
||||
[patch.crates-io]
|
||||
printpdf = { path = "vendor/printpdf" }
|
||||
genpdf = { path = "vendor/genpdf" }
|
||||
|
||||
[patch."https://github.com/jamespfennell/texcraft"]
|
||||
texlang = { path = "vendor/texlang" }
|
||||
texlang-stdlib = { path = "vendor/texlang-stdlib" }
|
||||
|
||||
@@ -1,10 +1,122 @@
|
||||
# texrra engine
|
||||
|
||||
Rust-native, Typst-inspired incremental LaTeX engine with a live preview
|
||||
server. Typesetting is implemented in Rust; the engine does not invoke XeLaTeX,
|
||||
LuaLaTeX, or pdfLaTeX. The web frontend is a separate repository,
|
||||
[`texrra-web`](https://git.iloveuulove.me/gloamxun/texrra-web), served by this
|
||||
engine as static files.
|
||||
Texrra is building a TeX engine for live editing of existing LaTeX projects.
|
||||
It tracks inputs and compilation state, reuses eligible work after edits,
|
||||
and publishes updated pages with source locations. The delivery targets are
|
||||
a library, a CLI, and editor integration. The current Route-D implementation
|
||||
is the development baseline. Upstream TeX components are candidates for reuse
|
||||
where their state, file effects, and cancellation can be verified.
|
||||
|
||||
The [product goal](docs/NATIVE_PRODUCT_GOAL.md) defines compatibility and live
|
||||
preview acceptance. The [publisher matrix](docs/PUBLISHER_TEMPLATE_MATRIX.md)
|
||||
covers original journals, two-column journals, conferences, and arXiv.
|
||||
The [local beta guide](docs/NATIVE_BETA.md) explains how to prepare a bundle,
|
||||
open a project in the native editor, and export a PDF.
|
||||
|
||||
## Native execution bootstrap
|
||||
|
||||
The current Route-D entry is available through the developer CLI and the native
|
||||
editor example. Its implementation and remaining work are tracked in the
|
||||
[stage progress](docs/P2_M1_PROGRESS.md). The separate frontend repository
|
||||
is [texrra-web](https://git.iloveuulove.me/gloamxun/texrra-web).
|
||||
|
||||
Native fonts come from an explicit resource World. For the checked-in examples,
|
||||
configure the actual TFM/PFB directories and an installed font-map directory:
|
||||
|
||||
```sh
|
||||
export TFMFONTS="$PWD/crates/texrra-tex-core/assets"
|
||||
export T1FONTS="$PWD/assets/fonts"
|
||||
# Example TeX Live map directory on this development system; configure yours.
|
||||
export TEXFONTMAPS=/var/lib/texmf/fonts/map/pdftex/updmap
|
||||
cargo run --release -- native examples/native-bootstrap/main.tex /tmp/bootstrap.pdf
|
||||
cargo run --release -- native --initex --etex examples/native-bootstrap/dynamic-fonts.tex /tmp/fonts.pdf
|
||||
cargo run --release -- native --job --initex --etex examples/native-bootstrap/native-job.tex /tmp/native-job.pdf
|
||||
cargo run --release -- native --job --initex --etex examples/native-bootstrap/device.tex /tmp/device.pdf
|
||||
```
|
||||
|
||||
`--job` selects actual online native page/output/shipout execution. It exports
|
||||
only boxes really shipped by the token executor; deferred I/O runs when its
|
||||
original material is shipped. Each shipout captures its actual paper,
|
||||
origin/offsets and mag; zero paper dimensions use the real box's dimensions.
|
||||
The logical box and actual font resources are retained, with a common physical
|
||||
transform for PDF/SVG. [Native mag/true and device state](docs/NATIVE_DEVICE.md)
|
||||
records the supported semantics and remaining PDF configuration/precision work. The entry without
|
||||
`--job` remains a list-measurement tool for existing algorithm gates; its host
|
||||
canvas does not certify native pagination. There is no automatic fallback
|
||||
between these targets. See [native pages and remaining device work](docs/NATIVE_PAGES.md).
|
||||
|
||||
INITEX starts with actual nullfont and zero layout dimensions. Non-INITEX
|
||||
bootstrap loads its initial cmr10 through World. The current native job reports
|
||||
missing resources directly.
|
||||
Use `--texmf-root`, resource search environment variables and `--input-policy`
|
||||
for distribution/project resources; `--resource-manifest` records actual reads,
|
||||
versions and negative lookups, including failed jobs. The CLI defaults to TeX
|
||||
8-bit input. Use `--input-profile xetex --etex` for the native XeTeX language
|
||||
and output profile, or `--input-profile unicode` for the existing scalar-input
|
||||
mode. Build and load format images with the same profile.
|
||||
|
||||
This entry executes native tokens, expansion, scoped state, real streams,
|
||||
measured h/v/math lists, paragraph breaking and display transitions without v1
|
||||
or source preprocessing. It now carries actual sized FontId resources through
|
||||
text, math, geometry, SVG and PDF. Live fontdimen and em/ex affect their real
|
||||
consumers; output uses actual map/encoding/PFB resources. See
|
||||
[native font execution and boundaries](docs/NATIVE_FONT_EXECUTION.md).
|
||||
The native editor example exercises the shared compile session and page
|
||||
updates. The production HTTP routes still use the older implementation.
|
||||
Format boot, active compatibility gaps, and whole-project results are tracked
|
||||
in the [stage progress](docs/P2_M1_PROGRESS.md).
|
||||
|
||||
[Streaming TFM keep/pass/boundary execution](docs/NATIVE_FONT_PROGRAMS.md) is
|
||||
connected to actual lists. [Owned discretionary branches and actual ligature
|
||||
hyphenation/reconstitution](docs/NATIVE_DISCRETIONARIES.md) now feed line breaking,
|
||||
packing, diagnostics and output. [Two-pass mathematical noad ligature/kern and
|
||||
operator limits/display/rebox execution](docs/NATIVE_MATH_PROGRAMS.md) also use
|
||||
actual font instances and list consumers. [Canonical raw paragraph line boxes,
|
||||
running rules/overfull markers, actual shifts/unboxing/lastbox and native math
|
||||
subboxes](docs/NATIVE_LISTS.md) are connected. Nested boxes suspend and restore
|
||||
actual math/display frames; output and math reuse the same raw-list traversal.
|
||||
[Original-list vert_break/vsplit, live split parameters and per-class split marks](docs/NATIVE_SPLITTING.md)
|
||||
now execute. Paragraph/adjusted-hbox/display marks migrate at actual pack time;
|
||||
mark expansion retains real input contexts and byte diagnostics.
|
||||
[Online page contributions, real output groups/shipout, page marks and deferred
|
||||
file I/O](docs/NATIVE_PAGES.md) now execute natively. The four-page reference
|
||||
job matches all 174 words, actual auxiliary bytes and all four raster pages.
|
||||
Real mag/true, actual true font sizes and per-shipout paper/origin/offsets now
|
||||
execute; the 15-job/29-page device oracle passes. [Real PDF file state, versions,
|
||||
compression, object streams/xref and original-sp precision](docs/NATIVE_PDF_CONFIG.md)
|
||||
now execute. The new 28-configuration/56-page and retained device matrices have
|
||||
zero word-box, paper and raster XOR differences. Independent 105-page object
|
||||
stream rollover also passes. Native jobs with `\pdfoutput=0` can write binary DVI.
|
||||
Specify the DVI destination explicitly with `texrra native --load-format latex.tfx
|
||||
--input-profile tex8bit input.tex output.dvi`. The writer serializes the actual
|
||||
shipouts. DVI drivers receive special payloads in their original page order.
|
||||
[DVI evidence](docs/P2_M1_PROGRESS.md#原生-dvi-出页设备)
|
||||
[Actual PK resolution, bitmap decoding, Type3 output and shared text cursor](docs/NATIVE_PK_FONTS.md)
|
||||
now execute; 384 independent glyphs and a 43-job/86-page oracle pass with zero
|
||||
bitmap/word-box/paper/raster differences. Missing devices/resources fail.
|
||||
[Actual native ownership/resource statistics and page-break diagnostics](docs/NATIVE_STATISTICS_PAGE_TRACE.md)
|
||||
now execute; 16 jobs/48 pages match reference ink and 216 exact page diagnostics.
|
||||
Trace controls preserve native PDF bytes. [Actual paragraph traces, canonical-zero glue
|
||||
and owned ordinary side-script lists](docs/NATIVE_PARAGRAPH_TRACE.md) also execute;
|
||||
8 jobs/32 pages have 24 exact reports and 5436 pass/decision lines with zero word/raster
|
||||
differences. Other tracing consumers, compound math fields, insertions, format images, real
|
||||
NFSS/article and compile sessions remain required by P2-M1. Unsupported commands and resources are explicit errors.
|
||||
|
||||
Component contracts and independent reference checks:
|
||||
|
||||
- [Input contexts/show](docs/NATIVE_INPUT_CONTEXT.md), [input profiles](docs/NATIVE_INPUT_PROFILE.md),
|
||||
[job time/file streams](docs/NATIVE_JOB_IO.md), [quantities](docs/NATIVE_QUANTITIES.md).
|
||||
- [Paragraphs](docs/NATIVE_PARAGRAPHS.md), [boxes/vpack](docs/NATIVE_BOXES.md),
|
||||
[interline penalties](docs/NATIVE_INTERLINE_PENALTIES.md), [sfcode](docs/NATIVE_SFCODE.md),
|
||||
[case/language data](docs/NATIVE_LANGUAGE_DATA.md).
|
||||
- [Inline math](docs/NATIVE_MATH_EXECUTION.md), [display transitions](docs/NATIVE_DISPLAY_MATH.md),
|
||||
[accents](docs/NATIVE_FONT_STATE_ACCENTS.md), [delimiters](docs/NATIVE_DELIMITERS.md),
|
||||
[box/list diagnostics](docs/NATIVE_BOX_DIAGNOSTICS.md).
|
||||
- [Integer TFM](docs/NATIVE_TFM_LOADING.md), [font catalog](docs/NATIVE_FONT_CATALOG.md),
|
||||
[font program work remaining](docs/NATIVE_DYNAMIC_FONTS.md).
|
||||
|
||||
The UI and compatibility features described below belong to the existing
|
||||
application; they do not certify native token-kernel LaTeX portability.
|
||||
|
||||
## Repository layout
|
||||
|
||||
@@ -12,12 +124,13 @@ Clone both repositories as siblings so the engine can discover the frontend:
|
||||
|
||||
```
|
||||
texrra/
|
||||
engine/ # this repository: Rust engine and HTTP server
|
||||
web/ # texrra-web: static editor frontend
|
||||
texrra-engine/ # this repository: Rust engine and HTTP server
|
||||
texrra-web/ # texrra-web: static editor frontend
|
||||
```
|
||||
|
||||
The server resolves the frontend from `TEXRRA_WEB_DIR` when set, otherwise from
|
||||
`../web` and then `./web`. It serves `index.html`, `styles.css`, `app.js`, and
|
||||
a sibling `web` or `texrra-web` directory (`./web`, `./texrra-web` and their
|
||||
`../` forms). It serves `index.html`, `styles.css`, `app.js`, and
|
||||
`favicon.svg`; preview font faces are generated by the engine at `/fonts.css`
|
||||
and `/fonts/*.ttf`.
|
||||
|
||||
@@ -121,14 +234,15 @@ the `.tex` file passed to `serve`.
|
||||
It handles document metadata, `\maketitle`, and `\today` (UTC),
|
||||
A4 pages, `geometry` margins (`margin`, `top`, `right`, `bottom`, `left`,
|
||||
`hmargin`, and `vmargin` with `mm`, `cm`, `in`, `pt`, or `bp` units), paragraphs,
|
||||
numbered and starred heading levels, paragraph indentation (`\parindent`),
|
||||
numbered and starred heading levels (article sections; `report`/`book` chapters with sections numbered `1.1`), paragraph indentation (`\parindent`),
|
||||
`\hfill`, serif/sans/monospaced text, true small caps, itemize/enumerate lists,
|
||||
page
|
||||
breaks, basic display and inline math, figures, simple tables,
|
||||
section/figure/table references, and numeric citations from a manual bibliography
|
||||
or a local `.bib` file. A4 pages use 25 mm margins unless
|
||||
`geometry` sets them. Liberation Serif is embedded in the PDF for Latin and math
|
||||
glyphs; CJK text uses an installed fallback font.
|
||||
breaks, basic display and inline math, figures, tables whose cell widths use Computer Modern metricss,
|
||||
section/figure/table references, numeric citations from a manual bibliography or a
|
||||
local `.bib` file, and natbib-style author-year citations for the arXiv template. A4 pages use 25 mm margins unless
|
||||
`geometry` sets them. The PDF always embeds its Liberation Serif/Mono/Sans
|
||||
faces (and any CJK fallback), so glyphs do not depend on fonts installed in the
|
||||
reader; font programs and ToUnicode maps are Flate-compressed, so PDFs are larger than Base-14 output but render reliably.
|
||||
|
||||
### LaTeX compatibility layer
|
||||
|
||||
@@ -140,7 +254,9 @@ parameterization commands:
|
||||
- `\newlength`, `\setlength`, and `\addtolength` (skip registers), plus
|
||||
`\newcounter` / `\setcounter` / `\addtocounter`.
|
||||
- `\newcommand`, `\renewcommand`, `\providecommand`, `\def`, `\let`, and
|
||||
legacy commands such as `\setlength`-style kernel macros.
|
||||
legacy commands such as `\setlength`-style kernel macros; `\long`/`\global`/
|
||||
`\outer`/`\protected` definition prefixes, `\gdef`, and
|
||||
`\protected@edef`/`\protected@xdef` are accepted.
|
||||
- `\newenvironment` / `\renewenvironment` are accepted; layout-critical
|
||||
environments (`abstract`, `figure`, `table`, lists, `tabular`) keep the
|
||||
engine's native behavior, and redefinitions of the structural commands
|
||||
@@ -150,6 +266,8 @@ parameterization commands:
|
||||
`\newgeometry`.
|
||||
- Package files are read with `@` as a letter, so `\@title`-style internals
|
||||
tokenize correctly.
|
||||
- The `abstract` environment indents its body as a quotation, and `\paragraph`
|
||||
produces an unnumbered bold run-in heading.
|
||||
|
||||
`\documentclass[options]{class}` parses class options, accepts the built-in
|
||||
`article`, `report`, `book`, `letter`, `minimal`, and `standalone` classes, and
|
||||
@@ -165,17 +283,35 @@ options/`\geometry{...}` settings, including `paperwidth`, `paperheight`,
|
||||
`textheight` sizes it below the current top margin. The chosen page size drives
|
||||
the PDF pages, the positioned layout, and the SVG preview.
|
||||
|
||||
`\textwidth`, `\textheight`, `\linewidth`, and `\columnwidth` are live named
|
||||
length registers: they start at the A4 text block and are updated by
|
||||
`\documentclass` paper options, `\geometry`, and `\newgeometry`, so
|
||||
`\parbox{\textwidth}`, `\rule{\textwidth}{...}`, and
|
||||
`\includegraphics[width=0.5\textwidth]` all follow the current page setup.
|
||||
|
||||
Page styles are painted in both the PDF and the SVG preview:
|
||||
`\pagestyle{empty|plain|fancy}` sets the document default,
|
||||
`\thispagestyle{...}` overrides one page, and fancyhdr's `\fancyhead`/
|
||||
`\fancyfoot` plus `\lhead`/`\chead`/`\rhead`/`\lfoot`/`\cfoot`/`\rfoot`
|
||||
place runs in the left, center, or right slot. `\thepage` is resolved when the
|
||||
page is painted, so the footer shows the real page number. Decoration tokens
|
||||
are expanded at the start of the document, after packages have renewed macros
|
||||
such as the short title, and fancy headers get the usual 0.4pt rule below them.
|
||||
The default style is
|
||||
`plain` (a centered page number).
|
||||
|
||||
The following packages are accepted as built-ins: `geometry`, `graphicx`,
|
||||
`amsmath`, `amssymb`, `amsfonts`, `booktabs`, `hyperref`, `cite`, `natbib`,
|
||||
`inputenc`, `fontenc`, `url`, `nicefrac`, `microtype`, `cleveref`, `lipsum`,
|
||||
`doi`, `authblk`, and `fancyhdr`. Their commands are approximated where they
|
||||
affect text (`\url` becomes breakable monospace, `\nicefrac`, `\cref`,
|
||||
`\doi`, `\lipsum`, `\verb`), and are no-ops where they only affect the PDF
|
||||
back end (`\hypersetup`, `\fancyhf`, `\microtypesetup`).
|
||||
affect text (`\url` becomes breakable monospace (a `~` outside URLs becomes a space, while URLs keep their tildes), `\nicefrac`, `\cref`,
|
||||
`\doi`, `\lipsum`, `\verb`); `\hypersetup` and `\microtypesetup` remain
|
||||
PDF-backend no-ops, while fancyhdr's page decorations are painted natively.
|
||||
|
||||
Figure and table captions are numbered (`Figure 1: ...`, `Table 1: ...`), and
|
||||
`\ref` to a figure/table label resolves to that number. Display math that is
|
||||
wider than the text column is scaled to fit the column. Latin text is hyphenated
|
||||
wider than the text column is scaled to fit the column; route-D instead
|
||||
splits wide display formulas at top-level operators. Latin text is hyphenated
|
||||
with plain TeX's English patterns (two letters before and three after the
|
||||
hyphen) through the Knuth–Plass line breaker; math and CJK text are not
|
||||
hyphenated.
|
||||
@@ -258,15 +394,17 @@ collapsed to an ordinary space in text).
|
||||
the starred form (`\vspace*{12pt}`, `\hspace*{1cm}`); the star is consumed and
|
||||
the dimension is passed to `\vskip`/`\hskip`.
|
||||
|
||||
`\textwidth` (160mm), `\textheight` (247mm), `\linewidth`, and
|
||||
`\columnwidth` are provided as fixed defaults for the A4 content box, so
|
||||
`\parbox{\textwidth}` and `\rule{\textwidth}{1pt}` work; they are not
|
||||
geometry-aware yet (a changed page size or margin keeps these defaults).
|
||||
`\textwidth`, `\textheight`, `\linewidth`, and `\columnwidth` are live
|
||||
named length registers updated from the page size and geometry, so
|
||||
`\parbox{\textwidth}` and `\rule{\textwidth}{1pt}` follow the current text
|
||||
block. The mm-to-TeX-point conversion differs from TeX by about 0.4%.
|
||||
|
||||
`\smallbreak`, `\medbreak`, `\bigbreak` add the corresponding skip (the
|
||||
encouraged page break itself is not inserted yet). `\tableofcontents`,
|
||||
`\listoffigures`, and `\listoftables` are accepted as no-ops because contents
|
||||
lists are not generated yet.
|
||||
`\listoffigures`, and `\listoftables` generate a heading followed by one
|
||||
entry per numbered section or captioned figure/table; page numbers are filled
|
||||
in after pagination. Entries use infinite glue for right-aligned page numbers
|
||||
rather than dotted leaders.
|
||||
|
||||
Vertical skips are active: `\smallskip`, `\medskip`, and `\bigskip` map to
|
||||
3pt/6pt/12pt `\vskip` glue, and `\addvspace{...}` forwards its argument to
|
||||
@@ -282,26 +420,55 @@ block.
|
||||
The `center` environment is a block: its content wraps at the text width and
|
||||
every line is centered without justification (natural spaces), so
|
||||
`\begin{center}\url{...}\end{center}` and centered short text match LaTeX.
|
||||
`\centering` inside a paragraph is still a no-op.
|
||||
`\centering`, `\raggedright`, and `\raggedleft` are paragraph-level
|
||||
declarations: the affected runs use natural space widths, the declaration is
|
||||
scoped by groups and the matching environments, centered lines are offset by
|
||||
half the leftover width, and ragged-left/right lines are not stretched to the
|
||||
margin.
|
||||
|
||||
`\rule[raise]{width}{height}` is rendered as a filled rectangle in both the
|
||||
PDF and the SVG preview, including raised and dropped rules; a zero-thickness
|
||||
rule reserves space without painting ink. `\fbox{...}` is an inline framed box:
|
||||
rule reserves space without painting ink. PDF rectangles are native path operators
|
||||
(vendored genpdf `fill_rect`/`draw_rect`), so rules and frames no longer create
|
||||
image XObjects. `\fbox{...}` is an inline framed box:
|
||||
the content is measured as a single unbreakable unit, wrapped in 3pt padding and
|
||||
a 0.4pt frame, and painted in both the PDF and the SVG preview.
|
||||
|
||||
Known gaps for full document classes: base font-size class options
|
||||
(`10pt`/`11pt`/`12pt`) are parsed but the engine still uses 11pt;
|
||||
custom `\maketitle` implementations are ignored (the engine title layout is
|
||||
used), `\parbox`/`\minipage` are block-level rather than inline, `\vbox` and
|
||||
`\vtop` map to a full-width block box rather than true nested VBox material, and
|
||||
the abstract prints as body text without an "Abstract" heading.
|
||||
Base font-size class options `10pt`, `11pt`, and `12pt` now set the body
|
||||
size and propagate through headings, title material, lists, tables, block
|
||||
boxes, footnotes, and the default paragraph indent. The article default is
|
||||
`10pt`, matching LaTeX.
|
||||
A document-level `\renewcommand{\maketitle}` replaces the engine title block.
|
||||
Journal classes that distribute front matter through commands such as
|
||||
`\author`, `\affil`, `\abstract`, and `\keywords` are captured as structured
|
||||
metadata. The `sn-jnl` class then renders a journal title block: centered title,
|
||||
numbered author lines with affiliation marks, affiliation list, e-mail line,
|
||||
abstract, and keywords. Class-internal `\maketitle` layout is still not
|
||||
executed; the engine builds the block from the captured metadata.
|
||||
|
||||
When a document loads `arxiv.sty`, the engine switches to a native preprint
|
||||
title style: top/bottom title rules, small-caps title with inline emphasis
|
||||
preserved (e.g. the italic `arxiv` in the class example), `\undertitle`,
|
||||
two-column author blocks with affiliations and monospaced e-mail addresses,
|
||||
a long date, and `\thispagestyle{empty}` on the first page. Class and package
|
||||
files that replace `\maketitle` itself are still ignored, so box-level
|
||||
template code cannot break the native layout. Ordinary text is now placed on
|
||||
a TeX baseline grid (1.2em line height, 0.8em ascent) instead of the fallback
|
||||
TrueType font's larger ascent/descent, which matches LaTeX line spacing and
|
||||
page breaks. Known gaps for full document classes: `\parbox`/`\minipage` are
|
||||
block-level rather than inline, and `\vbox`/`\vtop` capture vertical
|
||||
material but do not form an independent natural-width box with its own
|
||||
baseline.
|
||||
|
||||
`\footnote{...}` captures its content, emits a superscript marker, reserves
|
||||
space on the page where the paragraph ends, and paints the notes with a
|
||||
separator rule at the bottom of the page. `\thanks{...}` is a footnote in the
|
||||
title or author block and is painted at the bottom of the first page. Footnotes
|
||||
inside captions, floats, or arbitrary boxes are not collected yet.
|
||||
separator rule at the bottom of the page. Footnote lines are painted in body
|
||||
coordinates so they stay below the text block rather than overlapping it.
|
||||
`\thanks{...}` is a footnote in the title or author block and is painted at
|
||||
the bottom of the first page. Its measured height is reserved before body
|
||||
placement, so the last body line stays above the footnote area. Footnotes
|
||||
inside figure and table captions are collected and follow the caption's page;
|
||||
footnotes inside floats or arbitrary boxes are not collected yet.
|
||||
|
||||
Basic `\input{file}` imports are read relative to the main `.tex` file. Imported
|
||||
files participate in source mapping and frontend cache invalidation. Local style
|
||||
@@ -318,23 +485,42 @@ platform path separator for multiple directories). A local style can use
|
||||
local package options, arbitrary TeX code, and the full LaTeX package ecosystem
|
||||
are not implemented. These LaTeX command
|
||||
definitions support up to nine parameters, including one optional first
|
||||
parameter with a default value. Unknown packages fail with a clear error.
|
||||
parameter with a default value. Unknown packages fail with a clear error. Hyperlinks (`\href`, `\url`, and
|
||||
resolved citations) use hyperref's green link colour; `\orcidlink{id}`
|
||||
renders the bundled official ORCID logo (2.2 mm) linked to `orcid.org`. Visible `\url` text also
|
||||
emits a real PDF `/Link` URI annotation; `\href` and ORCID-name links still
|
||||
need their target URL carried through the document model.
|
||||
|
||||
`\includegraphics` embeds PNG, JPEG, or BMP files relative to the `.tex` file.
|
||||
`\includegraphics` embeds PNG, JPEG, or BMP files relative to the `.tex` file, with `width=`/`height=`/`scale=`/`keepaspectratio` sizing.
|
||||
It supports `width`, `height`, and `scale`; width and height accept physical
|
||||
units or fractions of `\linewidth`. Images with transparency are not supported
|
||||
by the current PDF dependency. Basic `tabular` rows become equal-width PDF
|
||||
columns; `l`, `c`, `r`, and paragraph (`p{...}`) columns are supported, as are
|
||||
full-width `\hline` and `booktabs` rules. Spanning cells, partial `\cline` rules,
|
||||
and multi-page table headers are not implemented. `\label`, `\ref`, and `\cite`
|
||||
by the current PDF dependency. `tabular` rows use natural column widths
|
||||
(content width plus 6pt `\tabcolsep`), are centered in the text block, and draw
|
||||
`\hline`/`\booktabs` rules exactly over the table columns; `l`, `c`, `r`, and
|
||||
paragraph (`p{...}`) columns are supported. `\multicolumn{n}{align}{...}`
|
||||
spans columns, `\cmidrule(r){a-b}` and `\cline{a-b}` draw partial rules over
|
||||
a column range, and spanning cells distribute their width over the covered
|
||||
natural columns; the resulting width matches the reference XeLaTeX output.
|
||||
In route-D, `\halign`/`\calign` sources support `l`/`c`/`r`/`p{width}` cells, explicit `\tabskip`, `@{}`/`@{\hspace{...}}` column expressions, `\noalign{\vskip ...}` row glue, booktabs rule weights (`\toprule`/`\bottomrule` 0.8pt, `\midrule`/`\cmidrule` 0.5pt) with `\cmidrule(lr){a-b}` trims and ranges, row-level page splitting that repeats the column widths, longtable head/foot sections (`\endfirsthead`/`\endhead`/`\endfoot`/`\endlastfoot`) whose continuation chunks repeat the head rows and paint the foot block once, and LaTeX `tabular` and `longtable` sources mapped onto the same alignment path, where `\multicolumn{n}{align}{...}` cells span columns with the requested alignment and `\cline{a-b}` draws partial 0.4pt rules. Figures honor `[htbp]`
|
||||
placement hints (`[t]` is deferred to the top of the next page, `[b]` to the
|
||||
page bottom, `[p]` to a float page, `[h]` stays in the flow); a standalone
|
||||
`\vspace{...}` between paragraphs becomes vertical glue with its `plus`/`minus`
|
||||
parts; tables honor
|
||||
`[t]` by deferring the caption and rows to the next page, `[b]` at the page
|
||||
bottom, and `[p]` with a float page. `\label`, `\ref`, and `\cite`
|
||||
resolve section, figure, table, and bibliography numbers. `\bibliography{file}`
|
||||
reads a local `.bib` file (the `.bib` extension is optional) and formats common
|
||||
author/editor, title, journal, booktitle, volume, number, pages, publisher,
|
||||
institution, school, organization, edition, address, month, note, and year fields.
|
||||
BibTeX `@string` macros and single-level `crossref` inheritance are supported.
|
||||
Manual `thebibliography` entries also work. Custom `.bst` sorting and formatting,
|
||||
author-year citation styles, page-number references, and automatic table of
|
||||
contents are not implemented.
|
||||
Manual `thebibliography` entries also work. Documents loading `natbib` or
|
||||
`arxiv.sty` render `\citet`/`\citep` as author-year citations, format `.bib`
|
||||
entries in plainnat order (`First Last`, `In ...`, `pages`, publisher/year),
|
||||
add deterministic year suffixes (`2014a`, `2014b`) when several entries share
|
||||
an author and year, indent continuation lines in the plainnat hanging style,
|
||||
and omit numeric bibliography labels; other documents keep
|
||||
numeric citations. Custom `.bst`
|
||||
sorting/formatting and page-number references (`\pageref`) are not implemented.
|
||||
|
||||
A paragraph starts with the current `\parindent` (17pt by default); the
|
||||
indent is recorded per paragraph and follows group scoping, `\setlength`,
|
||||
@@ -354,7 +540,7 @@ binary operators, and punctuation. Fractions, scripts, roots, and delimiters
|
||||
remain indivisible math boxes. Rust paints ordinary paragraph lines at their
|
||||
measured baselines and applies the line breaker's adjusted word spaces. For
|
||||
documents with no title block and only plain paragraphs and headings, Rust
|
||||
builds the vertical list, chooses page breaks, and assigns line positions;
|
||||
paginates and assigns line positions in one positioned-layout pass;
|
||||
`genpdf` paints those line boxes at the planned coordinates. Mixed-content
|
||||
documents still use `genpdf` for page composition. This fixed-spacing subset is
|
||||
an initial page-building slice, not full TeX page building. Display math
|
||||
@@ -397,6 +583,25 @@ variant for delimiters and large display operators, and builds taller glyphs
|
||||
from the font's MATH assembly parts. `\\left...\\right` target sizing follows
|
||||
the assignable TeX parameters `\\delimiterfactor` (default 901) and
|
||||
`\\delimitershortfall` (default 5pt), including local and global assignments.
|
||||
|
||||
Route-D text faces follow the NFSS declarations and compose with the surrounding run: `\sffamily\bfseries` selects cmssbx10, `\sffamily\itshape` selects cmssi10, and bold italic sans substitutes cmssbx10 because Computer Modern has no sans bold italic. `\scshape`/`\textsc` select the real cmcsc10 small-caps face, `\slshape`/`\textsl` use cmsl10 (or cmbxsl10 when bold) rather than the italic cmti10, and `\ttfamily\itshape` reaches cmitt10. All twelve text programs (cmr10, cmbx10, cmti10, cmbxti10, cmtt10, cmss10, cmssbx10, cmssi10, cmcsc10, cmsl10, cmbxsl10, cmitt10) are embedded as Type1 outlines. Characters outside a program's encoding fall back per glyph to a Liberation subset, so the ASCII letters of an accented word still use Computer Modern and Greek text keeps its Unicode text under PDF extraction, including capital Omega, because the embedded Type1 faces carry a ToUnicode CMap built from the requested characters rather than relying on glyph names. Accent commands such as `\'`, `` \` ``, `\"`, `\^`, `\~`, `\c`, `\v` and `\=` compose precomposed Unicode letters and fall back to the base letter plus a combining mark. `\textsuperscript` and `\textsubscript` set a 70% run raised or lowered by 0.4em. `\MakeUppercase` and `\MakeLowercase` (also `\uppercase`/`\lowercase`) transform their braced text while keeping the surrounding face. Because Computer Modern has no bold small caps, a bold small-caps request falls back to cmbx10. A `\textcolor{name}{...}` run paints in one of the standard named colours in both the SVG preview and the PDF, and a leading `\\color{name}` switch colours the rest of its paragraph (`\definecolor` supports rgb, RGB, gray, HTML and cmyk models, `\pagecolor{name}` fills the page background, a `name!percent!other` spec mixes two named colours linearly, the second defaulting to white, and `\hypersetup{urlcolor=...}` colours `\href` labels, and `\colorbox{name}{...}` paints a filled rectangle behind its text, and `\fcolorbox{frame}{background}{...}` draws a 0.4pt frame around that rectangle, while `\fbox{...}` draws the same frame without a background).. Section-wide declarations such as `\bfseries` apply from where they appear to the end of their group, and `\em` toggles emphasis relative to the surrounding face. Paragraph base sizes come from `\fontsize{<size>}{<baselineskip>}` and the article size commands (`\tiny` through `\Huge`), scaling glyph metrics and the default interline glue while the measure, indentation and authored skips stay absolute. The class options `10pt`/`11pt`/`12pt` on `\documentclass[...]` set the default base size (and article `\baselineskip` of 12pt/13.6pt/14.5pt), and `\linespread{factor}` (or `\renewcommand{\baselinestretch}{factor}`) scales that baseline; a size command inside a paragraph overrides the class default and keeps its own glyph size in that run. Inline math inside a styled run keeps its math face while the surrounding text retains its style. The paragraph measure follows `\textwidth`/`\hsize` (or `\setlength{\textwidth}{...}`), and `\setlength` accepts the other supported layout lengths, including a `\parskip` with plus/minus glue; a counter declared with `\newcounter{name}` starts at zero and can be changed by `\setcounter`/`\addtocounter`, and a length declared with `\newlength{\name}` can be set by `\setlength{\name}{...}` and then used as the value of a later `\setlength{\parindent}{\name}`, and `\addtolength{\name}{...}` adds to such a length, so class code that stores its dimensions in named lengths takes effect. The `geometry` package's `margin`/`hmargin`/`vmargin`/`left`/`right`/`top`/`bottom`/`textwidth`/`textheight` options (or `\geometry{...}`) are applied to the page measure and height; other package code is not executed. Block environments `center`, `flushleft` and `flushright` set the paragraph alignment, and aligned short lines are centring/flushing within the full measure rather than at the natural line width. A leading `\noindent` starts its paragraph flush with the measure. Page numbers print centred below the text block, `\setcounter{page}` offsets the printed number, `\addtocounter{page}` shifts it (`\pagenumbering` resets it to 1), and `\pagenumbering{roman|Roman|alph|Alph|arabic}` changes their format and `\pagestyle{empty}` suppresses them on every page and `\thispagestyle{empty}` on the first page. `\hypersetup{pdftitle=...}` writes the PDF Info dictionary (title, author, subject and keywords, UTF-16BE for non-ASCII text), each numbered heading becomes a PDF bookmark nested by heading level, `\title`, `\author` and `\date` are captured from the preamble, `\today` expands to the current date, and `\maketitle` expands into a centered title block at the article class sizes (using today's date when `\date` is absent and none for `\date{}`). `\section`, `\subsection`, `\subsubsection`, `\paragraph` and `\subparagraph` advance five-level article counters, prefix their titles with the number, and paint bold at `\Large`/`\large`/Line truncated
|
||||
|
||||
Inline `$...$` and `\(...\)` math is laid out inside 10pt paragraphs (larger sizes keep the delimiters literal). `\newcommand`/`\renewcommand`/`\DeclareRobustCommand` definitions are captured from the preamble (and `\providecommand` only fills a name that is still undefined) and expanded textually, including numbered arguments and one `[default]` optional first argument; TeX's `\def` parameter texts and `\let` aliases are executed the same way, `\edef`/`\xdef` expand their bodies once at definition time and `\csname...\endcsname` builds the named control sequence, `\expandafter` runs the macro after its prefix once (chained zero-argument prefixes expand in order), and `\newenvironment` definitions wrap their bodies with the declared begin/end material. `\newif` flags select between `\if...\else...\fi` branches, with assignments honoured in the preamble or the body, so class conditionals like `\ifdraft` work, and `\ifdefined\name` tests whether a macro is declared. `\ifnum` compares integers from literals, `\newcount` registers or `\value{counter}`, and `\ifx` compares token meanings (two macros are equal when their parameter text and body match) `\ifcase <n>` chooses the n-th `\or` branch and falls back to `\else` when the value is out of range.. the scratch registers `\dimen0`-`\dimen255` and `\skip0`-`\skip9` hold dimensions and glue with the same assignment and `\advance` forms, and `\count0`-`\count9` take assignments, `\advance`, `\multiply` and `\divide` and print through `\the`/`\number`, while `\newcount\name` declares an integer register whose value `\name= `\dimexpr ... \relax` evaluates `+`, `-`, `*` (by an integer) and `/` over dimensions and `\newdimen` registers and prints through `\the`, while `\glueexpr ... \relax` evaluates glue with `plus`/`minus` components over dimensions and `\newskip` registers, with parenthesised sub-expressions allowed and register operands keeping all three components; `\noexpand\token` keeps the token unexpanded for the current pass (a later pass still expands it), and a later `\def` with the same name replaces the earlier definition The LaTeX internals `\@namedef`, `\@nameuse`, `\@ifundefined`, `\@firstofone`, `\@firstoftwo`, `\@secondoftwo` and `\@empty` expand, and `\@ifstar{yes}{no}` / `\@ifnextchar<token>{yes}{no}` choose from the following token, and `@` counts as a letter in control words so `\makeatletter`-guarded names parse `\numexpr` evaluates `+`, `-`, `*`, `/` and parentheses over integers and integer registers, either standalone or after `\the` `\newskip\name` declares a glue register that `\the\name` prints as `wpt plus spt minus hpt`. `\newdimen\name` declares a dimension register whose value `\name=<dimension>`, `\advance\name by <dimension>`, `\multiply\name by <n>` and `\divide\name by <n>` update and which `\the\name` prints in TeX's `pt` form.......`, `\advance\name by ...`, `\multiply\name by ...` and `\divide\name by ...` update and which `\the\name`/`\number\name` print.
|
||||
|
||||
Route-D integration can also be checked against a real TeX page: `cargo test -p texrra-tex-core --test route_d` includes `route_d_page_matches_pdftex_raster_geometry`, which renders the route-D PDF and a pdfTeX Letter page at the same scaled-point geometry, rasterizes both with `pdftoppm`, and compares ink line count plus left, right, and bottom edges. It is skipped when `pdflatex`/`pdftoppm` are unavailable. `route_d_multiline_bands_track_pdftex` extends that check to a wrapped paragraph: the pixel rows that carry ink form one band per TeX line, and every band top, bottom, left edge and (except for the last line, whose width follows the break point) right edge must land within a couple of pixels of the pdfTeX page.
|
||||
|
||||
Route-D float placement mirrors TeX fractions:
|
||||
|
||||
- `Document::top_fraction_percent` defaults to 70 (`\topfraction`); a taller top float keeps body text off its page.
|
||||
- `Document::bottom_fraction_percent` defaults to 30 (`\bottomfraction`); a bottom float that cannot fit is carried to the next page's bottom while the current page keeps filling, matching TeX's page builder.
|
||||
- `Document::top_number`, `bottom_number` and `total_number` default to TeX's 2, 1 and 12; they cap top floats, bottom floats and all floats on one page.
|
||||
- `Document::float_sep` defaults to 12pt (`\floatsep`); stacked top floats or stacked bottom floats reserve that gap between each other, in full layout and after `Engine::edit`.
|
||||
- `Document::text_float_sep` defaults to 20pt (`\textfloatsep`); a page that carries both floats and body text reserves one such gap between them. `Page::display_list_with_layout(page_goal, text_float_sep)` mirrors that in rendered output, while `display_list_with_goal` keeps the historic no-gap behaviour for callers without document settings.
|
||||
- A `[t]` float that appears while a page is already filling joins the top of that same page (TeX's `\@toplist`): its height plus `\textfloatsep` is charged to that page, so the body stops earlier; only a page break before the float moves it forward.
|
||||
- Floats that start a page sit at the top margin: float material does not consume `\topskip`; only body text does.
|
||||
- `FloatPlacement::Here` keeps an `[h]` float in the body flow: `Document::in_text_sep` (TeX `\intextsep`, default 12pt) separates it from the surrounding text, the float moves to the next page when it does not fit, and it counts against `\totalnumber`. `Page::display_list_with_layout` paints the float at the same flow position the page builder reserved.
|
||||
- `Engine::edit` applies the float fractions, number limits and separations, so incremental layout matches full layout.
|
||||
|
||||
These glyphs are rasterized at
|
||||
600 dpi and shared by PDF and SVG. Ordinary math atom glyphs are rasterized from
|
||||
the selected font face at the same resolution, so PDF and SVG paint the same
|
||||
@@ -413,7 +618,7 @@ the face used to draw each glyph provides it; missing tables and compound
|
||||
expressions keep the default script placement. PDF and SVG share the resulting
|
||||
positions. `\\hat`, `\\widehat`, `\\tilde`, `\\widetilde`, `\\overbrace`,
|
||||
and `\\underbrace` use horizontal MATH variants and assemblies when available,
|
||||
with the same accent bitmap in both outputs.
|
||||
with the same accent bitmap in both outputs. Bitmap accents are painted before the base glyph so their opaque background cannot clip the nucleus.
|
||||
`matrix`, `pmatrix`, `bmatrix`,
|
||||
`Bmatrix`, `vmatrix`, `Vmatrix`, `cases`, `aligned`, `gathered`, `multline`, and
|
||||
`array` environments build a two-dimensional math grid. Matrix delimiters are
|
||||
@@ -457,17 +662,65 @@ document: spacing macros, symbols and letters, NFSS declarations, small caps,
|
||||
advisory breaks, starred `\vspace`/`\hspace`, `center`, `\hrule`, `\fbox`,
|
||||
`\mbox`, and `\parbox`.
|
||||
|
||||
## New-template compatibility
|
||||
|
||||
The SIVP class (`sn-jnl.cls`) loads completely and `sn-article.tex` previews and exports a 14-page PDF; the Huawei E fragment (`projects/e/问题一.tex`) compiles to 16 A4 pages. This required generic TeX conditionals (`\if`, `\ifx`), `\newcount`/`\newdimen`, `\char`, 64-bit dimension scanning, `tabular*`/`tabularx` environments, and the math accent/operator/arrow vocabulary used by both documents. Both are covered by integration tests.
|
||||
|
||||
## Capability matrix (current)
|
||||
|
||||
| Area | Implemented | Remaining |
|
||||
| --- | --- | --- |
|
||||
| Boxes | `\rule`, inline framed `\fbox`, block `\parbox`/`\minipage`, `\vbox`/`\vtop` (as full-width block), inline `\mbox`/`\makebox`, `\raisebox`, `center`, `\hrule` | true nested VBox material |
|
||||
| Boxes | `\rule`, inline framed `\fbox`, block `\parbox`/`\minipage`, `\vbox`/`\vtop` (vertical material capture), inline `\mbox`/`\makebox`, `\raisebox`, `center`, `\hrule` | independent VBox natural width/baseline |
|
||||
| Fonts | serif/sans/mono faces, bold/italic/mono/sans declarations, group scoping, true scaled small caps | — |
|
||||
| Paragraphs | Knuth-Plass breaking, TeX hyphenation, justification, centering, `\parindent` (17pt default), `\hfill`/`\hfil` | `\raggedright`/`\raggedleft` |
|
||||
| Notes/floats | footnotes with page-bottom insertion area, title/author `\thanks` | figure/table floats |
|
||||
| Pages | A4/Letter/... page sizes, margins/geometry, automatic pagination, `\newpage`, `\pagebreak` | headers/footers (`fancyhdr`), unified planner/renderer |
|
||||
| Classes/packages | built-in + local classes, option protocol, local package options | base font-size options (10/11/12pt) |
|
||||
| Live preview | incremental paragraph/page caches, page-hash diffing, SVG refresh | — |
|
||||
| Paragraphs | Knuth-Plass breaking, TeX hyphenation, justification, `\centering`/`\raggedright`/`\raggedleft`, `\parindent` (17pt default), `\hfill`/`\hfil` | — |
|
||||
| Notes/floats | footnotes with page-bottom insertion area, title/author `\thanks`, figure `[htbp]` placement (deferred top floats, bottom/page/here), table `[t]`/`[b]`/`[p]` placement | table float-page queues, `\textfraction` |
|
||||
| Contents | `\tableofcontents`, `\listoffigures`, `\listoftables` generated from numbered headings and captions, dotted leaders, page numbers resolved after pagination | per-chapter book/report contents |
|
||||
| Pages | A4/Letter/... page sizes, margins/geometry, automatic pagination, `\newpage`, `\pagebreak`, plain/fancy page styles, `\thispagestyle`, fancyhdr L/C/R headers and footers | — |
|
||||
| Links | `\href`, `\url`, hyperref-green link text, `\orcidlink{id}` green `iD` badge, clickable PDF `/Annots` URI annotations for visible URLs, `\href` labels, and ORCID author badges | — |
|
||||
| Classes/packages | built-in + local classes, option protocol, local package options, base font sizes 10/11/12pt, chapter headings and numbering, chapter page breaks, document-level custom `\maketitle`, native arxiv-style preprint title blocks (rules, `\undertitle`, author columns, long date) | class-specific formatting beyond chapter breaks |
|
||||
| Live preview | incremental paragraph cache, page-hash diffing, SVG refresh | — |
|
||||
|
||||
The compatibility layer also covers spacing macros, text symbols/letters, style
|
||||
commands, break advisories, and document metadata; see the sections above.
|
||||
|
||||
|
||||
PDF-only figures are rendered as placeholders sized from the source PDF page aspect ratio (until native PDF page embedding lands).
|
||||
|
||||
|
||||
Numeric bibliographies render authors as Surname, I. rather than full given names.
|
||||
|
||||
|
||||
## Route D experimental core
|
||||
|
||||
`crates/texrra-tex-core` is the start of a TeX-compatible incremental layout
|
||||
core. It does not embed pdfTeX/XeTeX/Tectonic; it is a new Rust engine designed
|
||||
around page-boundary checkpoints and page-hash diffing. M0 implements vertical
|
||||
boxes/glue, a simple page builder, serializable checkpoints and a page-local
|
||||
edit demo. M1 adds the horizontal box/glue/penalty model, an item-stream Knuth-Plass-style
|
||||
paragraph builder, CMR10 metrics extracted from `cmr10.tfm`, and a matching pdfTeX line-break fixture. Paragraphs are split at line
|
||||
boundaries when they cross a page, and the pdfLaTeX oracle covers the
|
||||
90-240pt measure matrix plus register, `\hangindent`/`\parshape`,
|
||||
`\parfillskip`, sentence-spacing with custom `\sfcode`,
|
||||
`\spaceskip`/`\xspaceskip`, `\looseness` and vertical-glue fixtures. Overflowing
|
||||
insertion material is split at item boundaries, with the tail held over to the
|
||||
next page. The production v1 engine remains the
|
||||
default until the new core reaches layout parity. See `docs/TEX_CORE.md`. The complete phased plan (P0 oracle harness, TeX-exact paragraphs,
|
||||
page builder and `\\output`, `\\halign`, math, Computer Modern fonts, class
|
||||
execution, service and incrementality targets) is in
|
||||
[`docs/ROUTE_D_PLAN.md`](docs/ROUTE_D_PLAN.md).
|
||||
|
||||
The first M7 service integration is available as `POST /api/route-d/preview`, with PDF export at `POST /api/route-d/pdf`.
|
||||
It accepts blank-line-separated source with a small `\section`/`\textbf`/`\emph`/display-math/list subset, lays it out with the route-D page
|
||||
builder, and returns the v1-compatible preview shape plus per-page hashes and
|
||||
SVG. Route-D paragraphs are laid out with CMR10 advances, kerns and ligatures; runs of two or three hyphens become en/em dashes, the breaker follows TeX's `\pretolerance`/`\tolerance`/`\emergencystretch` passes with demerits (falling back to TeX's overfull fill when no feasible break exists), and the PDF `/W` array reports the same advances, so extracted text keeps word boundaries. Non-final lines bake their justification into the glue widths, so the PDF and the SVG preview are flush to the measure instead of showing natural spaces; with `\raggedright` (`ParagraphStyle::ragged_right`) lines keep their natural widths and fill greedily, because `\rightskip` carries an infinite `fil`. Interline spacing follows TeX (`\baselineskip` unless `\lineskiplimit` forces `\lineskip`), and `Document::par_skip` adds `\parskip` between paragraph units. `page::PageBuilder` selects page breaks by TeX's badness-plus-penalty cost, including glue setting with TeX orders (normal/`\vfil`/`\vfill`/`\vfilll`), `\topskip` and `Document::max_depth` (`\maxdepth`, with each paragraph's last-line descent exposed as `\pagedepth` and only the part beyond `\maxdepth` added to the page height), and breaks ties toward the later breakpoint (TeX's `<=` update), shipping the least overfull break only when nothing fits; `Engine::layout_paged` exposes it for documents of box/glue/penalty/mark/float/insertion units, expanding each paragraph into one node per line with a zero-width interline breakpoint, and route-D previews and PDFs run through it; insertion classes are placed through the same builder, with per-class limits, held-over material and `Document::split_top_skip` (`\splittopskip`, default 10pt) at the top of each continuation, with `Document::split_max_depth` (`\splitmaxdepth`, `\maxdimen` by default) clamping the first continued box's depth and moving the excess into its height, while `Engine::layout` keeps the scrolling builder as the non-paged fallback; paged layouts replay edits from the edited page, falling back to a full rebuild when insertions or an `\output` routine are present. `Document::output_routine` runs an interpreted `\output` program (`\shipout\box255`, `\relax`, `\message`, `\ifdim`, `\ifnum` and `\ifodd` over page registers; `\pageno`, `\outputpenalty`, `\deadcycles`, `\vbadness` (the break's badness) and `\insertpenalties` (insertion items held over) are readable, and each page fragment records the penalty that broke it and how much stretch each glue order carries, so `\pagefilstretch`, `\pagefillstretch` and `\pagefilllstretch` are readable) over those paged fragments, so a routine can drop pages it does not ship, or ship only the pages it wants based on the break penalty or page number. Embedded text fonts are subset per document to the glyphs actually used (retaining glyph IDs and composite components), and each subset carries a ToUnicode CMap covering its used characters. `Document::h_offset` and `v_offset` (`\hoffset`/`\voffset`) shift the exported
|
||||
page body through `pdf::PageOrigin`, leaving the sheet size unchanged, while
|
||||
`Document::paper_width`/`paper_height` (`\paperwidth`/`\paperheight`, default US
|
||||
Letter) set the MediaBox and the preview page box; the route-D endpoints read
|
||||
leading `\hoffset`/`\voffset`/`\paperwidth`/`\paperheight` dimension
|
||||
assignments from the submitted source. Page marks collected by `\mark` are exposed through
|
||||
`Engine::top_mark`, `first_mark` and `bot_mark` with TeX's carry-forward rules.
|
||||
`Document::insertion_classes` caps each insertion class to a page fraction and defers overflow to the next page (the paged builder applies the same limits and carries overflow onto dedicated pages), and `InsertionClass::multiplier` applies TeX's `\count<number>` reserve factor; `Document::insertion_skip` models `\skip\footins` once per page before the first insertion class, and `InsertionClass::skip` overrides it for one class. `Engine::layout_paged` feeds the same material through `page::PageBuilder`, which places top floats at the head of a page, defers a late float, reserves `Document::text_float_sep` above the body and applies the insertion class limits; bottom floats sit at the page bottom with `Document::float_sep` between them and a `Document::bottom_fraction_percent` cap, while in-text floats flow inline with their `Document::in_text_sep` gaps counted as body height. Vertical glue is set after the break: `Document::ragged_bottom` defaults to TeX's `\raggedbottom`, and setting it false applies `\flushbottom`, stretching `StretchGlue` so the page body reaches the goal; glue of the highest order with stretch absorbs the whole setting, so `\vfil` makes short pages free. `POST /preview` and the project APIs now default to route-D with a v1 fallback; `?engine=v1` (or `TEXRRA_ENGINE=v1`) forces the old pipeline.
|
||||
|
||||
Project previews and PDFs default to the new core (`POST /api/projects/{id}/preview` without a query); `?engine=v1` or `TEXRRA_ENGINE=v1` forces the old v1 pipeline. An explicit `?engine=` always wins for both previews and PDFs. The web client exposes this as the `引擎: v1` / `引擎: Route-D` toggle in the preview toolbar; the choice is stored in `localStorage` and switches both the preview request and `POST /api/projects/{id}/pdf`, since the PDF handler honors the same `engine=route-d` query. Route-D project previews keep a session, so an unchanged source reports zero recomputed pages, and route-D PDF exports reuse an eight-entry cache keyed by the expanded source (`X-Texrra-Cache: hit`), and the flat `/api/route-d/preview` and `/api/route-d/pdf` endpoints memoise the last 32 previews and eight PDFs by source hash; text edits and structural edits with an unchanged paragraph prefix rebuild from the first difference through `Engine::relayout_from`, reusing the sealed pages before it, while edits without a reusable prefix fall back to a full layout. `POST /api/route-d/edit/{unit}` applies one paragraph edit to the last route-D
|
||||
document and returns the same page list plus `changedPages` and
|
||||
`recomputedPages`, exposing the checkpoint/page-hash diff from the core.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -55,6 +55,43 @@ impl Default for PageSize {
|
||||
}
|
||||
}
|
||||
|
||||
/// Layout style for the document title block.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub enum TitleStyle {
|
||||
/// The generic article title: title, author, date, no rules.
|
||||
#[default]
|
||||
Article,
|
||||
/// Preprint-style title block with rules, an undertitle, and author columns.
|
||||
Preprint,
|
||||
/// Journal-style title block: title, author/affiliation columns, abstract,
|
||||
/// and keywords.
|
||||
Journal,
|
||||
}
|
||||
|
||||
/// One author block in a structured front matter.
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
pub struct AuthorBlock {
|
||||
pub runs: Vec<Run>,
|
||||
/// One-based affiliation indices attached to this author.
|
||||
pub affiliations: Vec<usize>,
|
||||
pub email: Option<String>,
|
||||
/// Author marked with `*` (corresponding author).
|
||||
pub corresponding: bool,
|
||||
}
|
||||
|
||||
/// One numbered affiliation in a structured front matter.
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
pub struct Affiliation {
|
||||
pub index: usize,
|
||||
pub runs: Vec<Run>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct CitationMetadata {
|
||||
pub author: String,
|
||||
pub year: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Footnote {
|
||||
pub number: u32,
|
||||
@@ -64,39 +101,162 @@ pub struct Footnote {
|
||||
#[derive(Clone)]
|
||||
pub struct DocumentModel {
|
||||
pub title: String,
|
||||
/// Rich title runs, preserving inline emphases such as .
|
||||
pub title_runs: Vec<Run>,
|
||||
pub author: String,
|
||||
pub date: String,
|
||||
/// Style selected by the document's class/package layer.
|
||||
pub title_style: TitleStyle,
|
||||
/// Optional line printed under the title rules, e.g. "A Preprint".
|
||||
pub undertitle: Option<String>,
|
||||
/// Short title from `\title[short]{long}`.
|
||||
pub short_title: Option<String>,
|
||||
/// Structured author blocks from `\author` / `\affil` / `\email`.
|
||||
pub authors: Vec<AuthorBlock>,
|
||||
/// Numbered affiliations from `\affil[n]{...}`.
|
||||
pub affiliations: Vec<Affiliation>,
|
||||
/// Body of `\abstract{...}` captured for journal title blocks.
|
||||
pub abstract_runs: Vec<Run>,
|
||||
/// Body of `\keywords{...}` captured for journal title blocks.
|
||||
pub keywords: Vec<Run>,
|
||||
pub page: PageSize,
|
||||
pub parindent: common::Scaled,
|
||||
/// Base font size selected by the document class (10, 11, or 12pt).
|
||||
/// Number of text columns (1 for article, 2 for `iicol`/`twocolumn`).
|
||||
pub columns: u8,
|
||||
pub base_font_size: u8,
|
||||
pub margins: PageMargins,
|
||||
pub show_title: bool,
|
||||
pub blocks: Vec<Block>,
|
||||
pub block_sources: Vec<Option<SourceLocation>>,
|
||||
pub labels: HashMap<String, String>,
|
||||
pub citations: HashMap<String, usize>,
|
||||
pub citation_metadata: HashMap<String, CitationMetadata>,
|
||||
/// Display text -> hyperlink URL for `\href` annotations.
|
||||
pub link_targets: HashMap<String, String>,
|
||||
pub orcid_urls: Vec<String>,
|
||||
/// Bibliography keys in the order their metadata was declared. Needed to
|
||||
/// assign natbib-style year suffixes (2014a, 2014b, ...) deterministically.
|
||||
pub bibliography_order: Vec<String>,
|
||||
pub author_year_citations: bool,
|
||||
pub footnotes: Vec<Footnote>,
|
||||
pub page_style: PageStyle,
|
||||
pub page_style_overrides: Vec<PageStyleOverride>,
|
||||
}
|
||||
|
||||
impl Default for DocumentModel {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
title: String::new(),
|
||||
title_runs: Vec::new(),
|
||||
author: String::new(),
|
||||
date: String::new(),
|
||||
title_style: TitleStyle::default(),
|
||||
undertitle: None,
|
||||
short_title: None,
|
||||
authors: Vec::new(),
|
||||
affiliations: Vec::new(),
|
||||
abstract_runs: Vec::new(),
|
||||
keywords: Vec::new(),
|
||||
page: PageSize::default(),
|
||||
// article's default \parindent for 10/11pt text.
|
||||
parindent: common::Scaled(17 * 65_536),
|
||||
columns: 1,
|
||||
base_font_size: 10,
|
||||
margins: PageMargins::default(),
|
||||
show_title: false,
|
||||
blocks: Vec::new(),
|
||||
block_sources: Vec::new(),
|
||||
labels: HashMap::new(),
|
||||
citations: HashMap::new(),
|
||||
citation_metadata: HashMap::new(),
|
||||
link_targets: HashMap::new(),
|
||||
orcid_urls: Vec::new(),
|
||||
bibliography_order: Vec::new(),
|
||||
author_year_citations: false,
|
||||
footnotes: Vec::new(),
|
||||
page_style: PageStyle::default(),
|
||||
page_style_overrides: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Page style selected by `\pagestyle`.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub enum PageStyleKind {
|
||||
Empty,
|
||||
/// LaTeX's default: a centered page number in the footer.
|
||||
#[default]
|
||||
Plain,
|
||||
/// fancyhdr-style header/footer declared with `\fancyhead`/`\fancyfoot`.
|
||||
Fancy,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub enum PageDecorationPosition {
|
||||
#[default]
|
||||
Center,
|
||||
Left,
|
||||
Right,
|
||||
}
|
||||
|
||||
/// Header or footer runs for one edge of the page.
|
||||
#[derive(Clone, Default, PartialEq, Eq, Hash)]
|
||||
pub struct PageDecoration {
|
||||
pub left: Vec<Run>,
|
||||
pub center: Vec<Run>,
|
||||
pub right: Vec<Run>,
|
||||
}
|
||||
|
||||
impl PageDecoration {
|
||||
pub fn slot_mut(&mut self, position: PageDecorationPosition) -> &mut Vec<Run> {
|
||||
match position {
|
||||
PageDecorationPosition::Left => &mut self.left,
|
||||
PageDecorationPosition::Center => &mut self.center,
|
||||
PageDecorationPosition::Right => &mut self.right,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.left.is_empty() && self.center.is_empty() && self.right.is_empty()
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
self.left.clear();
|
||||
self.center.clear();
|
||||
self.right.clear();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq, Hash)]
|
||||
pub struct PageStyle {
|
||||
pub kind: PageStyleKind,
|
||||
pub header: PageDecoration,
|
||||
pub footer: PageDecoration,
|
||||
}
|
||||
|
||||
/// A `\thispagestyle` override, anchored at the block it was issued before.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct PageStyleOverride {
|
||||
pub anchor: usize,
|
||||
pub kind: PageStyleKind,
|
||||
}
|
||||
|
||||
/// Marker character used by `\thepage` inside header/footer runs; the page
|
||||
/// renderer substitutes the concrete page number before measuring and painting.
|
||||
/// Private-use marker for a dotted leader in generated contents lines.
|
||||
/// Private-use marker toggling hyperlink paint for the following glyphs.
|
||||
pub const LINK_START_MARKER: char = '\u{F3000}';
|
||||
pub const LINK_END_MARKER: char = '\u{F3001}';
|
||||
|
||||
pub const CONTENTS_LEADER_MARKER: char = '\u{F6000}';
|
||||
|
||||
pub const PAGE_NUMBER_MARKER: char = '\u{F5000}';
|
||||
|
||||
pub fn page_number_marker_text() -> String {
|
||||
PAGE_NUMBER_MARKER.to_string()
|
||||
}
|
||||
|
||||
pub struct ParsedDocument(pub DocumentModel);
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -136,12 +296,18 @@ pub enum Block {
|
||||
rows: Vec<Vec<Vec<Run>>>,
|
||||
caption: Option<Vec<Run>>,
|
||||
alignments: Vec<ColumnAlignment>,
|
||||
rules: Vec<usize>,
|
||||
rules: Vec<TableRule>,
|
||||
/// Per-cell span and alignment metadata, parallel to `rows`.
|
||||
cell_styles: Vec<Vec<TableCellStyle>>,
|
||||
/// Float placement hints from `[htbp]`.
|
||||
placement: String,
|
||||
},
|
||||
Image {
|
||||
path: String,
|
||||
options: String,
|
||||
caption: Option<Vec<Run>>,
|
||||
/// Float placement hints from `[htbp]`.
|
||||
placement: String,
|
||||
},
|
||||
Bibliography(Vec<(String, Vec<Run>)>),
|
||||
/// A box such as `\fbox{...}` (framed) or `\parbox{width}{...}`.
|
||||
@@ -169,13 +335,43 @@ pub enum Block {
|
||||
PageBreak,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum ColumnAlignment {
|
||||
Left,
|
||||
Center,
|
||||
Right,
|
||||
}
|
||||
|
||||
/// Per-cell table metadata: a multicolumn span and an optional local alignment.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub struct TableCellStyle {
|
||||
pub colspan: usize,
|
||||
pub alignment: Option<ColumnAlignment>,
|
||||
}
|
||||
|
||||
/// A horizontal table rule. `end_column` is exclusive; `usize::MAX` means the
|
||||
/// rule spans every column.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct TableRule {
|
||||
pub row: usize,
|
||||
pub start_column: usize,
|
||||
pub end_column: usize,
|
||||
pub trim_left: bool,
|
||||
pub trim_right: bool,
|
||||
}
|
||||
|
||||
impl TableRule {
|
||||
pub fn full(row: usize) -> Self {
|
||||
Self {
|
||||
row,
|
||||
start_column: 0,
|
||||
end_column: usize::MAX,
|
||||
trim_left: false,
|
||||
trim_right: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash)]
|
||||
pub struct ListBlock {
|
||||
pub ordered: bool,
|
||||
@@ -193,6 +389,12 @@ pub struct ListItem {
|
||||
pub enum UnresolvedReference {
|
||||
Label(String),
|
||||
Citation(Vec<String>),
|
||||
/// A textual citation such as natbib's `\citet`, rendered as
|
||||
/// `Author (year)` instead of a parenthetical citation.
|
||||
TextualCitation(Vec<String>),
|
||||
/// A table-of-contents/list page number for the block with this index.
|
||||
/// The target is resolved to a page number during page layout.
|
||||
TocPage(usize),
|
||||
}
|
||||
|
||||
/// Horizontal alignment of a fixed-width inline box.
|
||||
@@ -229,6 +431,20 @@ pub struct RuleBox {
|
||||
pub raise: common::Scaled,
|
||||
/// Thickness of the rule.
|
||||
pub height: common::Scaled,
|
||||
/// Optional fill colour; means the regular black rule.
|
||||
pub color: Option<[u8; 3]>,
|
||||
pub image: Option<String>,
|
||||
}
|
||||
|
||||
/// Paragraph-level alignment requested by `\raggedright` or `\raggedleft`.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub enum ParagraphAlignment {
|
||||
#[default]
|
||||
Justified,
|
||||
RaggedRight,
|
||||
RaggedLeft,
|
||||
Centered,
|
||||
Quote,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash)]
|
||||
@@ -248,8 +464,12 @@ pub struct Run {
|
||||
pub monospace: bool,
|
||||
pub sans: bool,
|
||||
pub small_caps: bool,
|
||||
/// Hyperlink text (rendered in the hyperref link colour).
|
||||
pub link: bool,
|
||||
/// True for the synthetic kern that carries paragraph indentation.
|
||||
pub paragraph_indent: bool,
|
||||
/// Alignment declaration active when this run started its paragraph.
|
||||
pub alignment: Option<ParagraphAlignment>,
|
||||
}
|
||||
|
||||
impl Run {
|
||||
@@ -270,7 +490,9 @@ impl Run {
|
||||
monospace: false,
|
||||
sans: false,
|
||||
small_caps: false,
|
||||
link: false,
|
||||
paragraph_indent: false,
|
||||
alignment: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,6 +2,7 @@ use std::{ops::Range, sync::Arc};
|
||||
|
||||
use crate::{
|
||||
MathClass, MathStyleCommand, TeXGlue,
|
||||
document::ColumnAlignment,
|
||||
math_code::UnicodeMathCode,
|
||||
math_expr::{
|
||||
MathAccent, MathDelimiterGlyph, MathDelimiterSettings, MathExpr, MathFontFamilies,
|
||||
@@ -93,6 +94,8 @@ pub enum FrontendEventKind {
|
||||
ParboxStart {
|
||||
width: common::Scaled,
|
||||
},
|
||||
VBoxStart,
|
||||
VBoxEnd,
|
||||
HorizontalRule {
|
||||
height: common::Scaled,
|
||||
width: Option<common::Scaled>,
|
||||
@@ -108,6 +111,7 @@ pub enum FrontendEventKind {
|
||||
FootnoteStart,
|
||||
FootnoteEnd,
|
||||
MetadataStart(MetadataField),
|
||||
MetadataValue(MetadataField),
|
||||
MetadataEnd(MetadataField),
|
||||
DisplayMathStart,
|
||||
DisplayMathEnd(MathDelimiterSettings),
|
||||
@@ -216,7 +220,17 @@ pub enum FrontendEventKind {
|
||||
RowBreak,
|
||||
ListItem,
|
||||
TableCell,
|
||||
TableCellSpan {
|
||||
colspan: usize,
|
||||
alignment: Option<ColumnAlignment>,
|
||||
},
|
||||
TableRule,
|
||||
TableRuleRange {
|
||||
start_column: usize,
|
||||
end_column: usize,
|
||||
trim_left: bool,
|
||||
trim_right: bool,
|
||||
},
|
||||
HeadingStart {
|
||||
level: u8,
|
||||
numbered: bool,
|
||||
@@ -234,6 +248,56 @@ pub enum FrontendEventKind {
|
||||
Reference(String),
|
||||
Citation(String),
|
||||
BibliographyItem(String),
|
||||
BibliographyMetadata {
|
||||
key: String,
|
||||
author: String,
|
||||
year: String,
|
||||
},
|
||||
PageStyle(crate::document::PageStyleKind),
|
||||
ThisPageStyle(crate::document::PageStyleKind),
|
||||
PageDecorationStart {
|
||||
header: bool,
|
||||
position: crate::document::PageDecorationPosition,
|
||||
},
|
||||
PageDecorationEnd,
|
||||
PageDecorationClear {
|
||||
header: bool,
|
||||
},
|
||||
PageNumber,
|
||||
/// Start of hyperlink material.
|
||||
LinkStart,
|
||||
/// `\href` target: display text and URL, used for PDF annotations.
|
||||
LinkTarget {
|
||||
text: String,
|
||||
url: String,
|
||||
},
|
||||
/// End of hyperlink material.
|
||||
LinkEnd,
|
||||
/// A package or class was loaded from a local file.
|
||||
PackageLoaded(String),
|
||||
/// A separator between author blocks (LaTeX's \And).
|
||||
MetadataSeparator,
|
||||
/// Short title from the optional argument of `\title[short]{long}`.
|
||||
MetadataShortTitle(String),
|
||||
/// Affiliation indices from the optional argument of `\author[1,2]{...}`.
|
||||
AuthorAffiliations(Vec<usize>),
|
||||
/// Start of an `\affil[n]{...}` body.
|
||||
AffiliationStart(usize),
|
||||
AffiliationEnd,
|
||||
/// Start/end of an `\abstract{...}` body captured for the title block.
|
||||
AbstractStart,
|
||||
AbstractEnd,
|
||||
/// Start/end of a `\keywords{...}` body.
|
||||
KeywordsStart,
|
||||
KeywordsEnd,
|
||||
/// Start/end of the e-mail address inside an author block.
|
||||
MetadataEmailStart,
|
||||
MetadataAuthorCorresponding,
|
||||
MetadataEmailEnd,
|
||||
ParagraphAlignment(crate::document::ParagraphAlignment),
|
||||
TableOfContents,
|
||||
ListOfFigures,
|
||||
ListOfTables,
|
||||
GroupStart,
|
||||
GroupEnd,
|
||||
}
|
||||
|
||||
@@ -1,38 +1,92 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::document::{Block, DocumentModel, ListBlock, ParsedDocument, Run, UnresolvedReference};
|
||||
use crate::document::{
|
||||
Block, CitationMetadata, DocumentModel, ListBlock, ParsedDocument, Run, UnresolvedReference,
|
||||
};
|
||||
|
||||
/// Resolves document references after parsing has collected all labels and citations.
|
||||
pub fn resolve(parsed: ParsedDocument) -> DocumentModel {
|
||||
let mut document = parsed.0;
|
||||
fn citation_label(
|
||||
key: &str,
|
||||
citations: &HashMap<String, usize>,
|
||||
metadata: &HashMap<String, CitationMetadata>,
|
||||
author_year: bool,
|
||||
) -> String {
|
||||
if author_year && let Some(entry) = metadata.get(key) {
|
||||
match (entry.author.is_empty(), entry.year.is_empty()) {
|
||||
(false, false) => return format!("{}, {}", entry.author, entry.year),
|
||||
(false, true) => return entry.author.clone(),
|
||||
(true, false) => return entry.year.clone(),
|
||||
(true, true) => {}
|
||||
}
|
||||
}
|
||||
citations
|
||||
.get(key)
|
||||
.map(usize::to_string)
|
||||
.unwrap_or_else(|| key.to_string())
|
||||
}
|
||||
|
||||
fn resolve_runs(
|
||||
runs: &mut [Run],
|
||||
labels: &HashMap<String, String>,
|
||||
citations: &HashMap<String, usize>,
|
||||
metadata: &HashMap<String, CitationMetadata>,
|
||||
author_year: bool,
|
||||
) {
|
||||
for run in runs {
|
||||
let Some(reference) = run.unresolved_reference.take() else {
|
||||
continue;
|
||||
};
|
||||
run.text = match reference {
|
||||
let text = match reference {
|
||||
UnresolvedReference::TocPage(index) => {
|
||||
run.unresolved_reference = Some(UnresolvedReference::TocPage(index));
|
||||
continue;
|
||||
}
|
||||
UnresolvedReference::Label(key) => labels
|
||||
.get(&key)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| "??".to_string()),
|
||||
UnresolvedReference::Citation(keys) => {
|
||||
let formatted = keys
|
||||
.iter()
|
||||
.map(|key| {
|
||||
citations
|
||||
.get(key)
|
||||
.map(usize::to_string)
|
||||
.unwrap_or_else(|| key.clone())
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
format!("[{formatted}]")
|
||||
if author_year {
|
||||
let formatted = keys
|
||||
.iter()
|
||||
.map(|key| citation_label(key, citations, metadata, true))
|
||||
.collect::<Vec<_>>()
|
||||
.join("; ");
|
||||
format!("({formatted})")
|
||||
} else {
|
||||
let formatted = keys
|
||||
.iter()
|
||||
.map(|key| citation_label(key, citations, metadata, false))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
format!("[{formatted}]")
|
||||
}
|
||||
}
|
||||
UnresolvedReference::TextualCitation(keys) => {
|
||||
if author_year {
|
||||
keys.iter()
|
||||
.map(|key| {
|
||||
let label = citation_label(key, citations, metadata, true);
|
||||
match label.rsplit_once(", ") {
|
||||
Some((author, year)) => format!("{author} ({year})"),
|
||||
None => label,
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("; ")
|
||||
} else {
|
||||
let formatted = keys
|
||||
.iter()
|
||||
.map(|key| citation_label(key, citations, metadata, false))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
format!("[{formatted}]")
|
||||
}
|
||||
}
|
||||
};
|
||||
run.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,42 +94,46 @@ pub fn resolve(parsed: ParsedDocument) -> DocumentModel {
|
||||
list: &mut ListBlock,
|
||||
labels: &HashMap<String, String>,
|
||||
citations: &HashMap<String, usize>,
|
||||
metadata: &HashMap<String, CitationMetadata>,
|
||||
author_year: bool,
|
||||
) {
|
||||
for item in &mut list.items {
|
||||
resolve_runs(&mut item.runs, labels, citations);
|
||||
resolve_runs(&mut item.runs, labels, citations, metadata, author_year);
|
||||
for nested in &mut item.nested {
|
||||
resolve_list(nested, labels, citations);
|
||||
resolve_list(nested, labels, citations, metadata, author_year);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let labels = &document.labels;
|
||||
let citations = &document.citations;
|
||||
let metadata = &document.citation_metadata;
|
||||
let author_year = document.author_year_citations;
|
||||
for block in &mut document.blocks {
|
||||
match block {
|
||||
Block::Paragraph(runs) | Block::Heading { runs, .. } => {
|
||||
resolve_runs(runs, labels, citations)
|
||||
resolve_runs(runs, labels, citations, metadata, author_year)
|
||||
}
|
||||
Block::List(list) => resolve_list(list, labels, citations),
|
||||
Block::List(list) => resolve_list(list, labels, citations, metadata, author_year),
|
||||
Block::Table { rows, caption, .. } => {
|
||||
for cell in rows.iter_mut().flatten() {
|
||||
resolve_runs(cell, labels, citations);
|
||||
resolve_runs(cell, labels, citations, metadata, author_year);
|
||||
}
|
||||
if let Some(caption) = caption {
|
||||
resolve_runs(caption, labels, citations);
|
||||
resolve_runs(caption, labels, citations, metadata, author_year);
|
||||
}
|
||||
}
|
||||
Block::Image { caption, .. } => {
|
||||
if let Some(caption) = caption {
|
||||
resolve_runs(caption, labels, citations);
|
||||
resolve_runs(caption, labels, citations, metadata, author_year);
|
||||
}
|
||||
}
|
||||
Block::FramedBox { runs, .. } | Block::Centered { runs } => {
|
||||
resolve_runs(runs, labels, citations)
|
||||
resolve_runs(runs, labels, citations, metadata, author_year)
|
||||
}
|
||||
Block::Bibliography(items) => {
|
||||
for (_, runs) in items {
|
||||
resolve_runs(runs, labels, citations);
|
||||
resolve_runs(runs, labels, citations, metadata, author_year);
|
||||
}
|
||||
}
|
||||
Block::HorizontalRule { .. }
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
[package]
|
||||
name = "texrra-tex-core"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Experimental incremental TeX-compatible typesetting core (route D)"
|
||||
|
||||
[dependencies]
|
||||
flate2 = "1.1"
|
||||
hashbrown = { version = "0.17.2", default-features = false, features = ["raw-entry"] }
|
||||
harfbuzz_rs = "=3.0.1"
|
||||
image = { version = "0.23.12", default-features = false, features = ["bmp"] }
|
||||
lopdf = "0.26"
|
||||
libloading = "=0.8.9"
|
||||
md5 = "0.8"
|
||||
png = "0.18.1"
|
||||
rusttype = "0.8.3"
|
||||
read-fonts = { version = "=0.47.0", default-features = false }
|
||||
rustybuzz = "=0.20.1"
|
||||
skera = { version = "=0.10.0", default-features = false }
|
||||
subsetter = { version = "=0.2.3", default-features = false }
|
||||
unicode-bidi = "=0.3.18"
|
||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||
serde_json = "1.0"
|
||||
sha2 = "=0.10.9"
|
||||
stacker = "=0.1.25"
|
||||
hyphenate = { path = "../../vendor/hyphenate" }
|
||||
unicode-normalization = "=0.1.25"
|
||||
|
||||
[target.'cfg(all(target_os = "linux", target_env = "gnu"))'.dependencies]
|
||||
libc = "0.2"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,14 @@
|
||||
as-so-ciate
|
||||
as-so-ciates
|
||||
dec-li-na-tion
|
||||
oblig-a-tory
|
||||
phil-an-thropic
|
||||
present
|
||||
presents
|
||||
project
|
||||
projects
|
||||
reci-procity
|
||||
re-cog-ni-zance
|
||||
ref-or-ma-tion
|
||||
ret-ri-bu-tion
|
||||
ta-ble
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
[["M554 680H33V649H57C134 649 136 638 136 602V78C136 42 134 31 57 31H33V0C68 3 146 3 185 3C226 3 317 3 353 0V31H320C225 31 225 44 225 79V609C225 642 227 649 274 649H377C520 649 541 590 557 455H582Z","M442 698C435 711 433 716 416 716C399 716 397 711 390 698L52 20C47 11 47 9 47 8C47 0 53 0 69 0H763C779 0 785 0 785 8C785 9 785 11 780 20ZM384 616 653 76H114Z","M721 339C721 543 570 705 388 705C209 705 56 545 56 339C56 134 210 -22 388 -22C570 -22 721 137 721 339ZM389 1C290 1 153 87 153 339C153 596 292 683 388 683C489 683 624 592 624 339C624 84 483 1 389 1ZM567 414H542V380H235V414H210V270H235V304H542V270H567Z","M370 695C364 714 358 716 347 716C331 716 329 712 324 695L132 100C122 70 102 31 32 31V0C65 2 116 3 125 3C154 3 207 1 238 0V31C184 32 161 59 161 83C161 88 161 91 166 105L316 571L474 79C479 65 479 63 479 61C479 31 420 31 394 31V0C429 3 500 3 538 3C577 3 622 1 661 0V31C585 31 582 37 570 74Z","M611 677H55L47 521H72C74 562 77 588 84 599C90 607 151 607 160 607H506C517 607 576 607 582 599C589 588 592 562 594 521H619ZM50 0H616L624 167H599C596 121 595 95 587 81C581 70 529 70 507 70H159C141 70 86 70 79 80C71 93 69 123 67 167H42ZM527 438H502V387H164V438H139V266H164V317H502V266H527Z","M613 602C613 638 615 649 692 649H716V680H33V649H57C134 649 136 638 136 602V78C136 42 134 31 57 31H33V0C68 3 142 3 180 3C218 3 293 3 328 0V31H304C227 31 225 42 225 78V649H524V78C524 42 522 31 445 31H421V0C456 3 530 3 568 3C606 3 681 3 716 0V31H692C615 31 613 42 613 78Z","M372 326C381 336 381 340 381 342C381 347 377 352 374 356L169 652H400C569 652 619 616 640 458H665L637 683H82C58 683 56 683 56 660L305 298L67 27C57 16 57 14 57 11C57 0 67 0 82 0H637L665 236H640C622 69 554 42 397 42H121Z","M433 351C433 446 459 628 591 628C622 628 683 613 690 551C691 542 692 535 705 535C721 535 721 544 721 552C721 612 681 705 590 705C486 705 413 614 389 462H388C381 505 346 705 187 705C96 705 56 612 56 552C56 544 56 535 72 535C86 535 86 543 87 548C95 628 181 628 186 628C324 628 344 431 344 351V79C344 45 344 31 249 31H216V0C252 3 347 3 388 3C429 3 525 3 561 0V31H528C433 31 433 44 433 79Z","M399 135C554 147 665 240 665 341C665 445 551 536 399 548V604C399 638 399 652 494 652H527V683C491 680 399 680 358 680C317 680 224 680 188 683V652H221C316 652 316 639 316 604V548C163 533 56 441 56 342C56 239 167 150 316 135V79C316 45 316 31 221 31H188V0C224 3 316 3 357 3C398 3 491 3 527 0V31H494C399 31 399 44 399 79ZM316 158C174 177 156 279 156 341C156 393 166 505 316 525ZM399 526C537 510 565 418 565 342C565 282 550 175 399 157Z","M427 604C427 638 427 652 522 652H555V683C519 680 427 680 386 680C345 680 252 680 216 683V652H249C344 652 344 639 344 604V160C213 195 208 349 208 414C207 535 163 554 119 554H82C67 554 57 554 57 543C57 538 60 533 66 532C99 528 124 514 125 396C125 373 128 294 176 227C215 173 276 144 344 135V79C344 45 344 31 249 31H216V0C252 3 344 3 385 3C426 3 519 3 555 0V31H522C427 31 427 44 427 79V135C499 144 560 174 599 226C651 297 652 376 652 420C652 436 653 525 707 532C713 533 720 534 720 543C720 554 712 554 696 554H658C619 554 570 547 569 402C568 292 535 186 427 160Z","M677 162H652C647 136 643 113 634 89C629 73 626 65 568 65H488C501 121 532 169 577 235C624 306 665 375 665 454C665 593 530 705 361 705C189 705 56 591 56 454C56 375 97 306 144 235C188 169 220 121 233 65H153C95 65 92 73 87 88C79 111 74 137 69 162H44L77 0H237C259 0 262 0 262 21C262 91 231 179 208 243C187 301 159 380 159 455C159 615 269 683 360 683C456 683 562 611 562 455C562 380 535 304 506 222C491 180 459 90 459 21C459 0 462 0 485 0H644Z","M448 400H563V431H445V547C445 636 493 683 538 683C541 683 556 683 571 676C559 672 541 659 541 634C541 611 557 591 584 591C613 591 628 611 628 635C628 671 593 705 537 705C478 705 434 667 429 663C400 700 344 705 317 705C222 705 106 653 106 545V431H27V400H106V76C106 31 95 31 28 31V0C61 1 114 3 139 3C164 3 213 1 250 0V31C183 31 172 31 172 76V400H382V76C382 31 371 31 304 31V0C343 1 390 3 418 3C458 3 505 3 545 0V31H524C450 31 448 42 448 78ZM169 431V544C169 641 251 683 316 683C365 683 393 664 394 664V663C377 661 357 648 357 620C357 614 358 589 385 580C382 567 382 558 382 546V431Z","M330 400C376 400 383 387 383 346V76C383 31 372 31 305 31V0C338 1 391 3 416 3C441 3 490 1 527 0V31C460 31 449 31 449 76V443L323 434C307 433 306 432 305 432C303 431 301 431 287 431H169V544C169 643 255 683 317 683C347 683 383 673 403 650C362 648 356 620 356 604C356 571 382 558 401 558C424 558 447 574 447 604C447 663 392 705 318 705C225 705 106 654 106 545V431H27V400H106V76C106 31 95 31 28 31V0C61 1 114 3 139 3C164 3 213 1 250 0V31C183 31 172 31 172 76V400Z","M383 400V76C383 31 372 31 305 31V0C338 1 391 3 416 3C441 3 490 1 527 0V31C460 31 449 31 449 76V694L413 688C409 688 408 689 404 691C372 705 331 705 320 705C215 705 106 649 106 545V431H27V400H106V76C106 31 95 31 28 31V0C61 1 114 3 139 3C164 3 213 1 250 0V31C183 31 172 31 172 76V400ZM383 431H169V544C169 637 245 683 319 683C328 683 355 683 383 674C374 670 358 660 358 634C358 616 366 601 383 595Z","M607 400C653 400 660 387 660 346V76C660 31 649 31 582 31Line truncated
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+37
@@ -0,0 +1,37 @@
|
||||
//! M0 demo: a three-paragraph article whose middle paragraph is edited.
|
||||
//!
|
||||
//! Run with `cargo run -p texrra-tex-core --example incremental_article`.
|
||||
//! It prints the page count before/after the edit and the pages that the
|
||||
//! checkpoint replay had to rebuild.
|
||||
|
||||
use texrra_tex_core::{Document, Engine, ParagraphStyle, Unit};
|
||||
|
||||
fn paragraph(id: u64, marker: &str) -> Unit {
|
||||
// Roughly one page of 10pt text at a 300pt page goal.
|
||||
let text = format!("{} {}", marker, "alpha beta gamma delta ".repeat(80));
|
||||
Unit::paragraph_with_style(id, text, ParagraphStyle::default())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let document = Document::new(
|
||||
300,
|
||||
vec![
|
||||
paragraph(1, "ONE"),
|
||||
paragraph(2, "TWO"),
|
||||
paragraph(3, "THREE"),
|
||||
],
|
||||
);
|
||||
let mut engine = Engine::layout(&document);
|
||||
println!(
|
||||
"initial: pages={} changed={:?}",
|
||||
engine.pages().len(),
|
||||
engine.changed_pages()
|
||||
);
|
||||
|
||||
engine.edit(&document, 2, "TWO edited beta gamma delta ".repeat(60));
|
||||
println!(
|
||||
"after edit: pages={} changed={:?}",
|
||||
engine.pages().len(),
|
||||
engine.changed_pages()
|
||||
);
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
//! Emit a small route-D PDF with text, a rule, an image XObject, and a link.
|
||||
//!
|
||||
//! Run with `cargo run -p texrra-tex-core --example pdf_display > /tmp/route-d.pdf`.
|
||||
|
||||
use texrra_tex_core::render::{DisplayItem, DisplayList, FontFace, PdfImage};
|
||||
|
||||
fn main() {
|
||||
let mut list = DisplayList {
|
||||
width: 612 * 65_536,
|
||||
height: 792 * 65_536,
|
||||
items: Vec::new(),
|
||||
images: Vec::new(),
|
||||
magnification: 1000,
|
||||
..Default::default()
|
||||
};
|
||||
list.push(DisplayItem::Text {
|
||||
x: 100 * 65_536,
|
||||
y: 140 * 65_536,
|
||||
size: 12 * 65_536,
|
||||
text: "bold face".to_owned(),
|
||||
font: FontFace::Bold,
|
||||
});
|
||||
list.push(DisplayItem::Text {
|
||||
x: 220 * 65_536,
|
||||
y: 140 * 65_536,
|
||||
size: 12 * 65_536,
|
||||
text: "italic face".to_owned(),
|
||||
font: FontFace::Italic,
|
||||
});
|
||||
list.push(DisplayItem::Text {
|
||||
x: 72 * 65_536,
|
||||
y: 100 * 65_536,
|
||||
size: 12 * 65_536,
|
||||
text: "route-D XObject".to_string(),
|
||||
font: texrra_tex_core::render::FontFace::Roman,
|
||||
});
|
||||
list.push(DisplayItem::Rule {
|
||||
x: 72 * 65_536,
|
||||
y: 120 * 65_536,
|
||||
width: 200 * 65_536,
|
||||
height: 2 * 65_536,
|
||||
});
|
||||
let index = list.add_image(PdfImage {
|
||||
width: 2,
|
||||
height: 2,
|
||||
rgb: vec![255, 0, 0, 0, 255, 0, 0, 0, 255, 255, 255, 0],
|
||||
});
|
||||
list.push(DisplayItem::Image {
|
||||
x: 72 * 65_536,
|
||||
y: 150 * 65_536,
|
||||
width: 40 * 65_536,
|
||||
height: 40 * 65_536,
|
||||
index,
|
||||
});
|
||||
list.link(
|
||||
72 * 65_536,
|
||||
220 * 65_536,
|
||||
120 * 65_536,
|
||||
12 * 65_536,
|
||||
"https://example.com/route-d",
|
||||
);
|
||||
|
||||
let pdf = texrra_tex_core::pdf::display_list_to_pdf(&list, 792 * 65_536);
|
||||
use std::io::Write;
|
||||
std::io::stdout().write_all(&pdf).expect("write pdf");
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
//! Project-owned generated files. Ownership is established by actual writes,
|
||||
//! independent of file names/extensions; content versions remain real inputs.
|
||||
use crate::resources::ResourceVersion;
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
collections::BTreeSet,
|
||||
fs::File,
|
||||
io::{self, Read},
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct GeneratedArtifact {
|
||||
pub producer: PathBuf,
|
||||
/// Last recorded output version, not a promise that external tools haven't edited it.
|
||||
pub version: ResourceVersion,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ArtifactLedger {
|
||||
schema: u32,
|
||||
root: PathBuf,
|
||||
records: Vec<GeneratedArtifact>,
|
||||
}
|
||||
|
||||
impl ArtifactLedger {
|
||||
pub fn storage_key(root: &Path) -> Result<String, String> {
|
||||
if !root.is_absolute() {
|
||||
return Err("artifact project root must be absolute".into());
|
||||
}
|
||||
Ok(format!(
|
||||
"{:x}",
|
||||
Sha256::digest(serde_json::to_vec(root).map_err(|e| e.to_string())?)
|
||||
))
|
||||
}
|
||||
pub fn new(root: PathBuf) -> Self {
|
||||
Self {
|
||||
schema: 1,
|
||||
root,
|
||||
records: Vec::new(),
|
||||
}
|
||||
}
|
||||
pub fn decode(bytes: &[u8], root: &Path) -> Result<Self, String> {
|
||||
let ledger: Self = serde_json::from_slice(bytes)
|
||||
.map_err(|e| format!("invalid generated-file ledger: {e}"))?;
|
||||
ledger.validate(root)?;
|
||||
Ok(ledger)
|
||||
}
|
||||
fn validate(&self, root: &Path) -> Result<(), String> {
|
||||
let mut paths = BTreeSet::new();
|
||||
if self.schema != 1
|
||||
|| self.root != root
|
||||
|| !self.root.is_absolute()
|
||||
|| self.records.iter().any(|r| {
|
||||
!r.producer.is_absolute()
|
||||
|| !r.version.path.is_absolute()
|
||||
|| !paths.insert(&r.version.path)
|
||||
|| r.version.sha256.len() != 64
|
||||
|| !r.version.sha256.bytes().all(|c| c.is_ascii_hexdigit())
|
||||
})
|
||||
{
|
||||
return Err("incompatible generated-file ledger identity or versions".into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn encode(&self) -> Result<Vec<u8>, String> {
|
||||
self.validate(&self.root)?;
|
||||
serde_json::to_vec_pretty(self).map_err(|e| e.to_string())
|
||||
}
|
||||
pub fn owns(&self, path: &Path) -> bool {
|
||||
self.records.iter().any(|r| r.version.path == path)
|
||||
}
|
||||
pub fn paths(&self) -> impl Iterator<Item = &Path> {
|
||||
self.records.iter().map(|r| r.version.path.as_path())
|
||||
}
|
||||
pub fn record(&mut self, producer: &Path, version: ResourceVersion) {
|
||||
self.forget(&version.path);
|
||||
self.records.push(GeneratedArtifact {
|
||||
producer: producer.to_owned(),
|
||||
version,
|
||||
});
|
||||
self.records
|
||||
.sort_by(|a, b| a.version.path.cmp(&b.version.path));
|
||||
}
|
||||
pub fn forget(&mut self, path: &Path) {
|
||||
self.records.retain(|r| r.version.path != path);
|
||||
}
|
||||
}
|
||||
|
||||
/// Policy/version inspection, separate from TeX's semantic input and stream reads.
|
||||
pub fn file_version(path: &Path) -> Result<Option<ResourceVersion>, String> {
|
||||
let mut file = match File::open(path) {
|
||||
Ok(file) => file,
|
||||
Err(e) if e.kind() == io::ErrorKind::NotFound => return Ok(None),
|
||||
Err(e) => return Err(format!("generated-file version {}: {e}", path.display())),
|
||||
};
|
||||
let mut hash = Sha256::new();
|
||||
let mut buffer = [0; 16384];
|
||||
let mut bytes = 0;
|
||||
loop {
|
||||
let count = file
|
||||
.read(&mut buffer)
|
||||
.map_err(|e| format!("generated-file version {}: {e}", path.display()))?;
|
||||
if count == 0 {
|
||||
break;
|
||||
}
|
||||
hash.update(&buffer[..count]);
|
||||
bytes += count as u64;
|
||||
}
|
||||
Ok(Some(ResourceVersion {
|
||||
path: path.to_owned(),
|
||||
sha256: format!("{:x}", hash.finalize()),
|
||||
bytes,
|
||||
}))
|
||||
}
|
||||
@@ -0,0 +1,855 @@
|
||||
//! Computer Modern 10pt metrics backed by the real TFM files.
|
||||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use crate::paragraph::ParagraphFont;
|
||||
use crate::tfm::TfmMetrics;
|
||||
|
||||
/// One Computer Modern text face at 10pt.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub enum Cmr10Metrics {
|
||||
#[default]
|
||||
Roman,
|
||||
Bold,
|
||||
Italic,
|
||||
BoldItalic,
|
||||
Mono,
|
||||
Sans,
|
||||
SansBold,
|
||||
SansItalic,
|
||||
/// Roman small caps (cmcsc10).
|
||||
SmallCaps,
|
||||
/// Roman slanted (cmsl10).
|
||||
Slanted,
|
||||
/// Bold extended slanted (cmbxsl10).
|
||||
BoldSlanted,
|
||||
/// Italic typewriter (cmitt10).
|
||||
MonoItalic,
|
||||
/// Calligraphic capitals from cmsy10 (`\mathcal`).
|
||||
MathCalligraphic,
|
||||
/// Blackboard-bold capitals from msbm10 (`\mathbb`).
|
||||
MathBlackboard,
|
||||
/// Euler Fraktur letters from eufm10 (`\mathfrak`).
|
||||
MathFraktur,
|
||||
/// Math face: italic letters from cmmi10, big operators from cmex10.
|
||||
Math,
|
||||
/// Times Roman text metrics (`ptmr8t.tfm`).
|
||||
TimesRoman,
|
||||
/// Times bold text metrics (`ptmb8t.tfm`).
|
||||
TimesBold,
|
||||
/// Times italic text metrics (`ptmri8t.tfm`).
|
||||
TimesItalic,
|
||||
/// Times bold italic text metrics (`ptmbi8t.tfm`).
|
||||
TimesBoldItalic,
|
||||
}
|
||||
|
||||
static CMR10_TFM: &[u8] = include_bytes!("../assets/cmr10.tfm");
|
||||
static CMBX10_TFM: &[u8] = include_bytes!("../assets/cmbx10.tfm");
|
||||
static CMTI10_TFM: &[u8] = include_bytes!("../assets/cmti10.tfm");
|
||||
static CMBXTI10_TFM: &[u8] = include_bytes!("../assets/cmbxti10.tfm");
|
||||
static CMTT10_TFM: &[u8] = include_bytes!("../assets/cmtt10.tfm");
|
||||
static CMSS10_TFM: &[u8] = include_bytes!("../assets/cmss10.tfm");
|
||||
static CMSSBX10_TFM: &[u8] = include_bytes!("../assets/cmssbx10.tfm");
|
||||
static CMSSI10_TFM: &[u8] = include_bytes!("../assets/cmssi10.tfm");
|
||||
static CMCSC10_TFM: &[u8] = include_bytes!("../assets/cmcsc10.tfm");
|
||||
static CMSL10_TFM: &[u8] = include_bytes!("../assets/cmsl10.tfm");
|
||||
static CMBXSL10_TFM: &[u8] = include_bytes!("../assets/cmbxsl10.tfm");
|
||||
static CMITT10_TFM: &[u8] = include_bytes!("../assets/cmitt10.tfm");
|
||||
static CMMI10_TFM: &[u8] = include_bytes!("../assets/cmmi10.tfm");
|
||||
static CMEX10_TFM: &[u8] = include_bytes!("../assets/cmex10.tfm");
|
||||
static CMSY10_TFM: &[u8] = include_bytes!("../assets/cmsy10.tfm");
|
||||
static MSBM10_TFM: &[u8] = include_bytes!("../assets/msbm10.tfm");
|
||||
static EUFM10_TFM: &[u8] = include_bytes!("../assets/eufm10.tfm");
|
||||
static PTMR8T_TFM: &[u8] = include_bytes!("../assets/ptmr8t.tfm");
|
||||
static PTMB8T_TFM: &[u8] = include_bytes!("../assets/ptmb8t.tfm");
|
||||
static PTMRI8T_TFM: &[u8] = include_bytes!("../assets/ptmri8t.tfm");
|
||||
static PTMBI8T_TFM: &[u8] = include_bytes!("../assets/ptmbi8t.tfm");
|
||||
|
||||
static CMR10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMBX10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMTI10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMBXTI10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMTT10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMSS10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMSSBX10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMSSI10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMCSC10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMSL10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMBXSL10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMITT10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMMI10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMEX10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static CMSY10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static MSBM10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static EUFM10_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static PTMR8T_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static PTMB8T_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static PTMRI8T_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
static PTMBI8T_METRICS: OnceLock<TfmMetrics> = OnceLock::new();
|
||||
|
||||
fn parse(bytes: &[u8]) -> TfmMetrics {
|
||||
TfmMetrics::parse(bytes).expect("embedded TFM must be valid")
|
||||
}
|
||||
|
||||
fn parse_roman() -> TfmMetrics {
|
||||
parse(CMR10_TFM)
|
||||
}
|
||||
|
||||
fn parse_bold() -> TfmMetrics {
|
||||
parse(CMBX10_TFM)
|
||||
}
|
||||
|
||||
fn parse_italic() -> TfmMetrics {
|
||||
parse(CMTI10_TFM)
|
||||
}
|
||||
|
||||
fn parse_bold_italic() -> TfmMetrics {
|
||||
parse(CMBXTI10_TFM)
|
||||
}
|
||||
|
||||
fn parse_mono() -> TfmMetrics {
|
||||
parse(CMTT10_TFM)
|
||||
}
|
||||
|
||||
fn parse_sans() -> TfmMetrics {
|
||||
parse(CMSS10_TFM)
|
||||
}
|
||||
|
||||
fn parse_sans_bold() -> TfmMetrics {
|
||||
parse(CMSSBX10_TFM)
|
||||
}
|
||||
|
||||
fn parse_sans_italic() -> TfmMetrics {
|
||||
parse(CMSSI10_TFM)
|
||||
}
|
||||
|
||||
fn parse_small_caps() -> TfmMetrics {
|
||||
parse(CMCSC10_TFM)
|
||||
}
|
||||
|
||||
fn parse_slanted() -> TfmMetrics {
|
||||
parse(CMSL10_TFM)
|
||||
}
|
||||
|
||||
fn parse_bold_slanted() -> TfmMetrics {
|
||||
parse(CMBXSL10_TFM)
|
||||
}
|
||||
|
||||
fn parse_mono_italic() -> TfmMetrics {
|
||||
parse(CMITT10_TFM)
|
||||
}
|
||||
|
||||
fn parse_math_italic() -> TfmMetrics {
|
||||
parse(CMMI10_TFM)
|
||||
}
|
||||
|
||||
fn parse_math_extension() -> TfmMetrics {
|
||||
parse(CMEX10_TFM)
|
||||
}
|
||||
|
||||
fn parse_math_symbol() -> TfmMetrics {
|
||||
parse(CMSY10_TFM)
|
||||
}
|
||||
|
||||
fn math_italic_metrics() -> &'static TfmMetrics {
|
||||
CMMI10_METRICS.get_or_init(parse_math_italic)
|
||||
}
|
||||
|
||||
fn math_extension_metrics() -> &'static TfmMetrics {
|
||||
CMEX10_METRICS.get_or_init(parse_math_extension)
|
||||
}
|
||||
|
||||
fn math_symbol_metrics() -> &'static TfmMetrics {
|
||||
CMSY10_METRICS.get_or_init(parse_math_symbol)
|
||||
}
|
||||
|
||||
fn parse_blackboard() -> TfmMetrics {
|
||||
parse(MSBM10_TFM)
|
||||
}
|
||||
|
||||
fn math_blackboard_metrics() -> &'static TfmMetrics {
|
||||
MSBM10_METRICS.get_or_init(parse_blackboard)
|
||||
}
|
||||
|
||||
fn parse_fraktur() -> TfmMetrics {
|
||||
parse(EUFM10_TFM)
|
||||
}
|
||||
|
||||
fn parse_times_roman() -> TfmMetrics {
|
||||
parse(PTMR8T_TFM)
|
||||
}
|
||||
|
||||
fn parse_times_bold() -> TfmMetrics {
|
||||
parse(PTMB8T_TFM)
|
||||
}
|
||||
|
||||
fn parse_times_italic() -> TfmMetrics {
|
||||
parse(PTMRI8T_TFM)
|
||||
}
|
||||
|
||||
fn parse_times_bold_italic() -> TfmMetrics {
|
||||
parse(PTMBI8T_TFM)
|
||||
}
|
||||
|
||||
fn math_fraktur_metrics() -> &'static TfmMetrics {
|
||||
EUFM10_METRICS.get_or_init(parse_fraktur)
|
||||
}
|
||||
|
||||
fn metrics_for(font: Cmr10Metrics) -> &'static TfmMetrics {
|
||||
match font {
|
||||
Cmr10Metrics::Roman => CMR10_METRICS.get_or_init(parse_roman),
|
||||
Cmr10Metrics::Bold => CMBX10_METRICS.get_or_init(parse_bold),
|
||||
Cmr10Metrics::Italic => CMTI10_METRICS.get_or_init(parse_italic),
|
||||
Cmr10Metrics::BoldItalic => CMBXTI10_METRICS.get_or_init(parse_bold_italic),
|
||||
Cmr10Metrics::Mono => CMTT10_METRICS.get_or_init(parse_mono),
|
||||
Cmr10Metrics::Sans => CMSS10_METRICS.get_or_init(parse_sans),
|
||||
Cmr10Metrics::SansBold => CMSSBX10_METRICS.get_or_init(parse_sans_bold),
|
||||
Cmr10Metrics::SansItalic => CMSSI10_METRICS.get_or_init(parse_sans_italic),
|
||||
Cmr10Metrics::SmallCaps => CMCSC10_METRICS.get_or_init(parse_small_caps),
|
||||
Cmr10Metrics::Slanted => CMSL10_METRICS.get_or_init(parse_slanted),
|
||||
Cmr10Metrics::BoldSlanted => CMBXSL10_METRICS.get_or_init(parse_bold_slanted),
|
||||
Cmr10Metrics::MonoItalic => CMITT10_METRICS.get_or_init(parse_mono_italic),
|
||||
Cmr10Metrics::Math => CMR10_METRICS.get_or_init(parse_roman),
|
||||
Cmr10Metrics::MathCalligraphic => CMSY10_METRICS.get_or_init(parse_math_symbol),
|
||||
Cmr10Metrics::MathBlackboard => MSBM10_METRICS.get_or_init(parse_blackboard),
|
||||
Cmr10Metrics::MathFraktur => EUFM10_METRICS.get_or_init(parse_fraktur),
|
||||
Cmr10Metrics::TimesRoman => PTMR8T_METRICS.get_or_init(parse_times_roman),
|
||||
Cmr10Metrics::TimesBold => PTMB8T_METRICS.get_or_init(parse_times_bold),
|
||||
Cmr10Metrics::TimesItalic => PTMRI8T_METRICS.get_or_init(parse_times_italic),
|
||||
Cmr10Metrics::TimesBoldItalic => PTMBI8T_METRICS.get_or_init(parse_times_bold_italic),
|
||||
}
|
||||
}
|
||||
|
||||
impl Cmr10Metrics {
|
||||
pub const fn new() -> Self {
|
||||
Self::Roman
|
||||
}
|
||||
|
||||
/// Select the Computer Modern face that corresponds to a paragraph face.
|
||||
pub const fn for_paragraph_font(font: ParagraphFont) -> Self {
|
||||
match font {
|
||||
ParagraphFont::Roman => Self::Roman,
|
||||
ParagraphFont::Bold => Self::Bold,
|
||||
ParagraphFont::Italic => Self::Italic,
|
||||
ParagraphFont::BoldItalic => Self::BoldItalic,
|
||||
ParagraphFont::Mono => Self::Mono,
|
||||
ParagraphFont::Sans => Self::Sans,
|
||||
ParagraphFont::SansBold => Self::SansBold,
|
||||
ParagraphFont::SansItalic => Self::SansItalic,
|
||||
ParagraphFont::SmallCaps => Self::SmallCaps,
|
||||
ParagraphFont::Slanted => Self::Slanted,
|
||||
ParagraphFont::BoldSlanted => Self::BoldSlanted,
|
||||
ParagraphFont::MonoItalic => Self::MonoItalic,
|
||||
ParagraphFont::TimesRoman => Self::TimesRoman,
|
||||
ParagraphFont::TimesBold => Self::TimesBold,
|
||||
ParagraphFont::TimesItalic => Self::TimesItalic,
|
||||
ParagraphFont::TimesBoldItalic => Self::TimesBoldItalic,
|
||||
}
|
||||
}
|
||||
|
||||
/// Select the face by PDF slot: Roman, bold, italic, bold-italic, mono, sans.
|
||||
pub const fn for_pdf_slot(slot: usize) -> Self {
|
||||
match slot {
|
||||
1 => Self::Bold,
|
||||
2 => Self::Italic,
|
||||
3 => Self::BoldItalic,
|
||||
4 => Self::Mono,
|
||||
5 => Self::Sans,
|
||||
6 => Self::Math,
|
||||
7 => Self::Math,
|
||||
8 => Self::Math,
|
||||
9 => Self::MathBlackboard,
|
||||
10 => Self::MathFraktur,
|
||||
11 => Self::SansBold,
|
||||
12 => Self::SansItalic,
|
||||
13 => Self::SmallCaps,
|
||||
14 => Self::Slanted,
|
||||
15 => Self::BoldSlanted,
|
||||
16 => Self::MonoItalic,
|
||||
_ => Self::Roman,
|
||||
}
|
||||
}
|
||||
|
||||
fn metrics(self) -> &'static TfmMetrics {
|
||||
metrics_for(self)
|
||||
}
|
||||
|
||||
/// Exact embedded TFM metrics for native text. No missing-glyph fallback.
|
||||
pub fn native_text_metrics(self, character: char) -> Option<(i64, i64, i64, i64)> {
|
||||
let slot = match character {
|
||||
'Γ' => '\0',
|
||||
'ff' => '\u{b}',
|
||||
'fi' => '\u{c}',
|
||||
'fl' => '\u{d}',
|
||||
'ffi' => '\u{e}',
|
||||
'ffl' => '\u{f}',
|
||||
c if c.is_ascii() => c,
|
||||
_ => return None,
|
||||
};
|
||||
let f = self.metrics();
|
||||
if f.char_info(slot)?.width_index == 0 {
|
||||
return None;
|
||||
}
|
||||
Some((f.width(slot), f.height(slot), f.depth(slot), f.italic(slot)))
|
||||
}
|
||||
|
||||
pub fn width(&self, character: char) -> i64 {
|
||||
if matches!(
|
||||
*self,
|
||||
Self::MathCalligraphic | Self::MathBlackboard | Self::MathFraktur
|
||||
) {
|
||||
let capital_only = *self != Self::MathFraktur;
|
||||
if character.is_ascii_uppercase() || (!capital_only && character.is_ascii_lowercase()) {
|
||||
return self.metrics().width(character);
|
||||
}
|
||||
return Self::Math.width(character);
|
||||
}
|
||||
if self.is_math() && character.is_ascii_alphabetic() {
|
||||
let width = math_italic_metrics().width(character);
|
||||
if width > 0 {
|
||||
return width;
|
||||
}
|
||||
}
|
||||
if self.is_math() {
|
||||
if let Some(slot) = math_symbol_slot(character) {
|
||||
let width = math_symbol_metrics().width(char::from(slot));
|
||||
if width > 0 {
|
||||
return width;
|
||||
}
|
||||
}
|
||||
if let Some(slot) = math_extension_slot(character) {
|
||||
let width = math_extension_metrics().width(char::from(slot));
|
||||
if width > 0 {
|
||||
return width;
|
||||
}
|
||||
}
|
||||
}
|
||||
let width = self.metrics().width(character);
|
||||
if width > 0 { width } else { 327_680 }
|
||||
}
|
||||
|
||||
/// TeX's ex unit is fontdimen5, which can differ from the ink height of x.
|
||||
pub fn x_height(&self) -> i64 {
|
||||
self.metrics().x_height()
|
||||
}
|
||||
|
||||
pub fn height(&self, character: char) -> i64 {
|
||||
if matches!(
|
||||
*self,
|
||||
Self::MathCalligraphic | Self::MathBlackboard | Self::MathFraktur
|
||||
) {
|
||||
let capital_only = *self != Self::MathFraktur;
|
||||
if character.is_ascii_uppercase() || (!capital_only && character.is_ascii_lowercase()) {
|
||||
return self.metrics().height(character);
|
||||
}
|
||||
return Self::Math.height(character);
|
||||
}
|
||||
if self.is_math() && character.is_ascii_alphabetic() {
|
||||
let height = math_italic_metrics().height(character);
|
||||
if height > 0 {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
if self.is_math() {
|
||||
if let Some(slot) = math_symbol_slot(character) {
|
||||
return math_symbol_metrics().height(char::from(slot));
|
||||
}
|
||||
if let Some(slot) = math_extension_slot(character) {
|
||||
return math_extension_metrics().height(char::from(slot));
|
||||
}
|
||||
}
|
||||
self.metrics().height(character)
|
||||
}
|
||||
|
||||
pub fn depth(&self, character: char) -> i64 {
|
||||
if matches!(
|
||||
*self,
|
||||
Self::MathCalligraphic | Self::MathBlackboard | Self::MathFraktur
|
||||
) {
|
||||
let capital_only = *self != Self::MathFraktur;
|
||||
if character.is_ascii_uppercase() || (!capital_only && character.is_ascii_lowercase()) {
|
||||
return self.metrics().depth(character);
|
||||
}
|
||||
return Self::Math.depth(character);
|
||||
}
|
||||
if self.is_math() && character.is_ascii_alphabetic() {
|
||||
let depth = math_italic_metrics().depth(character);
|
||||
if depth > 0 {
|
||||
return depth;
|
||||
}
|
||||
}
|
||||
if self.is_math() {
|
||||
if let Some(slot) = math_symbol_slot(character) {
|
||||
return math_symbol_metrics().depth(char::from(slot));
|
||||
}
|
||||
if let Some(slot) = math_extension_slot(character) {
|
||||
return math_extension_metrics().depth(char::from(slot));
|
||||
}
|
||||
}
|
||||
self.metrics().depth(character)
|
||||
}
|
||||
|
||||
pub fn italic(&self, character: char) -> i64 {
|
||||
if matches!(
|
||||
*self,
|
||||
Self::MathCalligraphic | Self::MathBlackboard | Self::MathFraktur
|
||||
) {
|
||||
let capital_only = *self != Self::MathFraktur;
|
||||
if character.is_ascii_uppercase() || (!capital_only && character.is_ascii_lowercase()) {
|
||||
return self.metrics().italic(character);
|
||||
}
|
||||
return Self::Math.italic(character);
|
||||
}
|
||||
if self.is_math() && character.is_ascii_alphabetic() {
|
||||
return math_italic_metrics().italic(character);
|
||||
}
|
||||
if self.is_math() {
|
||||
if let Some(slot) = math_symbol_slot(character) {
|
||||
return math_symbol_metrics().italic(char::from(slot));
|
||||
}
|
||||
if let Some(slot) = math_extension_slot(character) {
|
||||
return math_extension_metrics().italic(char::from(slot));
|
||||
}
|
||||
}
|
||||
self.metrics().italic(character)
|
||||
}
|
||||
|
||||
pub fn ligature(&self, left: char, right: char) -> Option<(char, char)> {
|
||||
let slot = self.metrics().ligature_slot(left, right)?;
|
||||
let unicode = match slot {
|
||||
11 => 'ff',
|
||||
12 => 'fi',
|
||||
13 => 'fl',
|
||||
14 => 'ffi',
|
||||
15 => 'ffl',
|
||||
_ => return None,
|
||||
};
|
||||
Some((unicode, char::from(slot)))
|
||||
}
|
||||
|
||||
pub fn kern(&self, left: char, right: char) -> i64 {
|
||||
self.metrics().kern(left, right)
|
||||
}
|
||||
|
||||
pub fn space(&self) -> i64 {
|
||||
self.metrics().space()
|
||||
}
|
||||
|
||||
pub fn stretch(&self) -> i64 {
|
||||
self.metrics().stretch()
|
||||
}
|
||||
|
||||
pub fn shrink(&self) -> i64 {
|
||||
self.metrics().shrink()
|
||||
}
|
||||
|
||||
pub fn extra_space(&self) -> i64 {
|
||||
self.metrics().extra_space()
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether this face is the math face.
|
||||
impl Cmr10Metrics {
|
||||
pub const fn is_math(self) -> bool {
|
||||
matches!(self, Self::Math)
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics for a named Computer Modern extension big operator (`\sum` and friends).
|
||||
pub fn cmex_operator(name: &str) -> Option<(i64, i64, i64)> {
|
||||
let slot = match name {
|
||||
"sum" => 80,
|
||||
"prod" => 81,
|
||||
"coprod" => 96,
|
||||
"int" => 82,
|
||||
"oint" => 72,
|
||||
"bigcap" => 84,
|
||||
"bigcup" => 83,
|
||||
"bigsqcup" => 85,
|
||||
"bigvee" => 87,
|
||||
"bigwedge" => 86,
|
||||
"bigodot" => 74,
|
||||
"bigotimes" => 78,
|
||||
"bigoplus" => 76,
|
||||
"biguplus" => 85,
|
||||
_ => return None,
|
||||
};
|
||||
let metrics = math_extension_metrics();
|
||||
let width = metrics.width(char::from(slot));
|
||||
if width == 0 {
|
||||
return None;
|
||||
}
|
||||
Some((
|
||||
width,
|
||||
metrics.height(char::from(slot)),
|
||||
metrics.depth(char::from(slot)),
|
||||
))
|
||||
}
|
||||
|
||||
/// Map a Unicode n-ary operator to its slot in the bundled cmex10 font.
|
||||
pub fn math_extension_slot(character: char) -> Option<u8> {
|
||||
let slot = match character {
|
||||
'\u{2211}' => 80, // \sum
|
||||
'\u{220F}' => 81, // \prod
|
||||
'\u{2210}' => 96, // \coprod
|
||||
'\u{222B}' => 82, // \int
|
||||
'\u{222E}' => 72, // \oint
|
||||
'\u{22C2}' => 84, // \bigcap
|
||||
'\u{22C3}' => 83, // \bigcup
|
||||
'\u{2A06}' => 85, // \bigsqcup
|
||||
'\u{22C1}' => 87, // \bigvee
|
||||
'\u{22C0}' => 86, // \bigwedge
|
||||
'\u{2A00}' => 74, // \bigodot
|
||||
'\u{2A02}' => 78, // \bigotimes
|
||||
'\u{2A01}' => 76, // \bigoplus
|
||||
_ => return None,
|
||||
};
|
||||
Some(slot)
|
||||
}
|
||||
|
||||
/// Advance width of a `cmsy10` glyph addressed by a Unicode math character.
|
||||
pub fn math_symbol_width(character: char) -> Option<i64> {
|
||||
if character.is_ascii_uppercase() {
|
||||
let width = math_symbol_metrics().width(character);
|
||||
if width > 0 {
|
||||
return Some(width);
|
||||
}
|
||||
}
|
||||
math_symbol_slot(character)
|
||||
.map(|slot| math_symbol_metrics().width(char::from(slot)))
|
||||
.filter(|width| *width > 0)
|
||||
}
|
||||
|
||||
/// Advance width of a `msbm10` blackboard-bold capital.
|
||||
pub fn math_blackboard_width(character: char) -> Option<i64> {
|
||||
if character.is_ascii_uppercase() {
|
||||
let width = math_blackboard_metrics().width(character);
|
||||
if width > 0 {
|
||||
return Some(width);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Advance width of an `eufm10` Fraktur letter.
|
||||
pub fn math_fraktur_width(character: char) -> Option<i64> {
|
||||
if character.is_ascii_alphabetic() {
|
||||
let width = math_fraktur_metrics().width(character);
|
||||
if width > 0 {
|
||||
return Some(width);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Advance width of a `cmex10` glyph addressed by a Unicode n-ary operator.
|
||||
pub fn math_extension_width(character: char) -> Option<i64> {
|
||||
math_extension_slot(character)
|
||||
.map(|slot| math_extension_metrics().width(char::from(slot)))
|
||||
.filter(|width| *width > 0)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn reads_cmr10_widths() {
|
||||
let font = Cmr10Metrics::new();
|
||||
assert!(font.width('A') > 450_000);
|
||||
assert!((font.width('a') - 327_681).abs() <= 2);
|
||||
assert!((font.space() - 218_454).abs() <= 2);
|
||||
assert!(font.stretch() > 0);
|
||||
assert!(font.shrink() > 0);
|
||||
assert!(font.height('A') > 0);
|
||||
assert!(font.depth('g') > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn times_bold_and_italic_tfms_differ_from_roman() {
|
||||
let roman = Cmr10Metrics::TimesRoman;
|
||||
let differs = |face: Cmr10Metrics| {
|
||||
['A', 'm', 'W', 'f']
|
||||
.iter()
|
||||
.any(|character| face.width(*character) != roman.width(*character))
|
||||
};
|
||||
assert!(differs(Cmr10Metrics::TimesBold));
|
||||
assert!(differs(Cmr10Metrics::TimesItalic));
|
||||
assert!(differs(Cmr10Metrics::TimesBoldItalic));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn times_roman_tfm_differs_from_cmr() {
|
||||
let roman = Cmr10Metrics::Roman;
|
||||
let times = Cmr10Metrics::TimesRoman;
|
||||
assert_ne!(times.width('A'), roman.width('A'));
|
||||
assert_ne!(times.width('m'), roman.width('m'));
|
||||
assert!(times.height('A') > 0);
|
||||
assert!(times.depth('g') > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bold_and_italic_tfms_differ_from_roman() {
|
||||
let roman = Cmr10Metrics::Roman;
|
||||
let bold = Cmr10Metrics::Bold;
|
||||
let italic = Cmr10Metrics::Italic;
|
||||
assert_ne!(bold.width('m'), roman.width('m'));
|
||||
assert_ne!(italic.width('m'), roman.width('m'));
|
||||
assert!(bold.space() > 0);
|
||||
assert!(italic.height('A') > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn math_face_uses_cmmi_for_letters() {
|
||||
let roman = Cmr10Metrics::Roman;
|
||||
let math = Cmr10Metrics::Math;
|
||||
assert_ne!(math.width('f'), roman.width('f'));
|
||||
assert_eq!(math.width('2'), roman.width('2'));
|
||||
assert!(math.is_math());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmex_provides_big_operator_metrics() {
|
||||
let (sum_width, _, sum_depth) = cmex_operator("sum").expect("cmex has a sum glyph");
|
||||
let (int_width, _, _) = cmex_operator("int").expect("cmex has an integral glyph");
|
||||
assert!(sum_width > 600_000, "sum width {sum_width}");
|
||||
assert!(sum_depth > 500_000, "sum depth {sum_depth}");
|
||||
assert!(int_width < sum_width);
|
||||
assert!(cmex_operator("not-an-operator").is_none());
|
||||
}
|
||||
}
|
||||
|
||||
/// Map a Unicode math symbol to its slot in the bundled cmsy10 font.
|
||||
pub fn math_symbol_slot(character: char) -> Option<u8> {
|
||||
let slot = match character {
|
||||
'\u{00B7}' => 2, // \cdot
|
||||
'\u{00D7}' => 3, // \times
|
||||
'\u{00F7}' => 5, // \div
|
||||
'\u{00B1}' => 7, // \pm
|
||||
'\u{2213}' => 8, // \mp
|
||||
'\u{2295}' => 9, // \oplus
|
||||
'\u{2296}' => 10, // \ominus
|
||||
'\u{2297}' => 11, // \otimes
|
||||
'\u{2298}' => 12, // \oslash
|
||||
'\u{2299}' => 13, // \odot
|
||||
'\u{224D}' => 17, // \asymp
|
||||
'\u{2261}' => 18, // \equiv
|
||||
'\u{2286}' => 19, // \subseteq
|
||||
'\u{2287}' => 20, // \supseteq
|
||||
'\u{2264}' => 21, // \leq
|
||||
'\u{2265}' => 22, // \geq
|
||||
'\u{2AAF}' => 23, // \preceq
|
||||
'\u{2AB0}' => 24, // \succeq
|
||||
'\u{223C}' => 25, // \sim
|
||||
'\u{2248}' => 26, // \approx
|
||||
'\u{2282}' => 27, // \subset
|
||||
'\u{2283}' => 28, // \supset
|
||||
'\u{226A}' => 29, // \ll
|
||||
'\u{226B}' => 30, // \gg
|
||||
'\u{227A}' => 31, // \prec
|
||||
'\u{227B}' => 32, // \succ
|
||||
'\u{2190}' => 33, // \leftarrow
|
||||
'\u{2192}' => 34, // \rightarrow
|
||||
'\u{2191}' => 35, // \uparrow
|
||||
'\u{2193}' => 36, // \downarrow
|
||||
'\u{2194}' => 37, // \leftrightarrow
|
||||
'\u{2197}' => 38, // \nearrow
|
||||
'\u{2198}' => 39, // \searrow
|
||||
'\u{2243}' => 40, // \simeq
|
||||
'\u{21D0}' => 41, // \Leftarrow
|
||||
'\u{21D2}' => 42, // \Rightarrow
|
||||
'\u{21D1}' => 43, // \Uparrow
|
||||
'\u{21D3}' => 44, // \Downarrow
|
||||
'\u{21D4}' => 45, // \Leftrightarrow
|
||||
'\u{2196}' => 46, // \nwarrow
|
||||
'\u{2199}' => 47, // \swarrow
|
||||
'\u{221D}' => 48, // \propto
|
||||
'\u{2032}' => 49, // \prime
|
||||
'\u{221E}' => 50, // \infty
|
||||
'\u{2208}' => 51, // \in
|
||||
'\u{220B}' => 52, // \ni
|
||||
'\u{25B3}' => 53, // \triangle
|
||||
'\u{25BD}' => 54, // \triangledown
|
||||
'\u{21A6}' => 56, // \mapsto
|
||||
'\u{2200}' => 57, // \forall
|
||||
'\u{2203}' => 58, // \exists
|
||||
'\u{00AC}' => 59, // \neg
|
||||
'\u{2205}' => 60, // \emptyset
|
||||
'\u{211C}' => 61, // \Re
|
||||
'\u{2111}' => 62, // \Im
|
||||
'\u{22A4}' => 63, // \top
|
||||
'\u{22A5}' => 64, // \bot
|
||||
'\u{2135}' => 65, // \aleph
|
||||
'\u{222A}' => 92, // \cup
|
||||
'\u{2229}' => 93, // \cap
|
||||
'\u{228E}' => 94, // \uplus
|
||||
'\u{2227}' => 95, // \wedge
|
||||
'\u{2228}' => 96, // \vee
|
||||
'\u{22A2}' => 97, // \vdash
|
||||
'\u{22A3}' => 98, // \dashv
|
||||
'\u{230A}' => 99, // \lfloor
|
||||
'\u{230B}' => 100, // \rfloor
|
||||
'\u{2308}' => 101, // \lceil
|
||||
'\u{2309}' => 102, // \rceil
|
||||
'\u{007C}' => 107, // \vert
|
||||
'\u{2016}' => 108, // \Vert
|
||||
'\u{2195}' => 109, // \updownarrow
|
||||
'\u{21D5}' => 110, // \Updownarrow
|
||||
'\u{2240}' => 112, // \wr
|
||||
'\u{2210}' => 114, // \coprod
|
||||
'\u{2207}' => 115, // \nabla
|
||||
'\u{222C}' | '\u{222D}' => 117,
|
||||
'\u{2294}' => 117, // \sqcup
|
||||
'\u{2293}' => 118, // \sqcap
|
||||
'\u{00A7}' => 121, // \S
|
||||
'\u{2020}' => 122, // \dagger
|
||||
'\u{2021}' => 123, // \ddagger
|
||||
'\u{00B6}' => 124, // \P
|
||||
'\u{2663}' => 125, // \clubsuit
|
||||
'\u{2662}' => 126, // \diamondsuit
|
||||
'\u{2661}' => 127, // \heartsuit
|
||||
'\u{2660}' => 128, // \spadesuit
|
||||
_ => return None,
|
||||
};
|
||||
Some(slot)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod cmsy_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn cmsy_provides_math_symbol_metrics() {
|
||||
let font = Cmr10Metrics::Math;
|
||||
let times = font.width('\u{00D7}');
|
||||
let slot = math_symbol_metrics().width(char::from(3u8));
|
||||
assert_eq!(times, slot);
|
||||
assert!(times > 0);
|
||||
let less_equal = font.width('\u{2264}');
|
||||
assert!(less_equal > 0);
|
||||
assert_ne!(times, less_equal);
|
||||
assert_eq!(Cmr10Metrics::Roman.width('\u{00D7}'), 327_680);
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics for a CMEX delimiter size variant: size 1 = `\big`, 2 = `\Big`,
|
||||
/// 3 = `\bigg`, 4 = `\Bigg`.
|
||||
pub fn cmex_delimiter(delimiter: char, size: u8) -> Option<(i64, i64, i64)> {
|
||||
let slot = match (delimiter, size) {
|
||||
('(', 1) => 1,
|
||||
(')', 1) => 2,
|
||||
('[', 1) => 3,
|
||||
(']', 1) => 4,
|
||||
('\u{230A}', 1) => 5,
|
||||
('\u{230B}', 1) => 6,
|
||||
('\u{2308}', 1) => 7,
|
||||
('\u{2309}', 1) => 8,
|
||||
('{', 1) => 9,
|
||||
('}', 1) => 10,
|
||||
('\u{27E8}', 1) => 11,
|
||||
('\u{27E9}', 1) => 12,
|
||||
('(', 2) => 17,
|
||||
(')', 2) => 18,
|
||||
('[', 2) => 105,
|
||||
(']', 2) => 106,
|
||||
('\u{230A}', 2) => 107,
|
||||
('\u{230B}', 2) => 108,
|
||||
('\u{2308}', 2) => 109,
|
||||
('\u{2309}', 2) => 110,
|
||||
('{', 2) => 111,
|
||||
('}', 2) => 112,
|
||||
('\u{27E8}', 2) => 69,
|
||||
('\u{27E9}', 2) => 70,
|
||||
('(', 3) => 19,
|
||||
(')', 3) => 20,
|
||||
('[', 3) => 21,
|
||||
(']', 3) => 22,
|
||||
('\u{230A}', 3) => 23,
|
||||
('\u{230B}', 3) => 24,
|
||||
('\u{2308}', 3) => 25,
|
||||
('\u{2309}', 3) => 26,
|
||||
('{', 3) => 27,
|
||||
('}', 3) => 28,
|
||||
('\u{27E8}', 3) => 29,
|
||||
('\u{27E9}', 3) => 30,
|
||||
('(', 4) => 33,
|
||||
(')', 4) => 34,
|
||||
('[', 4) => 35,
|
||||
(']', 4) => 36,
|
||||
('\u{230A}', 4) => 37,
|
||||
('\u{230B}', 4) => 38,
|
||||
('\u{2308}', 4) => 39,
|
||||
('\u{2309}', 4) => 40,
|
||||
('{', 4) => 41,
|
||||
('}', 4) => 42,
|
||||
('\u{27E8}', 4) => 43,
|
||||
('\u{27E9}', 4) => 44,
|
||||
_ => return None,
|
||||
};
|
||||
let metrics = math_extension_metrics();
|
||||
let code = char::from(slot);
|
||||
// CMEX delimiters sit almost entirely below the baseline; TeX centres them
|
||||
// on the math axis (a quarter em at 10pt) before reporting height/depth.
|
||||
let extent = metrics.height(code) + metrics.depth(code);
|
||||
let axis = 655_360 / 4;
|
||||
Some((
|
||||
metrics.width(code),
|
||||
extent / 2 + axis,
|
||||
(extent / 2 - axis).max(0),
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod cmex_delimiter_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn cmex_delimiters_have_distinct_size_variants() {
|
||||
let big = cmex_delimiter('(', 1).expect("cmex has a big paren");
|
||||
let big_big = cmex_delimiter('(', 2).expect("cmex has a Big paren");
|
||||
let bigg = cmex_delimiter('(', 3).expect("cmex has a bigg paren");
|
||||
let bigg_bigg = cmex_delimiter('(', 4).expect("cmex has a Bigg paren");
|
||||
assert!(big.0 > 0 && big.1 > 0);
|
||||
assert!(big_big.1 > big.1);
|
||||
assert!(bigg.1 > big_big.1);
|
||||
assert!(bigg_bigg.1 > bigg.1);
|
||||
let extent = |m: (i64, i64, i64)| m.1 + m.2;
|
||||
assert!(extent(big_big) > extent(big));
|
||||
assert!(extent(bigg) > extent(big_big));
|
||||
assert!(extent(bigg_bigg) > extent(bigg));
|
||||
assert!(cmex_delimiter('.', 1).is_none());
|
||||
assert!(cmex_delimiter('x', 1).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sans_bold_and_italic_use_their_own_metrics() {
|
||||
let regular = Cmr10Metrics::Sans.width('A');
|
||||
let bold = Cmr10Metrics::SansBold.width('A');
|
||||
let italic = Cmr10Metrics::SansItalic.width('A');
|
||||
assert_eq!(bold, metrics_for(Cmr10Metrics::SansBold).width('A'));
|
||||
assert_eq!(italic, metrics_for(Cmr10Metrics::SansItalic).width('A'));
|
||||
assert_ne!(regular, bold);
|
||||
assert_ne!(Cmr10Metrics::Sans.space(), Cmr10Metrics::SansBold.space());
|
||||
assert!(italic > 0);
|
||||
assert_eq!(Cmr10Metrics::for_pdf_slot(11), Cmr10Metrics::SansBold);
|
||||
assert_eq!(Cmr10Metrics::for_pdf_slot(12), Cmr10Metrics::SansItalic);
|
||||
assert_eq!(Cmr10Metrics::for_pdf_slot(13), Cmr10Metrics::SmallCaps);
|
||||
let small_caps = Cmr10Metrics::SmallCaps.width('a');
|
||||
assert_eq!(small_caps, metrics_for(Cmr10Metrics::SmallCaps).width('a'));
|
||||
assert_ne!(small_caps, Cmr10Metrics::Roman.width('a'));
|
||||
assert_eq!(Cmr10Metrics::for_pdf_slot(14), Cmr10Metrics::Slanted);
|
||||
assert_eq!(Cmr10Metrics::for_pdf_slot(15), Cmr10Metrics::BoldSlanted);
|
||||
assert_eq!(Cmr10Metrics::for_pdf_slot(16), Cmr10Metrics::MonoItalic);
|
||||
let slanted = Cmr10Metrics::Slanted.width('a');
|
||||
assert_eq!(slanted, metrics_for(Cmr10Metrics::Slanted).width('a'));
|
||||
assert_ne!(slanted, Cmr10Metrics::Italic.width('a'));
|
||||
assert_eq!(
|
||||
Cmr10Metrics::BoldSlanted.width('a'),
|
||||
metrics_for(Cmr10Metrics::BoldSlanted).width('a')
|
||||
);
|
||||
assert_eq!(
|
||||
Cmr10Metrics::MonoItalic.width('a'),
|
||||
metrics_for(Cmr10Metrics::MonoItalic).width('a')
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,66 @@
|
||||
//! Visit the font instances retained by packed glyphs in a format.
|
||||
use super::*;
|
||||
use crate::{math_engine_tex::MathItem, native_font::NativeFont};
|
||||
use std::sync::Arc;
|
||||
|
||||
impl NativeBox {
|
||||
pub(in crate::execution) fn visit_format_fonts_mut(
|
||||
&mut self,
|
||||
visit: &mut impl FnMut(&mut Arc<NativeFont>),
|
||||
) {
|
||||
match &mut self.content {
|
||||
BoxContent::Horizontal(nodes) => rebind_horizontal(Arc::make_mut(nodes).as_mut_slice(), visit),
|
||||
BoxContent::Vertical(nodes) => rebind_vertical(Arc::make_mut(nodes).as_mut_slice(), visit),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn rebind_horizontal(nodes: &mut [TextNode], visit: &mut impl FnMut(&mut Arc<NativeFont>)) {
|
||||
for node in nodes {
|
||||
match node {
|
||||
TextNode::Glyph { glyph, .. } | TextNode::Box(glyph) | TextNode::MathChar(glyph) => {
|
||||
if let Some(b) = &mut glyph.native_box {
|
||||
b.visit_format_fonts_mut(visit);
|
||||
}
|
||||
if let Some(geometry) = &mut glyph.math_geometry {
|
||||
for item in &mut geometry.items {
|
||||
if let MathItem::NativeGlyph { font, .. } = &mut item.item {
|
||||
visit(font);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TextNode::Discretionary {
|
||||
pre_break,
|
||||
post_break,
|
||||
..
|
||||
} => {
|
||||
rebind_horizontal(pre_break, visit);
|
||||
rebind_horizontal(post_break, visit);
|
||||
}
|
||||
TextNode::Adjustment(value) => rebind_vertical(&mut value.nodes, visit),
|
||||
TextNode::Insertion(value) => rebind_vertical(&mut value.nodes, visit),
|
||||
TextNode::Leaders(leader) => rebind_leader(leader, visit),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn rebind_vertical(nodes: &mut [NativeVerticalNode], visit: &mut impl FnMut(&mut Arc<NativeFont>)) {
|
||||
for node in nodes {
|
||||
match node {
|
||||
NativeVerticalNode::Box(b) | NativeVerticalNode::Line(b) => {
|
||||
b.visit_format_fonts_mut(visit);
|
||||
}
|
||||
NativeVerticalNode::Insertion(value) => rebind_vertical(&mut value.nodes, visit),
|
||||
NativeVerticalNode::Leaders(leader) => rebind_leader(leader, visit),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn rebind_leader(leader: &mut LeaderGlue, visit: &mut impl FnMut(&mut Arc<NativeFont>)) {
|
||||
if let LeaderPattern::Box(b) = &mut leader.pattern {
|
||||
b.visit_format_fonts_mut(visit);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
//! Shape full native word sequences after horizontal glue has been set.
|
||||
|
||||
use super::super::paragraph::interword::invisible;
|
||||
use super::*;
|
||||
use crate::{opentype::OpenTypeRun, provenance::PaintSource};
|
||||
use std::{ops::Range, sync::Arc};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub(in crate::execution) struct Run {
|
||||
pub(super) nodes: Range<usize>,
|
||||
pub(in crate::execution) word: Arc<OpenTypeRun>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub(super) effects: Vec<usize>,
|
||||
}
|
||||
|
||||
impl NativeBox {
|
||||
pub(in crate::execution) fn prepare_interword_shipout(
|
||||
&mut self,
|
||||
limit: usize,
|
||||
cancellation: Option<&Cancellation>,
|
||||
) -> Result<usize, String> {
|
||||
let mut remaining = limit;
|
||||
prepare(self, &mut remaining, cancellation)?;
|
||||
Ok(limit - remaining)
|
||||
}
|
||||
}
|
||||
|
||||
fn prepare(
|
||||
packed: &mut NativeBox,
|
||||
remaining: &mut usize,
|
||||
cancellation: Option<&Cancellation>,
|
||||
) -> Result<(), String> {
|
||||
if cancellation.is_some_and(Cancellation::is_cancelled) {
|
||||
return Err("native compilation cancelled".into());
|
||||
}
|
||||
if packed.kind.is_unset() {
|
||||
return Ok(());
|
||||
}
|
||||
match &mut packed.content {
|
||||
BoxContent::Horizontal(nodes) => {
|
||||
packed.interword_runs = shape_row(nodes, packed.setting, remaining, cancellation)?;
|
||||
for node in Arc::make_mut(nodes) {
|
||||
let child = match node {
|
||||
TextNode::Box(item)
|
||||
| TextNode::MathChar(item)
|
||||
| TextNode::Glyph { glyph: item, .. } => item.native_box.as_deref_mut(),
|
||||
TextNode::Leaders(LeaderGlue {
|
||||
pattern: LeaderPattern::Box(item),
|
||||
..
|
||||
}) => Some(item.as_mut()),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(child) = child {
|
||||
prepare(child, remaining, cancellation)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
BoxContent::Vertical(nodes) => {
|
||||
for node in Arc::make_mut(nodes) {
|
||||
let child = match node {
|
||||
NativeVerticalNode::Box(item)
|
||||
| NativeVerticalNode::Line(item)
|
||||
| NativeVerticalNode::Leaders(LeaderGlue {
|
||||
pattern: LeaderPattern::Box(item),
|
||||
..
|
||||
}) => item,
|
||||
_ => continue,
|
||||
};
|
||||
prepare(child, remaining, cancellation)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn shape_row(
|
||||
nodes: &[TextNode],
|
||||
setting: GlueSetting,
|
||||
remaining: &mut usize,
|
||||
cancellation: Option<&Cancellation>,
|
||||
) -> Result<Vec<Run>, String> {
|
||||
let next = |start: usize| {
|
||||
let offset = nodes[start..].iter().position(|node| !invisible(node));
|
||||
offset.map_or(nodes.len(), |offset| start + offset)
|
||||
};
|
||||
let mut runs = Vec::new();
|
||||
let mut moved_suffix_effects = false;
|
||||
let mut index = 0;
|
||||
while let Some(node) = nodes.get(index) {
|
||||
let start = index;
|
||||
index += 1;
|
||||
let TextNode::OpenType(first) = node else {
|
||||
continue;
|
||||
};
|
||||
if first.font.letter_space() != 0 {
|
||||
continue;
|
||||
}
|
||||
let mut text = String::new();
|
||||
let mut sources = Vec::new();
|
||||
let mut units = 0;
|
||||
loop {
|
||||
let mut word_index = next(index);
|
||||
let space = match nodes.get(word_index) {
|
||||
Some(TextNode::FontSpace(_, font, origin)) => {
|
||||
Some((Some(*origin), *font == first.font.id))
|
||||
}
|
||||
Some(TextNode::Glue(_)) => Some((None, false)),
|
||||
_ => None,
|
||||
};
|
||||
if let Some((_, canonical)) = space {
|
||||
let adjustment = matches!(
|
||||
nodes.get(word_index + 1),
|
||||
Some(TextNode::SpaceAdjustment(_))
|
||||
);
|
||||
if !canonical && !adjustment {
|
||||
break;
|
||||
}
|
||||
word_index = next(word_index + 1 + usize::from(adjustment));
|
||||
}
|
||||
let Some(TextNode::OpenType(word)) = nodes.get(word_index) else {
|
||||
break;
|
||||
};
|
||||
if word.font.id != first.font.id {
|
||||
break;
|
||||
}
|
||||
if index == start + 1 {
|
||||
text.push_str(&first.text);
|
||||
sources.extend(first.sources.iter().cloned());
|
||||
units = first.text.encode_utf16().count();
|
||||
}
|
||||
if let Some((origin, _)) = space {
|
||||
if let Some(origin) = origin {
|
||||
sources.push((text.len(), PaintSource::token(origin)));
|
||||
}
|
||||
text.push(' ');
|
||||
units += 1;
|
||||
}
|
||||
units += word.text.encode_utf16().count();
|
||||
if units > usize::from(u16::MAX) {
|
||||
return Err("native justified OpenType word capacity exceeded".into());
|
||||
}
|
||||
let offset = text.len();
|
||||
text.push_str(&word.text);
|
||||
sources.extend(
|
||||
word.sources
|
||||
.iter()
|
||||
.map(|(at, source)| (offset + at, source.clone())),
|
||||
);
|
||||
index = word_index + 1;
|
||||
}
|
||||
if index == start + 1 {
|
||||
continue;
|
||||
}
|
||||
if cancellation.is_some_and(Cancellation::is_cancelled) {
|
||||
return Err("native compilation cancelled".into());
|
||||
}
|
||||
let mut word = first.font.shape_mapped(text, sources, false)?;
|
||||
*remaining = remaining
|
||||
.checked_sub(word.glyphs.len())
|
||||
.ok_or("native justified OpenType shaping step limit exceeded")?;
|
||||
let target = nodes[start..index]
|
||||
.iter()
|
||||
.map(|node| shipout_width(node, setting))
|
||||
.sum();
|
||||
word.actual_text = first.actual_text;
|
||||
justify(&mut word, target)?;
|
||||
let mut effects = Vec::new();
|
||||
if !moved_suffix_effects
|
||||
&& let Some(offset) = nodes[start + 1..index].iter().position(invisible)
|
||||
{
|
||||
// XDV relinks the first invisible node in the old run. The scan
|
||||
// then follows its new link into the remaining horizontal list.
|
||||
effects.push(start + 1 + offset);
|
||||
effects.extend(
|
||||
nodes[index..]
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(offset, node)| invisible(node).then_some(index + offset)),
|
||||
);
|
||||
moved_suffix_effects = true;
|
||||
}
|
||||
runs.push(Run {
|
||||
nodes: start..index,
|
||||
word: Arc::new(word),
|
||||
effects,
|
||||
});
|
||||
}
|
||||
Ok(runs)
|
||||
}
|
||||
|
||||
fn shipout_width(node: &TextNode, setting: GlueSetting) -> i64 {
|
||||
match node {
|
||||
TextNode::Glue(glue) | TextNode::FontSpace(glue, ..) => {
|
||||
// XeTeX rounds each consumed space independently before joining.
|
||||
let (mut cumulative, mut previous) = (0, 0);
|
||||
i64::from(glue.width) + setting.adjustment(*glue, &mut cumulative, &mut previous)
|
||||
}
|
||||
TextNode::OpenType(word) => word.width,
|
||||
TextNode::SpaceAdjustment(width) => i64::from(*width),
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn justify(word: &mut OpenTypeRun, target: i64) -> Result<(), String> {
|
||||
let difference = target - word.width;
|
||||
word.width = target;
|
||||
if difference == 0 || word.glyphs.len() < 2 {
|
||||
return Ok(());
|
||||
}
|
||||
let space = word
|
||||
.font
|
||||
.face()?
|
||||
.glyph_index(' ')
|
||||
.map_or(0, |glyph| glyph.0);
|
||||
let spaces = word.glyphs.iter().filter(|glyph| glyph.id == space).count();
|
||||
let total = if spaces == 0 {
|
||||
word.glyphs.len() - 1
|
||||
} else {
|
||||
spaces
|
||||
};
|
||||
let mut consumed = 0;
|
||||
for glyph in &mut word.glyphs {
|
||||
glyph.x =
|
||||
(glyph.x as f64 + difference as f64 * consumed as f64 / total as f64).round() as i64;
|
||||
if spaces == 0 || glyph.id == space {
|
||||
consumed += 1;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
//! Owned leader glue. The pattern is kept once even when it paints many times.
|
||||
use super::*;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub enum LeaderMode {
|
||||
Aligned,
|
||||
Centered,
|
||||
Expanded,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub enum LeaderPattern {
|
||||
Box(Box<NativeBox>),
|
||||
Rule(NativeRule),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct LeaderGlue {
|
||||
pub glue: Glue,
|
||||
pub mode: LeaderMode,
|
||||
pub pattern: LeaderPattern,
|
||||
}
|
||||
|
||||
impl LeaderGlue {
|
||||
pub(super) fn pattern_dimensions(&self) -> (i64, i64, i64) {
|
||||
match &self.pattern {
|
||||
LeaderPattern::Box(b) => (b.width, b.height - b.shift, b.depth + b.shift),
|
||||
LeaderPattern::Rule(r) => r.dimensions(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn positions(
|
||||
&self,
|
||||
origin: i64,
|
||||
start: i64,
|
||||
available: i64,
|
||||
tile: i64,
|
||||
) -> impl Iterator<Item = i64> {
|
||||
let (first, stride, count) = if tile <= 0 || available <= 0 {
|
||||
(start, 0, 0)
|
||||
} else {
|
||||
// TeX includes 10 sp in its fit check to absorb glue rounding.
|
||||
// The caller still advances by the original adjusted glue length.
|
||||
let length = available + 10;
|
||||
let copies = length / tile;
|
||||
let remaining = length % tile;
|
||||
let (offset, gap) = match self.mode {
|
||||
LeaderMode::Aligned => ((origin - start).rem_euclid(tile), 0),
|
||||
LeaderMode::Centered => (remaining / 2, 0),
|
||||
LeaderMode::Expanded => {
|
||||
let gap = remaining / (copies + 1);
|
||||
((remaining - (copies - 1) * gap) / 2, gap)
|
||||
}
|
||||
};
|
||||
let stride = tile + gap;
|
||||
let count = if length - offset >= tile {
|
||||
1 + (length - offset - tile) / stride
|
||||
} else {
|
||||
0
|
||||
};
|
||||
(start + offset, stride, count)
|
||||
};
|
||||
(0..count).map(move |copy| first + copy * stride)
|
||||
}
|
||||
}
|
||||
|
||||
impl LeaderPattern {
|
||||
pub(in crate::execution) fn node_count(&self) -> usize {
|
||||
match self {
|
||||
Self::Box(b) => b.node_count(),
|
||||
Self::Rule(_) => 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//! Reassemble XeTeX native word fragments in the physical horizontal list.
|
||||
use super::TextNode;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub(super) fn rejoin(
|
||||
nodes: &mut Vec<TextNode>,
|
||||
glyph_metrics: bool,
|
||||
mut shaping_budget: Option<(&mut usize, usize)>,
|
||||
) -> Result<(), String> {
|
||||
let mut index = 0;
|
||||
let mut replacement_left = 0;
|
||||
let mut edits = Vec::new();
|
||||
while let Some(node) = nodes.get(index) {
|
||||
let begin = index;
|
||||
index += 1;
|
||||
if let TextNode::Discretionary {
|
||||
replacement_count, ..
|
||||
} = node
|
||||
{
|
||||
replacement_left = *replacement_count;
|
||||
continue;
|
||||
}
|
||||
if replacement_left > 0 {
|
||||
replacement_left -= 1;
|
||||
continue;
|
||||
}
|
||||
let TextNode::OpenType(first) = node else {
|
||||
continue;
|
||||
};
|
||||
|
||||
// Each retained discretionary may bridge one pair of fragments.
|
||||
// Starting inside a live replacement would invalidate its node count.
|
||||
loop {
|
||||
let next = index
|
||||
+ usize::from(matches!(
|
||||
nodes.get(index),
|
||||
Some(TextNode::Discretionary { .. })
|
||||
));
|
||||
if !matches!(nodes.get(next), Some(TextNode::OpenType(run)) if run.font.id == first.font.id)
|
||||
{
|
||||
break;
|
||||
}
|
||||
index = next + 1;
|
||||
}
|
||||
if index == begin + 1 {
|
||||
continue;
|
||||
}
|
||||
let mut text = String::new();
|
||||
let mut sources = Vec::new();
|
||||
let mut units = 0;
|
||||
for node in &nodes[begin..index] {
|
||||
if let TextNode::OpenType(run) = node {
|
||||
units += run.text.encode_utf16().count();
|
||||
if units > usize::from(u16::MAX) {
|
||||
return Err("native OpenType word capacity exceeded".into());
|
||||
}
|
||||
let offset = text.len();
|
||||
sources.extend(
|
||||
run.sources
|
||||
.iter()
|
||||
.map(|(at, source)| (offset + at, source.clone())),
|
||||
);
|
||||
text.push_str(&run.text);
|
||||
}
|
||||
}
|
||||
let mut word = first.font.shape_mapped(text, sources, glyph_metrics)?;
|
||||
word.actual_text = first.actual_text;
|
||||
if let Some((steps, limit)) = &mut shaping_budget {
|
||||
**steps = steps
|
||||
.checked_add(word.glyphs.len())
|
||||
.filter(|work| work <= limit)
|
||||
.ok_or("native OpenType packing step limit exceeded")?;
|
||||
}
|
||||
edits.push((begin, index, Arc::new(word)));
|
||||
}
|
||||
if !edits.is_empty() {
|
||||
let mut edits = edits.into_iter().peekable();
|
||||
let mut index = 0;
|
||||
let mut discard_until = 0;
|
||||
nodes.retain_mut(|node| {
|
||||
let at = index;
|
||||
index += 1;
|
||||
if at < discard_until {
|
||||
return false;
|
||||
}
|
||||
if let Some((_, end, word)) = edits.next_if(|(begin, _, _)| *begin == at) {
|
||||
*node = TextNode::OpenType(word);
|
||||
discard_until = end;
|
||||
}
|
||||
true
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
//! Owned list-tail cursors, independent of the list's enclosing root vector.
|
||||
use super::*;
|
||||
|
||||
pub(in crate::execution) enum TailNodeRef<'a> {
|
||||
Vertical(&'a NativeVerticalNode),
|
||||
Text(&'a TextNode),
|
||||
}
|
||||
enum Removed {
|
||||
Vertical(NativeVerticalNode),
|
||||
Text(TextNode),
|
||||
}
|
||||
fn vertical_box(n: &NativeVerticalNode) -> &NativeBox {
|
||||
match n {
|
||||
NativeVerticalNode::Box(b) | NativeVerticalNode::Line(b) => b,
|
||||
_ => unreachable!("owned list cursor must enter a real box"),
|
||||
}
|
||||
}
|
||||
fn vertical_box_mut(n: &mut NativeVerticalNode) -> &mut NativeBox {
|
||||
match n {
|
||||
NativeVerticalNode::Box(b) | NativeVerticalNode::Line(b) => b,
|
||||
_ => unreachable!("owned list cursor must enter a real box"),
|
||||
}
|
||||
}
|
||||
fn text_box(n: &TextNode) -> &NativeBox {
|
||||
match n {
|
||||
TextNode::Box(b) => b.native_box.as_deref().expect("owned list cursor box"),
|
||||
_ => unreachable!("owned list cursor must enter a real box"),
|
||||
}
|
||||
}
|
||||
fn text_box_mut(n: &mut TextNode) -> &mut NativeBox {
|
||||
match n {
|
||||
TextNode::Box(b) => b.native_box.as_deref_mut().expect("owned list cursor box"),
|
||||
_ => unreachable!("owned list cursor must enter a real box"),
|
||||
}
|
||||
}
|
||||
fn descend<'a>(b: &'a NativeBox, path: &[usize]) -> &'a NativeBox {
|
||||
match path.split_first() {
|
||||
None => b,
|
||||
Some((&i, rest)) => descend(
|
||||
match &b.content {
|
||||
BoxContent::Vertical(v) => vertical_box(&v[i]),
|
||||
BoxContent::Horizontal(v) => text_box(&v[i]),
|
||||
},
|
||||
rest,
|
||||
),
|
||||
}
|
||||
}
|
||||
fn descend_mut<'a>(b: &'a mut NativeBox, path: &[usize]) -> &'a mut NativeBox {
|
||||
match path.split_first() {
|
||||
None => b,
|
||||
Some((&i, rest)) => descend_mut(
|
||||
match &mut b.content {
|
||||
BoxContent::Vertical(v) => vertical_box_mut(&mut Arc::make_mut(v)[i]),
|
||||
BoxContent::Horizontal(v) => text_box_mut(&mut Arc::make_mut(v)[i]),
|
||||
},
|
||||
rest,
|
||||
),
|
||||
}
|
||||
}
|
||||
fn refresh(b: &mut NativeBox, path: &[usize]) {
|
||||
if let Some((&i, rest)) = path.split_first() {
|
||||
let child = match &mut b.content {
|
||||
BoxContent::Vertical(v) => vertical_box_mut(&mut Arc::make_mut(v)[i]),
|
||||
BoxContent::Horizontal(v) => text_box_mut(&mut Arc::make_mut(v)[i]),
|
||||
};
|
||||
refresh(child, rest);
|
||||
}
|
||||
if let BoxContent::Horizontal(v) = &b.content {
|
||||
b.diagnostic = crate::execution::diagnostics::text_nodes(v).into();
|
||||
}
|
||||
}
|
||||
fn horizontal(n: NativeVerticalNode) -> TextNode {
|
||||
match n {
|
||||
NativeVerticalNode::Box(b) | NativeVerticalNode::Line(b) => TextNode::Box(HorizontalBox {
|
||||
width: b.width,
|
||||
height: b.height,
|
||||
depth: b.depth,
|
||||
native_box: Some(b),
|
||||
..HorizontalBox::default()
|
||||
}),
|
||||
NativeVerticalNode::Glue(g) => TextNode::Glue(g),
|
||||
NativeVerticalNode::NamedGlue(g, p) => TextNode::NamedGlue(g, p),
|
||||
NativeVerticalNode::Leaders(l) => TextNode::Leaders(l),
|
||||
NativeVerticalNode::Kern(width) => TextNode::Kern {
|
||||
width,
|
||||
explicit: true,
|
||||
},
|
||||
NativeVerticalNode::ImplicitKern(width) => TextNode::Kern {
|
||||
width,
|
||||
explicit: false,
|
||||
},
|
||||
NativeVerticalNode::Penalty(n) => TextNode::Penalty(n),
|
||||
NativeVerticalNode::Rule(r) => TextNode::Rule(r),
|
||||
NativeVerticalNode::Mark(m) => TextNode::Mark(m),
|
||||
NativeVerticalNode::Insertion(n) => TextNode::Insertion(n),
|
||||
NativeVerticalNode::Output(o) => TextNode::Output(o),
|
||||
}
|
||||
}
|
||||
impl VerticalBuilder {
|
||||
fn tail_box(&self) -> Option<&NativeBox> {
|
||||
self.tail_path
|
||||
.split_first()
|
||||
.map(|(&i, rest)| descend(vertical_box(&self.nodes[i]), rest))
|
||||
}
|
||||
fn tail_box_mut(&mut self) -> Option<&mut NativeBox> {
|
||||
self.tail_path
|
||||
.split_first()
|
||||
.map(|(&i, rest)| descend_mut(vertical_box_mut(&mut self.nodes[i]), rest))
|
||||
}
|
||||
fn refresh_tail(&mut self) {
|
||||
if let Some((&i, rest)) = self.tail_path.split_first() {
|
||||
refresh(vertical_box_mut(&mut self.nodes[i]), rest);
|
||||
}
|
||||
}
|
||||
fn tail_len(&self) -> usize {
|
||||
match self.tail_box().map(|b| &b.content) {
|
||||
None => self.nodes.len(),
|
||||
Some(BoxContent::Vertical(v)) => v.len(),
|
||||
Some(BoxContent::Horizontal(v)) => v.len(),
|
||||
}
|
||||
}
|
||||
pub(in crate::execution) fn tail_depth(&self) -> usize {
|
||||
self.tail_path.len()
|
||||
}
|
||||
pub(in crate::execution) fn nest_tail_in(&mut self, index: usize) {
|
||||
if self.tail_path.is_empty() && index + 1 == self.nodes.len() {
|
||||
self.tail_path.push(index);
|
||||
}
|
||||
}
|
||||
pub(in crate::execution) fn push(&mut self, node: NativeVerticalNode) {
|
||||
match self.tail_box_mut().map(|b| &mut b.content) {
|
||||
None => self.nodes.push(node),
|
||||
Some(BoxContent::Vertical(v)) => Arc::make_mut(v).push(node),
|
||||
Some(BoxContent::Horizontal(v)) => Arc::make_mut(v).push(horizontal(node)),
|
||||
}
|
||||
self.refresh_tail();
|
||||
}
|
||||
pub(in crate::execution) fn extend(
|
||||
&mut self,
|
||||
nodes: impl IntoIterator<Item = NativeVerticalNode>,
|
||||
) {
|
||||
for node in nodes {
|
||||
self.push(node);
|
||||
}
|
||||
}
|
||||
pub(in crate::execution) fn append(&mut self, nodes: &mut Vec<NativeVerticalNode>) {
|
||||
self.extend(std::mem::take(nodes));
|
||||
}
|
||||
pub(in crate::execution) fn append_builder(&mut self, other: Self) {
|
||||
let base = self.tail_len();
|
||||
let mut path = other.tail_path;
|
||||
self.extend(other.nodes);
|
||||
if let Some(first) = path.first_mut() {
|
||||
*first += base;
|
||||
self.tail_path.extend(path);
|
||||
}
|
||||
}
|
||||
pub(in crate::execution) fn take_nodes(&mut self) -> Vec<NativeVerticalNode> {
|
||||
self.tail_path.clear();
|
||||
std::mem::take(&mut self.nodes)
|
||||
}
|
||||
pub(in crate::execution) fn tail_ref(&self) -> Option<TailNodeRef<'_>> {
|
||||
match self.tail_box().map(|b| &b.content) {
|
||||
None => self.nodes.last().map(TailNodeRef::Vertical),
|
||||
Some(BoxContent::Vertical(v)) => v.last().map(TailNodeRef::Vertical),
|
||||
Some(BoxContent::Horizontal(v)) => v.last().map(TailNodeRef::Text),
|
||||
}
|
||||
}
|
||||
fn pop(&mut self) -> Option<Removed> {
|
||||
let node = match self.tail_box_mut().map(|b| &mut b.content) {
|
||||
None => self.nodes.pop().map(Removed::Vertical),
|
||||
Some(BoxContent::Vertical(v)) => Arc::make_mut(v).pop().map(Removed::Vertical),
|
||||
Some(BoxContent::Horizontal(v)) => Arc::make_mut(v).pop().map(Removed::Text),
|
||||
};
|
||||
self.refresh_tail();
|
||||
node
|
||||
}
|
||||
pub(in crate::execution) fn remove_tail(&mut self) -> Result<(), String> {
|
||||
if !self.tail_path.is_empty() {
|
||||
return Err(
|
||||
"cannot unlink a native list tail not reachable from its active head".into(),
|
||||
);
|
||||
}
|
||||
self.pop();
|
||||
Ok(())
|
||||
}
|
||||
pub(in crate::execution) fn take_last_box(&mut self) -> Result<Option<NativeBox>, String> {
|
||||
let is_box = matches!(
|
||||
self.tail_ref(),
|
||||
Some(TailNodeRef::Vertical(NativeVerticalNode::Box(b) | NativeVerticalNode::Line(b))) if !b.kind.is_unset()
|
||||
) || matches!(self.tail_ref(), Some(TailNodeRef::Text(TextNode::Box(b))) if b.native_box.as_ref().is_some_and(|b| !b.kind.is_unset())
|
||||
);
|
||||
if !is_box {
|
||||
return Ok(None);
|
||||
}
|
||||
if !self.tail_path.is_empty() {
|
||||
return Err(
|
||||
"cannot unlink a native list tail not reachable from its active head".into(),
|
||||
);
|
||||
}
|
||||
Ok(match self.pop().unwrap() {
|
||||
Removed::Vertical(NativeVerticalNode::Box(b) | NativeVerticalNode::Line(b)) => Some(*b),
|
||||
Removed::Text(TextNode::Box(b)) => b.native_box.map(|b| *b),
|
||||
_ => unreachable!("checked actual tail box"),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
//! Web2C character translation and printability for physical TeX byte I/O.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ByteTranslation {
|
||||
input: [[u8; 32]; 8],
|
||||
output: [[u8; 32]; 8],
|
||||
printable: [u64; 4],
|
||||
}
|
||||
|
||||
impl Default for ByteTranslation {
|
||||
fn default() -> Self {
|
||||
let identity =
|
||||
std::array::from_fn(|row| std::array::from_fn(|column| (row * 32 + column) as u8));
|
||||
Self {
|
||||
input: identity,
|
||||
output: identity,
|
||||
printable: [u64::MAX << 32, u64::MAX >> 1, 0, 0],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ByteTranslation {
|
||||
pub fn from_tcx(data: &[u8]) -> Result<Self, String> {
|
||||
let mut table = Self::default();
|
||||
for (line, bytes) in data.split(|&b| b == b'\n').enumerate() {
|
||||
let record = bytes.split(|&b| b == b'%').next().unwrap_or_default();
|
||||
let record = std::str::from_utf8(record)
|
||||
.map_err(|_| format!("invalid TCX entry on line {}", line + 1))?;
|
||||
let mut fields = record.split_ascii_whitespace();
|
||||
let Some(field) = fields.next() else {
|
||||
continue;
|
||||
};
|
||||
let parse = |field| {
|
||||
number(field).ok_or_else(|| format!("invalid TCX entry on line {}", line + 1))
|
||||
};
|
||||
let external = parse(field)?;
|
||||
let internal = if let Some(field) = fields.next() {
|
||||
let internal = parse(field)?;
|
||||
table.input[usize::from(external) / 32][usize::from(external) % 32] = internal;
|
||||
table.output[usize::from(internal) / 32][usize::from(internal) % 32] = external;
|
||||
internal
|
||||
} else {
|
||||
external
|
||||
};
|
||||
let printable = match fields.next() {
|
||||
Some(field) => match parse(field)? {
|
||||
0 => false,
|
||||
1 => true,
|
||||
_ => return Err(format!("invalid TCX printable flag on line {}", line + 1)),
|
||||
},
|
||||
None => true,
|
||||
};
|
||||
let mask = 1_u64 << (internal % 64);
|
||||
let entry = &mut table.printable[usize::from(internal) / 64];
|
||||
if printable || (32..=126).contains(&internal) {
|
||||
*entry |= mask;
|
||||
} else {
|
||||
*entry &= !mask;
|
||||
}
|
||||
}
|
||||
Ok(table)
|
||||
}
|
||||
|
||||
pub(super) fn input(&self, value: u8) -> u8 {
|
||||
self.input[usize::from(value) / 32][usize::from(value) % 32]
|
||||
}
|
||||
|
||||
pub(super) fn output(&self, value: u8) -> u8 {
|
||||
self.output[usize::from(value) / 32][usize::from(value) % 32]
|
||||
}
|
||||
|
||||
pub(super) fn printable(&self, value: u8) -> bool {
|
||||
self.printable[usize::from(value) / 64] & (1_u64 << (value % 64)) != 0
|
||||
}
|
||||
}
|
||||
|
||||
fn number(field: &str) -> Option<u8> {
|
||||
let field = field.strip_prefix('+').unwrap_or(field);
|
||||
if let Some(hex) = field
|
||||
.strip_prefix("0x")
|
||||
.or_else(|| field.strip_prefix("0X"))
|
||||
{
|
||||
u8::from_str_radix(hex, 16).ok()
|
||||
} else if field.len() > 1 && field.starts_with('0') {
|
||||
u8::from_str_radix(field, 8).ok()
|
||||
} else {
|
||||
field.parse().ok()
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn diagnostic_text(bytes: &[u8]) -> String {
|
||||
let mut text = String::new();
|
||||
let mut remaining = bytes;
|
||||
loop {
|
||||
match std::str::from_utf8(remaining) {
|
||||
Ok(valid) => {
|
||||
text.push_str(valid);
|
||||
return text;
|
||||
}
|
||||
Err(error) => {
|
||||
let start = error.valid_up_to();
|
||||
let end = start + error.error_len().unwrap_or(remaining.len() - start);
|
||||
text.push_str(std::str::from_utf8(&remaining[..start]).unwrap());
|
||||
for &byte in &remaining[start..end] {
|
||||
text.push_str(&super::context::encoded_character(char::from(byte)));
|
||||
}
|
||||
remaining = &remaining[end..];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
use std::sync::{
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
|
||||
/// A shared stop signal for one native compilation.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Cancellation(Arc<AtomicBool>);
|
||||
|
||||
impl Cancellation {
|
||||
pub fn cancel(&self) {
|
||||
self.0.store(true, Ordering::Release);
|
||||
}
|
||||
|
||||
pub fn is_cancelled(&self) -> bool {
|
||||
self.0.load(Ordering::Acquire)
|
||||
}
|
||||
}
|
||||
Loaded 100 of 755 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user