Skip to content

Comments

Add LuaLaTeX font constructor example for Harfbuzz renderer#8

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/update-documentation-for-measurements
Draft

Add LuaLaTeX font constructor example for Harfbuzz renderer#8
Copilot wants to merge 6 commits intomainfrom
copilot/update-documentation-for-measurements

Conversation

Copy link

Copilot AI commented Jan 26, 2026

Adds example demonstrating font manipulation via fonts.constructors.features.otf.register with Harfbuzz renderer, based on babel discussion #346.

Implementation

  • examples/lualatex-font-constructor/font-constructor-example.tex: Working example showing custom font feature registration that modifies vowel width and color using virtual font commands
  • examples/lualatex-font-constructor/README.md: Technical documentation covering manipulator functions, feature registration for base/node/plug renderers, and VF command usage
  • examples/README.md: Examples directory index

Example

\directlua{
  function redden(f)
    local u = unicode.utf8
    for i, v in pairs(f.characters) do
      if i < 256 and u.find(u.char(i), '[aeiouó]') then
        v.width = tex.sp('7pt')
        v.commands = {
          { "special", "pdf: 1 0 0 rg" },
          { "char", i },
          { "special", "pdf: 0 g" }
        }
      end
    end
  end

  fonts.constructors.features.otf.register {
    name = "redden",
    manipulators = { base = redden, node = redden, plug = redden }
  }
}

\setmainfont[RawFeature=+redden, Renderer=Harfbuzz]{FreeSerif}

Demonstrates technique for language-specific typography, custom ligatures, and character-level font modifications since fonts.handlers.otf.addfeature doesn't support Harfbuzz.

Original prompt

latex3/babel#346


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits January 26, 2026 13:59
Co-authored-by: paseka10jaroslav-coder <252813980+paseka10jaroslav-coder@users.noreply.github.com>
Co-authored-by: paseka10jaroslav-coder <252813980+paseka10jaroslav-coder@users.noreply.github.com>
Co-authored-by: paseka10jaroslav-coder <252813980+paseka10jaroslav-coder@users.noreply.github.com>
Co-authored-by: paseka10jaroslav-coder <252813980+paseka10jaroslav-coder@users.noreply.github.com>
Co-authored-by: paseka10jaroslav-coder <252813980+paseka10jaroslav-coder@users.noreply.github.com>
Copilot AI changed the title [WIP] Update documentation for measurements in babel Add LuaLaTeX font constructor example for Harfbuzz renderer Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants