1Upstream style file relies on font files being present on the system
2globally. This is not quite how Nix usually does thing, so this patch
3changes the style file to instead look fonts up in hardcoded
4locations, which are later patched up to refer to the package outputs,
5thus ensuring the style always uses the fonts packaged with it.
6
7diff --git a/TeX/junicode.sty b/TeX/junicode.sty
8index 83bd45d..8fe671c 100644
9--- a/TeX/junicode.sty
10+++ b/TeX/junicode.sty
11@@ -208,7 +208,14 @@
12
13 \RequirePackage{fontspec}
14 \defaultfontfeatures{Ligatures=TeX, Extension=.\junicode@fonttype}
15-\defaultfontfeatures{Ligatures=TeX}
16+
17+\def\junicode@fonttype@otf{otf}
18+
19+\ifx\junicode@fonttype\junicode@fonttype@otf
20+ \def\junicode@fontpath{@@@opentype_path@@@}
21+\else
22+ \def\junicode@fontpath{@@@truetype_path@@@}
23+\fi
24
25 \ifxetex
26 \typeout{\junicode@regstylename}
27@@ -219,6 +226,7 @@
28 ItalicFont = *-\junicode@italstylename,
29 BoldFont = *-\junicode@boldstylename,
30 BoldItalicFont = *-\junicode@boldstylename Italic,
31+ Path = \junicode@fontpath,
32 ]{Junicode}
33 \fi
34 \ifluatex
35@@ -230,6 +238,7 @@
36 ItalicFont = *-\junicode@italstylename,
37 BoldFont = *-\junicode@boldstylename,
38 BoldItalicFont = *-\junicode@boldstylename Italic,
39+ Path = \junicode@fontpath,
40 ]{Junicode}
41 \fi
42
43@@ -242,6 +251,7 @@
44 #3
45 Numbers = {\junicode@figurealign,\junicode@figurestyle},
46 SmallCapsFeatures = {Letters=SmallCaps},
47+ Path = \junicode@fontpath,
48 ]
49 }
50 \fi
51@@ -252,6 +262,7 @@
52 #3
53 Numbers = {\junicode@figurealign,\junicode@figurestyle},
54 SmallCapsFeatures = {Letters=SmallCaps},
55+ Path = \junicode@fontpath,
56 ]
57 }
58 \fi
59diff --git a/TeX/junicodevf.lua b/TeX/junicodevf.lua
60index 7148668..acebe82 100644
61--- a/TeX/junicodevf.lua
62+++ b/TeX/junicodevf.lua
63@@ -148,7 +148,7 @@ function mkfontcommands()
64 romfontcmd = "jRegular"
65 italfontcmd = "jItalic"
66 end
67- tex.print("\\junicodevf@newfont{\\" .. romfontcmd .. "}{JunicodeVF}{\\" .. defcmd .. "}{\\" .. defsizecmd .. "}")
68+ tex.print("\\junicodevf@newfont{\\" .. romfontcmd .. "}{JunicodeVF-Roman}{\\" .. defcmd .. "}{\\" .. defsizecmd .. "}")
69 tex.print("\\junicodevf@newfont{\\" .. italfontcmd .. "}{JunicodeVF-Italic}{\\" .. defcmd .. "}{\\" .. defsizecmd .. "}")
70 end
71 end
72diff --git a/TeX/junicodevf.sty b/TeX/junicodevf.sty
73index c01ccaf..07a99ad 100644
74--- a/TeX/junicodevf.sty
75+++ b/TeX/junicodevf.sty
76@@ -168,11 +168,13 @@ mkwidthcommands(wdindex, adjustment)}}
77
78 % DECLARE THE FONTS
79
80-\setmainfont{Junicode VF}[
81- ItalicFont = {*-Italic},
82- BoldFont = {*},
83- BoldItalicFont = {*-Italic},
84+\setmainfont{JunicodeVF-Roman}[
85+ ItalicFont = {JunicodeVF-Italic},
86+ BoldFont = {JunicodeVF-Roman},
87+ BoldItalicFont = {JunicodeVF-Italic},
88 Renderer = HarfBuzz,
89+ Extension = .ttf,
90+ Path = @@@truetype_path@@@,
91 Numbers = {\junicodevf@figurealign,\junicodevf@figurestyle},
92 \MainDef,
93 UprightFeatures = {\MainRegDef
94@@ -188,6 +190,8 @@ mkwidthcommands(wdindex, adjustment)}}
95 \newcommand*{\junicodevf@newfont}[4]{
96 \setfontface#1{#2}[
97 Renderer = HarfBuzz,
98+ Extension = .ttf,
99+ Path = @@@truetype_path@@@,
100 Numbers = {\junicodevf@figurealign,\junicodevf@figurestyle},
101 SmallCapsFont = {*},
102 SmallCapsFeatures = {Letters=SmallCaps},
103@@ -200,43 +204,59 @@ mkwidthcommands(wdindex, adjustment)}}
104
105 % ENLARGED FACES
106
107-\setfontface\EnlargedOne{JunicodeVF}[
108+\setfontface\EnlargedOne{JunicodeVF-Roman}[
109 Renderer = HarfBuzz,
110+ Extension = .ttf,
111+ Path = @@@truetype_path@@@,
112 \ENLAOneSizeDef
113 ]
114
115 \setfontface\EnlargedOneItalic{JunicodeVF-Italic}[
116 Renderer = HarfBuzz,
117+ Extension = .ttf,
118+ Path = @@@truetype_path@@@,
119 \ENLAOneSizeDef
120 ]
121
122-\setfontface\EnlargedTwo{JunicodeVF}[
123+\setfontface\EnlargedTwo{JunicodeVF-Roman}[
124 Renderer = HarfBuzz,
125+ Extension = .ttf,
126+ Path = @@@truetype_path@@@,
127 \ENLATwoSizeDef
128 ]
129
130 \setfontface\EnlargedTwoItalic{JunicodeVF-Italic}[
131 Renderer = HarfBuzz,
132+ Extension = .ttf,
133+ Path = @@@truetype_path@@@,
134 \ENLATwoSizeDef
135 ]
136
137-\setfontface\EnlargedThree{JunicodeVF}[
138+\setfontface\EnlargedThree{JunicodeVF-Roman}[
139 Renderer = HarfBuzz,
140+ Extension = .ttf,
141+ Path = @@@truetype_path@@@,
142 \ENLAThreeSizeDef
143 ]
144
145 \setfontface\EnlargedThreeItalic{JunicodeVF-Italic}[
146 Renderer = HarfBuzz,
147+ Extension = .ttf,
148+ Path = @@@truetype_path@@@,
149 \ENLAThreeSizeDef
150 ]
151
152-\setfontface\EnlargedFour{JunicodeVF}[
153+\setfontface\EnlargedFour{JunicodeVF-Roman}[
154 Renderer = HarfBuzz,
155+ Extension = .ttf,
156+ Path = @@@truetype_path@@@,
157 \ENLAFourSizeDef
158 ]
159
160 \setfontface\EnlargedFourItalic{JunicodeVF-Italic}[
161 Renderer = HarfBuzz,
162+ Extension = .ttf,
163+ Path = @@@truetype_path@@@,
164 \ENLAFourSizeDef
165 ]
166