Contextual alternates

문맥 대체 글자

Redrawing the same letter differently depending on its neighbors — more flexible than a ligature, which only ever looks at one fixed pair.

Also known as: caltContextual forms
···
html
<div class="stage">
  <span class="word" id="w">William Willow</span>
  <div class="readout" id="readout">측정 중…</div>
</div>
css
.word{font:700 7.5vmin/1.3 Georgia,'Times New Roman',serif;color:var(--fg);display:block;text-align:center}
.readout{margin-top:14px;font:11px ui-monospace,Menlo,monospace;color:var(--muted);text-align:center;max-width:280px}
js
const w = document.getElementById('w');
const readout = document.getElementById('readout');
const offWidth = (function(){ w.style.fontVariantLigatures = 'no-contextual'; return w.getBoundingClientRect().width; })();
let on = false;
let measured = false;
function apply(){
  on = !on;
  w.style.fontVariantLigatures = on ? 'contextual' : 'no-contextual';
  if (!measured){
    measured = true;
    setTimeout(function(){
      const onWidth = w.getBoundingClientRect().width;
      readout.textContent = Math.abs(onWidth - offWidth) > 0.4
        ? '실측: contextual 켰을 때 폭이 달라짐 — 이 폰트에 calt 규칙이 있음'
        : '실측: 폭 동일 — 이 시스템 폰트엔 이 테스트 문구로 감지되는 calt 규칙이 없어 보임';
    }, 50);
  }
}
apply();
setInterval(apply, 1600);

Where a ligature (`liga`) is a rule for one fixed pair — "when fi sit together, always draw this shape" — contextual alternates (`calt`) can look at broader conditions. A script typeface might reshape a letter's connecting stroke to flow naturally from whatever precedes it, or swap in a slightly different alternate when the same letterform would otherwise repeat monotonously in a row.

In writing systems like Arabic, where a letter's shape changes completely depending on its position within a word (initial, medial, final), `calt` isn't decoration — it's required for correct rendering. In Latin type it's usually a subtle refinement most readers never consciously notice, even when it's active.

CSS's `font-variant-ligatures` controls it through the `contextual` keyword, on by default in most browsers (turn it off with `no-contextual`). The demo toggles this and measures whether the system font's rendered width actually changes — a Latin sans-serif system font may have few or no `calt` rules, in which case the demo reports that honestly rather than claiming an effect that isn't there.

When to use

Leave the default (on) alone. Consciously think about this feature only when working with a script — like Arabic — where positional letterforms are mandatory, not optional polish.