From 690cd37becccf9e1f63c7c09054f82e54a50a13d Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 15 Apr 2013 13:13:18 +0200 Subject: avoid two calls to the file library --- luaotfload.lua | 9 ++++++++- luaotfload.sty | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/luaotfload.lua b/luaotfload.lua index 1ca1fdc..290bba7 100644 --- a/luaotfload.lua +++ b/luaotfload.lua @@ -80,10 +80,17 @@ Virtual fonts are resolved via a callback. filename. (NB: \CONTEXT\ handles this likewise in \textsf{font-vf.lua}.) --doc]]-- +local Cs, P, lpegmatch = lpeg.Cs, lpeg.P, lpeg.match + +local p_dot, p_slash = P".", P"/" +local p_suffix = (p_dot * (1 - p_dot - p_slash)^1 * P(-1)) / "" +local p_removesuffix = Cs((p_suffix + 1)^1) + local find_vf_file = function (name) local fullname = find_file(name, "ovf") if not fullname then - fullname = find_file(file.removesuffix(file.basename(name)), "ovf") + --fullname = find_file(file.removesuffix(name), "ovf") + fullname = find_file(lpegmatch(p_removesuffix, name), "ovf") end if fullname then log("loading virtual font file %s.", fullname) diff --git a/luaotfload.sty b/luaotfload.sty index b2b574b..a6714d9 100644 --- a/luaotfload.sty +++ b/luaotfload.sty @@ -20,8 +20,6 @@ \csname ifluaotfloadloaded\endcsname \let\ifluaotfloadloaded\endinput \bgroup\expandafter\expandafter\expandafter\egroup -%\RequireLuaModule{lualibs} -%\RequireLuaModule{luaotfload} \expandafter\ifx\csname ProvidesPackage\endcsname\relax \input luatexbase.sty \else @@ -30,6 +28,18 @@ [2011/10/06 v2.0 OpenType layout system] \RequirePackage{luatexbase} \fi +%% -------------------------------------------------------------------- +%% from luatex-basics.tex +% As soon as we feel the need this file will file will contain an extension +% to the standard plain register allocation. For the moment we stick to a +% rather dumb attribute allocator. We start at 256 because we don't want +% any interference with the attributes used in the font handler. +%\newcount \lastallocatedattribute \lastallocatedattribute=255 + +%\def\newattribute#1% + %{\global\advance\lastallocatedattribute 1 + %\attributedef#1\lastallocatedattribute} +%% -------------------------------------------------------------------- \directlua{require"luaotfload"} \endinput %% -- cgit v1.2.3