summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua14
-rw-r--r--tex/generic/context/luatex/luatex-languages.lua45
-rw-r--r--tex/generic/context/luatex/luatex-languages.tex17
-rw-r--r--tex/generic/context/luatex/luatex-plain.tex7
-rw-r--r--tex/generic/context/luatex/luatex-test.tex11
5 files changed, 86 insertions, 8 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 512d71faa..29cba0db3 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 11/14/12 11:37:52
+-- merge date : 11/16/12 23:27:39
do -- begin closure to overcome local limits and interference
@@ -924,7 +924,7 @@ local function flattened(t,f,depth)
f = { }
depth = 0xFFFF
elseif tonumber(f) then
- -- assume then only two arguments are given
+ -- assume that only two arguments are given
depth = f
f = { }
elseif not depth then
@@ -12637,6 +12637,7 @@ local readers = fonts.readers
local definers = fonts.definers
local specifiers = fonts.specifiers
local constructors = fonts.constructors
+local fontgoodies = fonts.goodies
readers.sequence = allocate { 'otf', 'ttf', 'afm', 'tfm', 'lua' } -- dfont ttc
@@ -12650,6 +12651,8 @@ local internalized = allocate() -- internal tex numbers (private)
local loadedfonts = constructors.loadedfonts
local designsizes = constructors.designsizes
+local resolvefile = fontgoodies.filenames.resolve
+
--[[ldx--
<p>We hardly gain anything when we cache the final (pre scaled)
<l n='tfm'/> table. But it can be handy for debugging, so we no
@@ -12767,10 +12770,13 @@ local resolvers = definers.resolvers
-- todo: reporter
function resolvers.file(specification)
- local suffix = file.suffix(specification.name)
+ local name = resolvefile(specification.name) -- catch for renames
+ local suffix = file.suffix(name)
if fonts.formats[suffix] then
specification.forced = suffix
- specification.name = file.removesuffix(specification.name)
+ specification.name = file.removesuffix(name)
+ else
+ specification.name = name -- cna be resolved
end
end
diff --git a/tex/generic/context/luatex/luatex-languages.lua b/tex/generic/context/luatex/luatex-languages.lua
new file mode 100644
index 000000000..712118dbc
--- /dev/null
+++ b/tex/generic/context/luatex/luatex-languages.lua
@@ -0,0 +1,45 @@
+if not modules then modules = { } end modules ['luatex-languages'] = {
+ version = 1.001,
+ comment = "companion to luatex-languages.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- We borrow fron ConTeXt.
+
+languages = languages or { }
+
+local loaded = { }
+
+function languages.loadpatterns(tag)
+ if not loaded[tag] then
+ loaded[tag] = 0
+ local filename = kpse.find_file("lang-" .. tag .. ".lua")
+ if filename and filename == "" then
+ print("<unknown language file for: " .. tag .. ">")
+ else
+ local whatever = loadfile(filename)
+ if type(whatever) == "function" then
+ whatever = whatever()
+ if type(whatever) == "table" then
+ local characters = whatever.patterns.characters or ""
+ local patterns = whatever.patterns.data or ""
+ local exceptions = whatever.exceptions.data or ""
+ local language = lang.new()
+ for b in string.utfvalues(characters) do
+ tex.setlccode(b,b)
+ end
+ lang.patterns(language, patterns)
+ lang.hyphenation(language, exceptions)
+ loaded[tag] = lang.id(language)
+ else
+ print("<invalid language table: " .. tag .. ">")
+ end
+ else
+ print("<invalid language file: " .. tag .. ">")
+ end
+ end
+ end
+ return loaded[tag]
+end
diff --git a/tex/generic/context/luatex/luatex-languages.tex b/tex/generic/context/luatex/luatex-languages.tex
new file mode 100644
index 000000000..9778da39a
--- /dev/null
+++ b/tex/generic/context/luatex/luatex-languages.tex
@@ -0,0 +1,17 @@
+%D \module
+%D [ file=luatex-fonts,
+%D version=2009.12.01,
+%D title=\LUATEX\ Support Macros,
+%D subtitle=Generic \OPENTYPE\ Font Handler,
+%D author=Hans Hagen,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+
+%D Cf. discussion on \CONTEXT\ list:
+
+\directlua {
+ dofile(kpse.find_file("luatex-languages.lua","tex"))
+}
+
+\def\loadpatterns#1{\directlua{tex.language = languages.loadpatterns("#1")}}
+
+\endinput
diff --git a/tex/generic/context/luatex/luatex-plain.tex b/tex/generic/context/luatex/luatex-plain.tex
index e47ad58ad..028d4ab0e 100644
--- a/tex/generic/context/luatex/luatex-plain.tex
+++ b/tex/generic/context/luatex/luatex-plain.tex
@@ -15,9 +15,10 @@
\everyjob \expandafter {%
\the\everyjob
- \input luatex-basics\relax
- \input luatex-fonts\relax
- \input luatex-mplib\relax
+ \input {luatex-basics}%
+ \input {luatex-fonts}%
+ \input {luatex-languages}%
+ \input {luatex-mplib}%
}
\edef\fmtversion{\fmtversion+luatex}
diff --git a/tex/generic/context/luatex/luatex-test.tex b/tex/generic/context/luatex/luatex-test.tex
index 3020b5594..7fddc673f 100644
--- a/tex/generic/context/luatex/luatex-test.tex
+++ b/tex/generic/context/luatex/luatex-test.tex
@@ -54,8 +54,17 @@
\mine \input tufte \par
-
% \font\mine=file:luatex-fonts-demo-vf-2.lua at 12pt \mine [abab] \par
% \font\mine=file:luatex-fonts-demo-vf-3.lua at 12pt \mine [abab] \par
+\font\test=dejavuserif:+kern at 10pt \test
+
+\hsize 1mm
+
+\noindent Циолковский
+
+\loadpatterns{ru}
+
+\noindent Циолковский
+
\end