Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More flexible features #26

Merged
merged 3 commits into from Nov 14, 2018
Merged

More flexible features #26

merged 3 commits into from Nov 14, 2018

Conversation

@zauguin
Copy link
Member

@zauguin zauguin commented Nov 11, 2018

Depends on #25. Be less restrictive when parsing feature specifiers.
Especially when loading Lua fonts or when using custom modes, the "features" might not be features in a OpenType sense. Then we might not want to limit the characters usable in the "feature" values more than necessary.
For lua-fonts this allows using the "features" as a general argument passing interface:

Example (assuming the existence of an appropriate apply_featurefile.lua):

\font "apply_featurefile.lua:file={somedir/somefile.fea};original={TeX Gyre Pagella}"
@u-fischer
Copy link
Member

@u-fischer u-fischer commented Nov 11, 2018

Looks very interesting. I will merge tomorrow, it is too late now. Do you have an idea for some new "mode" that could be used for tests (until something real comes up from the harfbuzz stuff)?

@zauguin
Copy link
Member Author

@zauguin zauguin commented Nov 11, 2018

@u-fischer The plain mode: (With some sample features)

plain_mode.tex:

fonts.readers.plain = function(spec)
  local f = font.read_tfm(spec.forcedname or spec.name, spec.size)
  local s = spec.features.raw.slant
  if s then
    f.slant = tonumber(s)
  end
  local b = spec.features.raw.bold
  if b then
    f.mode = 2
    f.width = tonumber(b)
  end
  return f
end

Example:

\documentclass{article}
\directlua{require'plain_mode'}
\font\cmrfont"cmr10:mode=plain;slant=1000;bold=500"
\begin{document}
abc\cmrfont def
\end{document}

@u-fischer u-fischer merged commit e097205 into latex3:dev Nov 14, 2018
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants