From b4d1df9e054a2082ea85dabaf5082f4cc548cdb8 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 7 Jun 2010 07:28:24 +0300 Subject: Fix loading fonts with absolute path Also, as a side effect, fixes loading Windows paths starting with drive letter. closes #10 --- otfl-font-xtx.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/otfl-font-xtx.lua b/otfl-font-xtx.lua index 7da29d3..413769d 100644 --- a/otfl-font-xtx.lua +++ b/otfl-font-xtx.lua @@ -173,11 +173,10 @@ local function istrue (s) list[s] = true end local function isfalse(s) list[s] = false end local spaces = lpeg.P(" ")^0 --- ER: now accepting names like C:/program files/texlive/2009/... -local namespec = (lpeg.R("az", "AZ") * lpeg.P(":"))^-1 * (1-lpeg.S("/:("))^1 -- was: (1-lpeg.S("/: ("))^0 +local namespec = (1-lpeg.S("/:("))^0 -- was: (1-lpeg.S("/: ("))^0 +local filespec = (lpeg.R("az", "AZ") * lpeg.P(":"))^-1 * (1-lpeg.S(":("))^1 local crapspec = spaces * lpeg.P("/") * (((1-lpeg.P(":"))^0)/isstyle) * spaces --- ER: can't understand why the 'file:' thing doesn't work with fontnames starting by c:... -local filename = (lpeg.P("file:")/isfile * (namespec/thename)) + (lpeg.P("[") * lpeg.P(true)/isname * (((1-lpeg.P("]"))^0)/thename) * lpeg.P("]")) +local filename = (lpeg.P("file:")/isfile * (filespec/thename)) + (lpeg.P("[") * lpeg.P(true)/isname * (((1-lpeg.P("]"))^0)/thename) * lpeg.P("]")) local fontname = (lpeg.P("name:")/isname * (namespec/thename)) + lpeg.P(true)/issome * (namespec/thename) local sometext = (lpeg.R("az","AZ","09") + lpeg.S("+-."))^1 local truevalue = lpeg.P("+") * spaces * (sometext/istrue) -- cgit v1.2.3