Compare commits

..
Author SHA1 Message Date
swaits 93a7794c2e fix(glossy): fix forward linking (broken themes)
Fixes [#19](https://github.com/swaits/typst-collection/issues/19).

Themes must emit `entry.label` for terms to be able to forward-link to
their glossary entrie.
2025-01-07 22:54:43 -07:00
swaits 40cc652aeb test(glossy): add bin/autotest.sh (uses watchexec) 2025-01-07 22:54:43 -07:00
swaits 05a66f4956 test(glossy): repair utf-handling test 2024-12-22 13:40:13 -07:00
18 changed files with 59 additions and 177 deletions

No files matched your search

-3
View File
@@ -17,9 +17,6 @@ links below to their main page.
into everyday docs.
- [**swank-tex**](https://typst.app/universe/package/swank-tex): Render those
funky logos for TeX, LaTeX, and friends.
- [**tasteful-pairings**](https://typst.app/universe/package/tasteful-pairings):
A carefully curated collection of font pairings focusing on readability and
typographic harmony.
## Templates
+4 -1
View File
@@ -253,7 +253,7 @@ Customize glossary appearance by defining a theme with three functions:
// Individual glossary entry
entry: (entry, index, total) => {
// index = entry index, total = total entries in group
let output = [#entry.short]
let output = [#entry.short#entry.label] // **NOTE:** Label here!
if entry.long != none {
output = [#output -- #entry.long]
}
@@ -280,6 +280,9 @@ Entry fields available to themes:
- `label`: Term's dictionary label
- `pages`: Linked page numbers where term appears
**NOTE:** If the theme does not emit `entry.label`, linking form terms to their
glossary entry will not work.
## License
This project is licensed under the MIT License.
+6
View File
@@ -0,0 +1,6 @@
watchexec \
--watch . \
--clear \
--ignore 'tests/**/diff/**' \
--ignore 'tests/**/out/**' \
"typst-test r"
+1 -1
View File
@@ -40,7 +40,7 @@
grid(
columns: (1fr, auto),
gutter: 0.75em,
[#short-display#long-display#description],
[#short-display#long-display#description#entry.label],
text(fill: rgb("#666666"), entry.pages)
)
}
+1 -1
View File
@@ -37,7 +37,7 @@
grid(
columns: (1fr, auto),
gutter: 1em,
[#short-display#entry.label#long-display#description],
[#short-display#entry.label#long-display#description#entry.label],
[#entry.pages]
)
}
+1 -1
View File
@@ -27,6 +27,6 @@
},
entry: (entry, index, total) => {
(entry.short, entry.long, entry.description, entry.pages)
(entry.short + entry.label, entry.long, entry.description, entry.pages)
}
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

+45
View File
@@ -0,0 +1,45 @@
#import "/lib.typ": *
#import "@preview/glossarium:0.5.1": *
#set page(height: auto, width: 4.5in)
#show link: set text(fill: red)
// -----------------------------------------------------------------------------
= `glossy`:
#box(
stroke: 1pt,
inset: 1em,
[
#show: init-glossary.with((WWW: "World Wide Web"))
This should be a link: @WWW
This should be a link, too: @WWW
#glossary()
]
)
// -----------------------------------------------------------------------------
= `glossarium`:
#box(
stroke: 1pt,
inset: 1em,
[
#show: make-glossary
#let entry-list = (
(key: "ML", short: "ML", long: "Machine Learning"),
)
#register-glossary(entry-list)
This should be a link: @ML
This should be a link, too: @ML
#print-glossary(entry-list)
]
)
+1 -1
View File
@@ -3,7 +3,7 @@
#set text(lang: "cs", region: "CZ")
#show: init-glossary.with(yaml("glossary.yml"))
#glossary(ignore-case: true)
#glossary(ignore-case: true, theme: theme-twocol)
#line(length: 20em)
-2
View File
@@ -1,2 +0,0 @@
tests/**/out/
tests/**/diff/
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2025 Stephen Waits <steve@waits.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-57
View File
@@ -1,57 +0,0 @@
# Tasteful Pairings
A carefully curated collection of font pairings for [Typst](https://typst.app/),
focusing on readability and typographic harmony. Each pairing combines a
sans-serif heading font with a serif body font, following established
typographic principles for clear visual hierarchy and optimal reading
experience.
## Installation
```typ
#import "@preview/tasteful-pairings:0.1.0": *
```
## Usage
```typ
#let pairing = font-pairings.at("modern-heritage")
#show heading: set text(font: pairing.heading)
#set text(font: pairing.body)
= Your Document Title
Your content here...
```
## Available Pairings
- **`ibm-plex`** - Modern corporate-friendly superfamily
- **`noto`** - Extensive language support, highly legible
- **`source`** - Adobe's refined open-source pair
- **`friendly-weather`** - Open Fira Sans with space-efficient Merriweather
- **`android`** - Complete Roboto family look
- **`kindle`** - Amazon's reading-optimized fonts
- **`office`** - Classic Microsoft Office combination
- **`modern-heritage`** - Contemporary Montserrat with timeless Georgia Pro
- **`legible`** - Reading-focused Lexend and Literata
## Gallery
![Font pairing examples gallery](thumbnail.png)
## Philosophy
The pairings in this collection follow these principles:
1. **Sans for Headlines, Serif for Body** - Following traditional typographic
wisdom for clear hierarchy
2. **Readability First** - Each pairing is tested for optimal reading experience
3. **Complementary Characteristics** - Fonts are matched based on x-height,
weight balance, and character width
4. **Practical Applications** - Selected for real-world use cases from corporate
documents to digital reading
## License
[MIT License](LICENSE).
-1
View File
@@ -1 +0,0 @@
#import "src/main.typ": font-pairings
-55
View File
@@ -1,55 +0,0 @@
#let font-pairings = (
"ibm-plex": (
heading: "IBM Plex Sans",
body: "IBM Plex Serif",
description: "A modern corporate-friendly superfamily with a wide weight range. Clean, neutral, and highly legible."
),
"noto": (
heading: "Noto Sans",
body: "Noto Serif",
description: "Huge language coverage, highly legible, and neutral. Great for multilingual documents."
),
"source": (
heading: "Source Sans 3",
body: "Source Serif 4",
description: "Adobe's open-source pair. Clean, highly readable, and well-hinted for both screen and print."
),
"friendly-weather": (
heading: "Fira Sans",
body: "Merriweather",
description: "Open, friendly sans plus a space-efficient modern serif. Good for text-heavy documents."
),
"android": (
heading: "Roboto",
body: "Roboto Serif",
description: "A complete Android-friendly look. Roboto is extremely common; Roboto Serif is its matching new serif companion."
),
"kindle": (
heading: "Amazon Ember",
body: "Bookerly",
description: "The Kindle pairing. Bookerly is a warm, book-like serif; Amazon Ember is a clean, readable sans."
),
"office": (
heading: "Calibri",
body: "Cambria",
description: "A classic Microsoft Office pairing. Calibri (sans) for headings, Cambria (serif) for body text."
),
"modern-heritage": (
heading: "Montserrat",
body: "Georgia Pro",
description: "Merges the warm, traditional forms of Georgia Pro with Montserrat’s clean, geometric lines. A modern-yet-classic pairing, equally suited to formal reports or stylish web layouts."
),
"legible": (
heading: "Lexend",
body: "Literata",
description: "An ultra-legible pairing designed for reading fluency. Lexend’s tall x-height and open shapes reduce visual stress, while Literata brings a warm, bookish feel to body text."
),
)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 KiB

-23
View File
@@ -1,23 +0,0 @@
#import "/lib.typ": *
#set page(margin: 1em, height: auto, width: 5.5in)
#set par(justify: true, linebreaks: "optimized")
#let keys = font-pairings.keys().sorted()
#for key in keys {
block(
stroke: 1pt + navy,
inset: 1em,
radius: 1em,
[
#let pairing = font-pairings.at(key)
#show heading: set text(font: pairing.heading, weight: "bold")
= #pairing.heading & #pairing.body #h(1fr) #text(fill: eastern, weight: "light", size: 0.8em, baseline: -3pt, ["#key"])
#set text(font: pairing.body, weight: "light")
#pairing.description
#lorem(20)
]
)
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 KiB

-10
View File
@@ -1,10 +0,0 @@
[package]
name = "tasteful-pairings"
version = "0.1.0"
entrypoint = "lib.typ"
authors = ["Stephen Waits <steve@waits.net>"]
license = "MIT"
description = "A carefully curated collection of font pairings."
keywords = ["font", "pairing", "typography"]
repository = "https://github.com/swaits/typst-collection"
exclude = ["thumbnail.png", "tests"]