Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,18 @@ generated at build time and shipped beside this file.
so nothing of PipeWire's ships inside our installers beyond the compiled
result of its headers (inline functions and struct layouts).

## Fonts — Inter, Lora, Oswald, Caveat, IBM Plex Mono
## Fonts — Inter, Lora, Oswald, Caveat, IBM Plex Mono, Vazirmatn

- **Components**: the Regular and Bold `.ttf` of each family, under
`resources/fonts/`.
`resources/fonts/`. The renderer also ships a variable Vazirmatn WOFF2
face for the Persian and Arabic interfaces.
- **Used by**: the native compositor, which draws captions and annotations with
these files and nothing else (it registers them privately at start and never
reads the fonts installed on the machine), and the editor's font picker.
- **License**: **SIL Open Font License 1.1** — <https://openfontlicense.org>.
Each family's copyright notice and licence text ship beside its files as
`<Family>-OFL.txt`, as the licence requires.
- **Unmodified**: every file is redistributed exactly as upstream publishes it,
- **Unmodified**: the font files are redistributed exactly as upstream publishes them,
which is also why the Reserved Font Names "Lora" and "Plex" are kept.
- **Upstream**:
- Inter — Copyright 2016 The Inter Project Authors. `extras/ttf/` of the v4.1
Expand All @@ -164,6 +165,9 @@ generated at build time and shipped beside this file.
<https://github.com/googlefonts/caveat> at `59745e818e`.
- IBM Plex Mono 2.3 — Copyright © 2017 IBM Corp. `ofl/ibmplexmono/` of
<https://github.com/google/fonts> at `23e54b51dd`.
- Vazirmatn 33.003 — Copyright 2015 The Vazirmatn Project Authors.
`fonts/ttf/` and `fonts/webfonts/` of
<https://github.com/rastikerdar/vazirmatn/releases/tag/v33.003>.

## Recordly — helper code

Expand Down
4 changes: 2 additions & 2 deletions crates/compositor/src/text_fonts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub(crate) fn repo_fonts_dir() -> PathBuf {
/// Les familles embarquées, telles que l'app les stocke. Miroir de `TEXT_FONT_FAMILIES`
/// (`src/lib/textFonts.ts`), dont le test vérifie que chaque fichier porte bien ce nom.
#[cfg(test)]
pub(crate) const SHIPPED_FAMILIES: [&str; 5] =
["Inter", "Lora", "Oswald", "Caveat", "IBM Plex Mono"];
pub(crate) const SHIPPED_FAMILIES: [&str; 6] =
["Inter", "Lora", "Oswald", "Caveat", "IBM Plex Mono", "Vazirmatn"];

/// Chaque famille se voit : deux familles se confondent quand elles dessinent le même bloc,
/// même largeur ET même hauteur à 2 % près, et un repli commun les confondrait toutes. La
Expand Down
Binary file added public/fonts/Vazirmatn-Bold.ttf
Binary file not shown.
93 changes: 93 additions & 0 deletions public/fonts/Vazirmatn-OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2015 The Vazirmatn Project Authors (https://github.com/rastikerdar/vazirmatn)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added public/fonts/Vazirmatn-Regular.ttf
Binary file not shown.
Binary file added src/assets/fonts/Vazirmatn-Variable.woff2
Binary file not shown.
15 changes: 9 additions & 6 deletions src/components/ai-edition/CaptionsPane.choices.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@ describe("caption choices", () => {
expect(stored().language).toBe("fr");
});

it("shows each font as a specimen of itself and writes the one clicked", () => {
it.each([
"Lora",
"Vazirmatn",
])("shows %s as a specimen of itself and saves the choice", (family) => {
show();
const lora = within(screen.getByRole("group", { name: "Font", hidden: true })).getByRole(
const font = within(screen.getByRole("group", { name: "Font", hidden: true })).getByRole(
"button",
{ name: "Lora", hidden: true },
{ name: family, hidden: true },
);
expect(lora.querySelector("span")).toHaveStyle({ fontFamily: "Lora" });
fireEvent.click(lora);
expect(stored().fontFamily).toBe("Lora");
expect(font.querySelector("span")).toHaveStyle({ fontFamily: family });
fireEvent.click(font);
expect(stored().fontFamily).toBe(family);
});

it("never lets the minimum words per line pass the maximum", () => {
Expand Down
10 changes: 10 additions & 0 deletions src/lib/ai-edition/annotations/fontTables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ describe("readFontMetrics", () => {
expect(inter.advanceOf(0x4e2d)).toBeNull();
});

it.each([
"normal",
"bold",
] as const)("includes Persian and Arabic glyphs in Vazirmatn %s", (weight) => {
const font = shipped("Vazirmatn", weight);
for (const character of "پچژگکی۰۱۲۳۴۵۶۷۸۹أإةى٠١٢٣٤٥٦٧٨٩") {
expect(font.advanceOf(character.codePointAt(0) ?? 0), character).toBeGreaterThan(0);
}
});

it("refuses bytes that are not a font", () => {
expect(readFontMetrics(new Uint8Array([1, 2, 3, 4]))).toBeNull();
});
Expand Down
9 changes: 8 additions & 1 deletion src/lib/textFonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@

import { getAssetPath } from "./assetPath";

export const TEXT_FONT_FAMILIES = ["Inter", "Lora", "Oswald", "Caveat", "IBM Plex Mono"] as const;
export const TEXT_FONT_FAMILIES = [
"Inter",
"Lora",
"Oswald",
"Caveat",
"IBM Plex Mono",
"Vazirmatn",
] as const;

export type TextFontFamily = (typeof TEXT_FONT_FAMILIES)[number];

Expand Down
10 changes: 8 additions & 2 deletions src/styles/design-tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@
/* typography — Geist / Geist Mono are the brand faces, self-hosted by
styles/fonts.css. The old system stacks stay on as fallback so a failed
font load degrades instead of dropping to a serif default. */
--font-display: "Geist", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
--font-body: "Geist", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
--font-ui: "Geist";
--font-body: var(--font-ui), system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
--font-display: var(--font-body);
--font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

/* size */
Expand Down Expand Up @@ -184,6 +185,11 @@
--ease: cubic-bezier(0.2, 0, 0, 1);
}

:root:lang(fa),
:root:lang(ar) {
--font-ui: "Vazirmatn UI", "Geist";
}

:root[data-theme="dark"] {
--bg: #0a0d12;
--bg-grad: radial-gradient(ellipse at 50% 0%, #13171f 0%, #0a0d12 60%);
Expand Down
17 changes: 14 additions & 3 deletions src/styles/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
* --font-body / --font-mono in design-tokens.css.
*
* Self-hosted rather than pulled from Google Fonts on purpose: this is a
* desktop app that has to start with no network, and the whole UI chrome
* hangs off these two families. (The on-canvas caption/annotation families
* are separate: public/fonts, registered by lib/textFonts.ts.)
* desktop app that has to start with no network. The on-canvas caption
* and annotation families are registered separately by lib/textFonts.ts.
*
* One variable file per family covers weights 100-900, so the pair costs
* ~138 KB instead of the ~19 static cuts it replaces. Upstream:
Expand All @@ -28,3 +27,15 @@
font-style: normal;
font-display: swap;
}

/* The UI uses the variable face. The video compositor uses the static
regular and bold faces in public/fonts, alongside the OFL licence.
Limit the UI face to Arabic script so Latin labels still use Geist. */
@font-face {
font-family: "Vazirmatn UI";
src: url("../assets/fonts/Vazirmatn-Variable.woff2") format("woff2");
font-weight: 100 900;
font-style: normal;
font-display: swap;
unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200D, U+FB50-FDFF, U+FE70-FEFF;
}
Loading