Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

Languages and Scripts

How the lang attribute selects typography for each script, quotation marks for each language and the display of ruby annotations.

The lang attribute

Set lang on <html> for the page and on any element whose content is in another language. The rules below are written with :lang(), which matches the element and everything inside it, so one attribute on a section is enough.

Typography by script

Scripts differ in more than their letters. Chinese, Japanese and Korean text has no spaces to break lines at. Arabic and Thai have marks above and below the line that collide at a Latin line height. For each script the library sets a typeface stack, a line height and line-breaking rules.

Supported scripts

ScriptLanguagesTokenLine height
CJKzh, ja, ko--font-cjk1.8
Arabicar, fa, ur, ps--font-arabic1.9
Hebrewhe, yi--font-hebrew1.75
Thaith--font-thai2.0
Devanagarihi, mr, sa, ne--font-devanagari1.75

Typeface tokens

Each script has a token that holds its typeface stack. The defaults name fonts that ship with the common operating systems. Override a token to use a font you serve.

The Typography guide covers the type system for Latin text. Typefaces lists the fonts served with the library.

Quotation marks

The <q> element draws the quotation marks of the language it is in. Write <q> and leave the marks out of your text. The same sentence is then correct in every translation.

LanguageOuterInner
English (US)“...”‘...’
English (GB, AU, NZ)‘...’“...”
German„...“‚...‘
Swiss German (de-CH)«...»‹...›
French« ... »‹ ... ›
Italian / Spanish / Portuguese (pt-PT)«...»“...”
Portuguese (pt, pt-BR)“...”‘...’
Polish„...”«...»
Japanese / Chinese Traditional (zh-Hant, TW, HK, MO)「...」『...』
Chinese Simplified (zh, zh-Hans)“...”‘...’
Korean“...”‘...’
Russian«...»„...“
Arabic«...»‘...’
Any other languageBrowser default (quotes: auto)

Ruby annotations

<ruby> places a small reading aid above or beside a character, as furigana does in Japanese and pinyin in Chinese.

Annotations are visible by default. Put data-ruby on <html>, any ancestor, or the <ruby> itself to change that for its subtree; the nearest data-ruby wins:

ValueBehavior
(absent)Visible (browser default)
showVisible; undoes an outer hide or auto
hideVisually hidden, still in the accessibility tree
autoVisible when the annotation's own language is CJK (ja, zh, ko, yue, wuu), visually hidden otherwise
↑