base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / ju / junicode / tex-font-path.patch
blob3e0fd69b36dfff46942677a82eed4fed6a02c2e7
1 Upstream style file relies on font files being present on the system
2 globally. This is not quite how Nix usually does thing, so this patch
3 changes the style file to instead look fonts up in hardcoded
4 locations, which are later patched up to refer to the package outputs,
5 thus ensuring the style always uses the fonts packaged with it.
7 diff --git a/TeX/junicode.sty b/TeX/junicode.sty
8 index 83bd45d..8fe671c 100644
9 --- a/TeX/junicode.sty
10 +++ b/TeX/junicode.sty
11 @@ -208,7 +208,14 @@
13 \RequirePackage{fontspec}
14 \defaultfontfeatures{Ligatures=TeX, Extension=.\junicode@fonttype}
15 -\defaultfontfeatures{Ligatures=TeX}
17 +\def\junicode@fonttype@otf{otf}
19 +\ifx\junicode@fonttype\junicode@fonttype@otf
20 + \def\junicode@fontpath{@@@opentype_path@@@}
21 +\else
22 + \def\junicode@fontpath{@@@truetype_path@@@}
23 +\fi
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
43 @@ -242,6 +251,7 @@
45 Numbers = {\junicode@figurealign,\junicode@figurestyle},
46 SmallCapsFeatures = {Letters=SmallCaps},
47 + Path = \junicode@fontpath,
50 \fi
51 @@ -252,6 +262,7 @@
53 Numbers = {\junicode@figurealign,\junicode@figurestyle},
54 SmallCapsFeatures = {Letters=SmallCaps},
55 + Path = \junicode@fontpath,
58 \fi
59 diff --git a/TeX/junicodevf.lua b/TeX/junicodevf.lua
60 index 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
72 diff --git a/TeX/junicodevf.sty b/TeX/junicodevf.sty
73 index c01ccaf..07a99ad 100644
74 --- a/TeX/junicodevf.sty
75 +++ b/TeX/junicodevf.sty
76 @@ -168,11 +168,13 @@ mkwidthcommands(wdindex, adjustment)}}
78 % DECLARE THE FONTS
80 -\setmainfont{JunicodeVF}[
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)}}
105 % ENLARGED FACES
107 -\setfontface\EnlargedOne{JunicodeVF}[
108 +\setfontface\EnlargedOne{JunicodeVF-Roman}[
109 Renderer = HarfBuzz,
110 + Extension = .ttf,
111 + Path = @@@truetype_path@@@,
112 \ENLAOneSizeDef
115 \setfontface\EnlargedOneItalic{JunicodeVF-Italic}[
116 Renderer = HarfBuzz,
117 + Extension = .ttf,
118 + Path = @@@truetype_path@@@,
119 \ENLAOneSizeDef
122 -\setfontface\EnlargedTwo{JunicodeVF}[
123 +\setfontface\EnlargedTwo{JunicodeVF-Roman}[
124 Renderer = HarfBuzz,
125 + Extension = .ttf,
126 + Path = @@@truetype_path@@@,
127 \ENLATwoSizeDef
130 \setfontface\EnlargedTwoItalic{JunicodeVF-Italic}[
131 Renderer = HarfBuzz,
132 + Extension = .ttf,
133 + Path = @@@truetype_path@@@,
134 \ENLATwoSizeDef
137 -\setfontface\EnlargedThree{JunicodeVF}[
138 +\setfontface\EnlargedThree{JunicodeVF-Roman}[
139 Renderer = HarfBuzz,
140 + Extension = .ttf,
141 + Path = @@@truetype_path@@@,
142 \ENLAThreeSizeDef
145 \setfontface\EnlargedThreeItalic{JunicodeVF-Italic}[
146 Renderer = HarfBuzz,
147 + Extension = .ttf,
148 + Path = @@@truetype_path@@@,
149 \ENLAThreeSizeDef
152 -\setfontface\EnlargedFour{JunicodeVF}[
153 +\setfontface\EnlargedFour{JunicodeVF-Roman}[
154 Renderer = HarfBuzz,
155 + Extension = .ttf,
156 + Path = @@@truetype_path@@@,
157 \ENLAFourSizeDef
160 \setfontface\EnlargedFourItalic{JunicodeVF-Italic}[
161 Renderer = HarfBuzz,
162 + Extension = .ttf,
163 + Path = @@@truetype_path@@@,
164 \ENLAFourSizeDef