# Noto Sans fonts for invoice PDFs

Per-script Noto Sans fonts (regular and bold) used by `WP_Ultimo\Invoices\Invoice` so that invoice PDFs render
Devanagari, Bengali, Gujarati, Gurmukhi, Tamil, Malayalam, Oriya, Thaana (Dhivehi), Telugu, Kannada, Sinhala, Thai,
Lao, Khmer, Hebrew and Ethiopic text. Latin, Cyrillic, Greek, Armenian, Georgian, Arabic and Vietnamese use DejaVu
Sans Condensed from mPDF. Myanmar (Tharlon) and Sindhi (Lateef) use fonts bundled with mPDF.

## Licence

All files here are Noto fonts, licensed under the SIL Open Font License, Version 1.1. See `OFL.txt`. None of them
declares a Reserved Font Name. The files are modified versions of the published fonts (see below), which the OFL
permits; they keep the original copyright notice and licence in their name table.

| Script | Files | Source build | Version | Copyright |
|---|---|---|---|---|
| Devanagari | `NotoSansDevanagari-Regular.ttf`, `NotoSansDevanagari-Bold.ttf` | current | 2.007 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/devanagari) |
| Bengali | `NotoSansBengali-Regular.ttf`, `NotoSansBengali-Bold.ttf` | current | 3.011 | Copyright 2025 The Noto Project Authors (https://github.com/notofonts/bengali) |
| Gujarati | `NotoSansGujarati-Regular.ttf`, `NotoSansGujarati-Bold.ttf` | current | 2.106 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/gujarati) |
| Gurmukhi | `NotoSansGurmukhi-Regular.ttf`, `NotoSansGurmukhi-Bold.ttf` | legacy | 1.03 uh | Copyright 2013 Google Inc. All Rights Reserved. |
| Tamil | `NotoSansTamil-Regular.ttf`, `NotoSansTamil-Bold.ttf` | current | 2.004 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/tamil) |
| Malayalam | `NotoSansMalayalam-Regular.ttf`, `NotoSansMalayalam-Bold.ttf` | legacy | 1.04 uh | Copyright 2013 Google Inc. All Rights Reserved. |
| Oriya | `NotoSansOriya-Regular.ttf`, `NotoSansOriya-Bold.ttf` | current | 2.007 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/oriya) |
| Thaana | `NotoSansThaana-Regular.ttf`, `NotoSansThaana-Bold.ttf` | current | 3.001 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/thaana) |
| Telugu | `NotoSansTelugu-Regular.ttf`, `NotoSansTelugu-Bold.ttf` | current | 2.005 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/telugu) |
| Kannada | `NotoSansKannada-Regular.ttf`, `NotoSansKannada-Bold.ttf` | current | 2.006 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/kannada) |
| Sinhala | `NotoSansSinhala-Regular.ttf`, `NotoSansSinhala-Bold.ttf` | legacy | 2.000 | Copyright 2016 Google Inc. All Rights Reserved. |
| Thai | `NotoSansThai-Regular.ttf`, `NotoSansThai-Bold.ttf` | legacy | 2.000 | Copyright 2016 Google Inc. All Rights Reserved. |
| Lao | `NotoSansLao-Regular.ttf`, `NotoSansLao-Bold.ttf` | legacy | 2.000 | Copyright 2017 Google Inc. All Rights Reserved. |
| Khmer | `NotoSansKhmer-Regular.ttf`, `NotoSansKhmer-Bold.ttf` | legacy | 2.000 | Copyright 2016 Google Inc. All Rights Reserved. |
| Hebrew | `NotoSansHebrew-Regular.ttf`, `NotoSansHebrew-Bold.ttf` | legacy | 2.000 | Copyright 2015 Google Inc. All Rights Reserved. |
| Ethiopic | `NotoSansEthiopic-Regular.ttf`, `NotoSansEthiopic-Bold.ttf` | legacy | 2.000 | Copyright 2015 Google Inc. All Rights Reserved. |

## Modifications

The fonts are generated by `scripts/build-invoice-fonts.py`. It does not redraw any glyph. It makes the fonts loadable
and shapeable by mPDF: removes OpenType features mPDF cannot process, removes overlapping contours, normalises units
per em to 1000, and adds the ASCII digits, punctuation and a few symbols from Noto Sans (mPDF renders digits and
punctuation next to non-Latin text with the neighbouring script's font). The script header explains each step.

Each script has its own file on purpose: putting several scripts in one font makes mPDF break words in the middle of
a cluster when wrapping text.

## Regenerating

```bash
pip install -r scripts/build-invoice-fonts-requirements.txt

# Current builds (static, unhinted), e.g. for Devanagari:
gh api -H "Accept: application/vnd.github.raw" \
  repos/notofonts/notofonts.github.io/contents/fonts/NotoSansDevanagari/unhinted/ttf/NotoSansDevanagari-Regular.ttf > current/NotoSansDevanagari-Regular.ttf

# Legacy builds (tag v2017-10-24-phase3-second-cleanup of the archived noto-fonts repository), e.g. for Thai:
gh api -H "Accept: application/vnd.github.raw" \
  "repos/notofonts/noto-fonts/contents/unhinted/NotoSansThai-Regular.ttf?ref=v2017-10-24-phase3-second-cleanup" > legacy/NotoSansThai-Regular.ttf

# Noto Sans (Latin) for the ASCII glyphs:
gh api -H "Accept: application/vnd.github.raw" \
  repos/notofonts/notofonts.github.io/contents/fonts/NotoSans/unhinted/ttf/NotoSans-Regular.ttf > latin/NotoSans-Regular.ttf

python3 scripts/build-invoice-fonts.py --current current --legacy legacy --latin latin --out assets/fonts/noto
```

Download each script and weight listed in the table (the "Source build" column says which directory), plus
`NotoSans-Regular.ttf` and `NotoSans-Bold.ttf`. The output differs from the committed files only in the header
modification timestamp.

When a font changes, bump `Language_To_Font::FONT_VERSION`: mPDF caches parsed fonts by font name in the temporary
directory, so a new version needs new names or sites keep serving stale data.
