|
16 | 16 | {{/if}}
|
17 | 17 | {{/each}}
|
18 | 18 |
|
19 |
| - {{!-- Ensure font is an array --}} |
20 | 19 | {{#if font}}
|
21 |
| - {{#if (not (isArray font))}} |
22 |
| - {{!-- Wrap single font string in an array --}} |
23 |
| - {{#set "font" (array font)}} |
24 |
| - {{/if}} |
25 |
| - {{/if}} |
26 |
| - |
27 |
| - {{#if font}} |
28 |
| - <style> |
29 |
| - {{#each font}} |
30 |
| - {{#if (startsWith this "/")}} |
31 |
| - @font-face { |
32 |
| - font-family: '{{this}}_custom'; |
33 |
| - src: url('{{this}}.woff2') format('woff2'), |
34 |
| - url('{{this}}.woff') format('woff'), |
35 |
| - url('{{this}}.ttf') format('truetype'), |
36 |
| - url('{{this}}.otf') format('opentype'), |
37 |
| - url('{{this}}.eot') format('embedded-opentype'), |
38 |
| - url('{{this}}.svg#{{this}}_custom') format('svg'); |
39 |
| - } |
40 |
| - {{/if}} |
41 |
| - {{/each}} |
42 |
| - </style> |
43 |
| - |
44 |
| - {{!-- Handling Google Fonts --}} |
45 |
| - {{#each (filter font (lambda font (not (startsWith font "/"))))}} |
| 20 | + {{#if (startsWith font "/")}} |
| 21 | + <style> |
| 22 | + @font-face { |
| 23 | + font-family: 'LocalFont'; |
| 24 | + src: url('{{font}}') format('woff2'); |
| 25 | + font-weight: normal; |
| 26 | + font-style: normal; |
| 27 | + } |
| 28 | + :root { |
| 29 | + --tblr-font-sans-serif: 'LocalFont', Arial, sans-serif; |
| 30 | + } |
| 31 | + </style> |
| 32 | + {{else}} |
46 | 33 | <link rel="preconnect" href="https://fonts.googleapis.com">
|
47 | 34 | <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
48 |
| - <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family={{this}}&display=fallback"> |
49 |
| - {{/each}} |
50 |
| - |
51 |
| - <style> |
52 |
| - :root { |
53 |
| - {{#each font}} |
54 |
| - {{!-- Local fonts will have _custom appended to their names --}} |
55 |
| - {{#if (startsWith this "/")}} |
56 |
| - --tblr-font-{{replace this "/" "-"}}: '{{this}}_custom', Arial, sans; |
57 |
| - {{else}} |
58 |
| - --tblr-font-{{replace this " " "-"}}: '{{this}}', Arial, sans; |
59 |
| - {{/if}} |
60 |
| - {{/each}} |
61 |
| - } |
62 |
| - </style> |
| 35 | + <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family={{font}}&display=fallback"> |
| 36 | + <style>:root { --tblr-font-sans-serif: '{{font}}', Arial, sans-serif;}</style> |
| 37 | + {{/if}} |
63 | 38 | {{/if}}
|
64 | 39 |
|
65 | 40 | <script src="{{static_path 'sqlpage.js'}}" defer></script>
|
|
0 commit comments