From a7c2ddb10ab81e98842c195523587ade1b5624d5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 19 Jul 2022 20:06:54 +0000 Subject: yfonts-otf (19jul22) git-svn-id: svn://tug.org/texlive/trunk@63936 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/yfonts-otf/oldgerm-otf.sty | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/yfonts-otf/oldgerm-otf.sty (limited to 'Master/texmf-dist/tex/latex/yfonts-otf') diff --git a/Master/texmf-dist/tex/latex/yfonts-otf/oldgerm-otf.sty b/Master/texmf-dist/tex/latex/yfonts-otf/oldgerm-otf.sty new file mode 100644 index 00000000000..e58caaeb909 --- /dev/null +++ b/Master/texmf-dist/tex/latex/yfonts-otf/oldgerm-otf.sty @@ -0,0 +1,89 @@ +\NeedsTeXFormat{LaTeX2e}[2019-01-01] +\def\fileversion{0.30} +\def\filedate{2022-07-18} +\ProvidesPackage{oldgerm-otf}[\filedate\space\fileversion] +\RequirePackage{iftex}[2019-10-24] +\newif\ifOGotf@oldumlaut +\newif\ifOGotf@gothlongs +\DeclareOption{oldumlaut}{\OGotf@oldumlauttrue} +\DeclareOption{gothvarlongs}{\OGotf@gothlongstrue} +\ProcessOptions +\iftutex + \RequirePackage{fontspec} + \ifOGotf@gothlongs + \newfontfamily\gothfamily{ygoth.otf}% + [Alternate=1, RawFeature=+hist;+rlig;+liga;+dlig;+hlig;+alig;+calt] + \else + \newfontfamily\gothfamily{ygoth.otf}% + [RawFeature=+hist;+rlig;+liga;+dlig;+hlig;+alig;+calt] + \fi + \ifOGotf@oldumlaut + \newfontfamily\swabfamily{yswab.otf}% + [Alternate=0, RawFeature=+hist;+rlig;+liga;+dlig;+hlig;+calt] + \newfontfamily\frakfamily{yfrak.otf}% + [Alternate=0, RawFeature=+hist;+rlig;+liga;+dlig;+hlig;+calt] + \else + \newfontfamily\swabfamily{yswab.otf}% + [RawFeature=+hist;+rlig;+liga;+dlig;+hlig;+calt] + \newfontfamily\frakfamily{yfrak.otf}% + [RawFeature=+hist;+rlig;+liga;+dlig;+hlig;+calt] + \fi + \DeclareTextFontCommand{\textgoth}{\gothfamily} + \DeclareTextFontCommand{\textswab}{\swabfamily} + \DeclareTextFontCommand{\textfrak}{\frakfamily} + \DeclareTextCommand{\Jvar}{TU}{\textfrak{\char"E960}} + \DeclareTextCommand{\etc}{TU}{\textfrak{\char"E961}} + \ifluatex + % This function adds character U+200B (zero width space) when an "s" + % is followed by a TeX space (glue or penalty or a disc) + % so that it is not turned into a long "s" by the "calt" feature. + \directlua{% + function add_eow_char (head) + local eow = 0x200B + local GLUE = node.id("glue") + local GLYPH = node.id("glyph") + local PENALTY = node.id("penalty") + local DISC = node.id("disc") + local Longs = + {[string.byte("s")] = true} + local new_node = node.new + local copy_node = node.copy + local insert_node_after = node.insert_after + % Perserve TeX's kerning + head = node.kerning(head) + % wordbd is the zero width node to add + local wordbd = new_node(GLYPH) + for item in node.traverse_id(GLYPH, head) do + if Longs[item.char] then + local fid = item.font + % Check if char U+200B is available in the current font: + % code borrowed from file "luaotfload-auxiliary.lua". + local fontdata = fonts.hashes.identifiers[fid] + if fontdata and fontdata.characters[eow] then + local nxt = item.next + if not nxt or nxt.id == GLUE or nxt.id == PENALTY + or nxt.id == DISC then + wordbd.font = fid + wordbd.char = eow + wordbd.attr = item.attr + insert_node_after(head,item,copy_node(wordbd)) + end + end + end + end + end + } + % Register in callback "kerning". + \AtBeginDocument{% + \directlua{ + luatexbase.add_to_callback("kerning", add_eow_char, + "add_end_of_word_boundary"); + }% + } + \fi +\else + \PackageWarning{oldgerm-otf}% + {This package requires LuaTeX or XeTeX engines. + With other engines, consider using `oldgerm.sty', reported} +\fi +\endinput -- cgit v1.2.3