latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
276 stars 33 forks source link

Always add some font features #397

Closed zauguin closed 4 years ago

zauguin commented 4 years ago

Status

READY

Description

Always add \l_@@_pre_feat_sclist features when loading a font. The main motivation is HarfBuzz support in LuaTeX: The current approach loads HarfBuzz font without mode=harf first, forcing the traditional fontloader to load the font. This is a problem especially for very big fonts for which caching can be very slow using the ConTeXt fontloader.

This fixes that by passing all features in \l_@@_pre_feat_sclist for all font requests, leaving no font load without mode parameter.

Todos

Minimal example demonstrating the new/fixed functionality

For example the following file should compile significantly faster and with much less memory usage if "Noto Serif CJK KR" isn't already cached.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Noto Serif CJK KR}[
  Renderer = Harfbuzz,
]
\begin{document}
\end{document}