summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-06-22 16:42:14 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-06-22 16:42:14 +0200
commitda8162d4e816cf49d9790a1c81556b499f442bed (patch)
tree5c631b1fb8282670a6cea1087afa766a8b94db43 /tex/generic
parent204057fdc5023b5f4ff55a69bc6593388ea427e7 (diff)
downloadcontext-da8162d4e816cf49d9790a1c81556b499f442bed.tar.gz
2018-06-22 16:02:00
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua239
-rw-r--r--tex/generic/context/luatex/luatex-fonts.lua2
-rw-r--r--tex/generic/context/luatex/luatex-pdf.tex2
3 files changed, 239 insertions, 4 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 4d19c4217..6bcdca25d 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua
--- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 06/12/18 21:48:58
+-- merged file : luatex-fonts-merged.lua
+-- parent file : luatex-fonts.lua
+-- merge date : 06/20/18 01:22:27
do -- begin closure to overcome local limits and interference
@@ -4932,6 +4932,10 @@ if not modules then modules={} end modules ['luat-basics-gen']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+if context then
+ texio.write_nl("fatal error: this module is not for context")
+ os.exit()
+end
local match,gmatch,gsub,lower=string.match,string.gmatch,string.gsub,string.lower
local formatters,split,format,dump=string.formatters,string.split,string.format,string.dump
local loadfile,type=loadfile,type
@@ -5364,6 +5368,10 @@ if not modules then modules={} end modules ['luatex-fonts-nod']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+if context then
+ texio.write_nl("fatal error: this module is not for context")
+ os.exit()
+end
if tex.attribute[0]~=0 then
texio.write_nl("log","!")
texio.write_nl("log","! Attribute 0 is reserved for ConTeXt's font feature management and has to be")
@@ -9029,6 +9037,9 @@ fonts.analyzers={}
fonts.readers={}
fonts.definers={ methods={} }
fonts.loggers={ register=function() end }
+if context then
+ fontloader=nil
+end
end -- closure
@@ -9041,6 +9052,10 @@ if not modules then modules={} end modules ['luatex-font-mis']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+if context then
+ texio.write_nl("fatal error: this module is not for context")
+ os.exit()
+end
local currentfont=font.current
local hashes=fonts.hashes
local identifiers=hashes.identifiers or {}
@@ -10410,6 +10425,10 @@ if not modules then modules={} end modules ['luatex-font-enc']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+if context then
+ texio.write_nl("fatal error: this module is not for context")
+ os.exit()
+end
local fonts=fonts
local encodings={}
fonts.encodings=encodings
@@ -11016,6 +11035,10 @@ if not modules then modules={} end modules ['luatex-fonts-syn']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+if context then
+ texio.write_nl("fatal error: this module is not for context")
+ os.exit()
+end
local fonts=fonts
fonts.names=fonts.names or {}
fonts.names.version=1.001
@@ -24936,6 +24959,27 @@ function nodes.injections.setspacekerns(font,sequence)
end
end
local getthreshold
+if context then
+ local threshold=1
+ local parameters=fonts.hashes.parameters
+ directives.register("otf.threshold",function(v) threshold=tonumber(v) or 1 end)
+ getthreshold=function(font)
+ local p=parameters[font]
+ local f=p.factor
+ local s=p.spacing
+ local t=threshold*(s and s.width or p.space or 0)-2
+ return t>0 and t or 0,f
+ end
+else
+ injections.threshold=0
+ getthreshold=function(font)
+ local p=fontdata[font].parameters
+ local f=p.factor
+ local s=p.spacing
+ local t=injections.threshold*(s and s.width or p.space or 0)-2
+ return t>0 and t or 0,f
+ end
+end
injections.getthreshold=getthreshold
function injections.isspace(n,threshold,id)
if (id or getid(n))==glue_code then
@@ -29095,6 +29139,24 @@ replace_all_nbsp=function(head)
return replace_all_nbsp(head)
end
local processcharacters=nil
+if context then
+ local fontprocesses=fonts.hashes.processes
+ function processcharacters(head,font)
+ local processors=fontprocesses[font]
+ for i=1,#processors do
+ head=processors[i](head,font,0)
+ end
+ return head
+ end
+else
+ function processcharacters(head,font)
+ local processors=fontdata[font].shared.processes
+ for i=1,#processors do
+ head=processors[i](head,font,0)
+ end
+ return head
+ end
+end
local indicgroups=characters and characters.indicgroups
if not indicgroups and characters then
local indic={
@@ -30974,12 +31036,71 @@ local downcommand=helpers.commands.down
local otf=fonts.handlers.otf
local f_color=formatters["%.3f %.3f %.3f rg"]
local f_gray=formatters["%.3f g"]
+if context then
+ local startactualtext=nil
+ local stopactualtext=nil
+ function otf.getactualtext(s)
+ if not startactualtext then
+ startactualtext=backends.codeinjections.startunicodetoactualtextdirect
+ stopactualtext=backends.codeinjections.stopunicodetoactualtextdirect
+ end
+ return startactualtext(s),stopactualtext()
+ end
+else
+ local tounicode=fonts.mappings.tounicode16
+ function otf.getactualtext(s)
+ return
+ "/Span << /ActualText <feff"..s.."> >> BDC",
+ "EMC"
+ end
+end
local sharedpalettes={}
local hash=setmetatableindex(function(t,k)
local v={ "pdf","direct",k }
t[k]=v
return v
end)
+if context then
+ local colors=attributes.list[attributes.private('color')] or {}
+ local transparencies=attributes.list[attributes.private('transparency')] or {}
+ function otf.registerpalette(name,values)
+ sharedpalettes[name]=values
+ for i=1,#values do
+ local v=values[i]
+ local c=nil
+ local t=nil
+ if type(v)=="table" then
+ c=colors.register(name,"rgb",
+ max(round((v.r or 0)*255),255)/255,
+ max(round((v.g or 0)*255),255)/255,
+ max(round((v.b or 0)*255),255)/255
+ )
+ else
+ c=colors[v]
+ t=transparencies[v]
+ end
+ if c and t then
+ values[i]=hash[lpdf.color(1,c).." "..lpdf.transparency(t)]
+ elseif c then
+ values[i]=hash[lpdf.color(1,c)]
+ elseif t then
+ values[i]=hash[lpdf.color(1,t)]
+ end
+ end
+ end
+else
+ function otf.registerpalette(name,values)
+ sharedpalettes[name]=values
+ for i=1,#values do
+ local v=values[i]
+ values[i]=hash[f_color(
+ max(round((v.r or 0)*255),255)/255,
+ max(round((v.g or 0)*255),255)/255,
+ max(round((v.b or 0)*255),255)/255
+ )]
+ end
+ end
+end
local function convert(t,k)
local v={}
for i=1,#k do
@@ -33933,6 +34054,49 @@ local function makespecification(specification,lookup,name,sub,method,detail,siz
return t
end
definers.makespecification=makespecification
+if context then
+ local splitter,splitspecifiers=nil,""
+ local P,C,S,Cc,Cs=lpeg.P,lpeg.C,lpeg.S,lpeg.Cc,lpeg.Cs
+ local left=P("(")
+ local right=P(")")
+ local colon=P(":")
+ local space=P(" ")
+ local lbrace=P("{")
+ local rbrace=P("}")
+ definers.defaultlookup="file"
+ local prefixpattern=P(false)
+ local function addspecifier(symbol)
+ splitspecifiers=splitspecifiers..symbol
+ local method=S(splitspecifiers)
+ local lookup=C(prefixpattern)*colon
+ local sub=left*C(P(1-left-right-method)^1)*right
+ local specification=C(method)*C(P(1)^1)
+ local name=Cs((lbrace/"")*(1-rbrace)^1*(rbrace/"")+(1-sub-specification)^1)
+ splitter=P((lookup+Cc(""))*name*(sub+Cc(""))*(specification+Cc("")))
+ end
+ local function addlookup(str)
+ prefixpattern=prefixpattern+P(str)
+ end
+ definers.addlookup=addlookup
+ addlookup("file")
+ addlookup("name")
+ addlookup("spec")
+ local function getspecification(str)
+ return lpegmatch(splitter,str or "")
+ end
+ definers.getspecification=getspecification
+ function definers.registersplit(symbol,action,verbosename)
+ addspecifier(symbol)
+ variants[symbol]=action
+ if verbosename then
+ variants[verbosename]=action
+ end
+ end
+ function definers.analyze(specification,size)
+ local lookup,name,sub,method,detail=getspecification(specification or "")
+ return makespecification(specification,lookup,name,sub,method,detail,size)
+ end
+end
definers.resolvers=definers.resolvers or {}
local resolvers=definers.resolvers
function resolvers.file(specification)
@@ -34246,6 +34410,10 @@ if not modules then modules={} end modules ['luatex-fonts-def']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+if context then
+ texio.write_nl("fatal error: this module is not for context")
+ os.exit()
+end
local fonts=fonts
fonts.constructors.namemode="specification"
function fonts.definers.getspecification(str)
@@ -34326,6 +34494,10 @@ if not modules then modules={} end modules ['luatex-fonts-ext']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+if context then
+ texio.write_nl("fatal error: this module is not for context")
+ os.exit()
+end
local byte=string.byte
local fonts=fonts
local handlers=fonts.handlers
@@ -34709,6 +34881,13 @@ local function blockligatures(str)
end
end
otf.helpers.blockligatures=blockligatures
+if context then
+ interfaces.implement {
+ name="blockligatures",
+ arguments="string",
+ actions=blockligatures,
+ }
+end
end -- closure
@@ -34767,6 +34946,56 @@ local specification={
}
registerotffeature(specification)
registerafmfeature(specification)
+if context then
+ local function initialize(tfmdata,value)
+ tfmdata.properties.textitalics=toboolean(value)
+ end
+ local specification={
+ name="textitalics",
+ description="use alternative text italic correction",
+ initializers={
+ base=initialize,
+ node=initialize,
+ }
+ }
+ registerotffeature(specification)
+ registerafmfeature(specification)
+end
+if context then
+ local letter=characters.is_letter
+ local always=true
+ local function collapseitalics(tfmdata,key,value)
+ local threshold=value==true and 100 or tonumber(value)
+ if threshold and threshold>0 then
+ if threshold>100 then
+ threshold=100
+ end
+ for unicode,data in next,tfmdata.characters do
+ if always or letter[unicode] or letter[data.unicode] then
+ local italic=data.italic
+ if italic and italic~=0 then
+ local width=data.width
+ if width and width~=0 then
+ local delta=threshold*italic/100
+ data.width=width+delta
+ data.italic=italic-delta
+ end
+ end
+ end
+ end
+ end
+ end
+ local dimensions_specification={
+ name="collapseitalics",
+ description="collapse italics",
+ manipulators={
+ base=collapseitalics,
+ node=collapseitalics,
+ }
+ }
+ registerotffeature(dimensions_specification)
+ registerafmfeature(dimensions_specification)
+end
end -- closure
@@ -37209,6 +37438,10 @@ if not modules then modules={} end modules ['luatex-fonts-gbn']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+if context then
+ texio.write_nl("fatal error: this module is not for context")
+ os.exit()
+end
local next=next
local fonts=fonts
local nodes=nodes
diff --git a/tex/generic/context/luatex/luatex-fonts.lua b/tex/generic/context/luatex/luatex-fonts.lua
index bef0b53a4..058c3b5a5 100644
--- a/tex/generic/context/luatex/luatex-fonts.lua
+++ b/tex/generic/context/luatex/luatex-fonts.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['luatex-fonts'] = {
-- A merged file is generated with:
--
--- mtxrun --script package --merge luatex-fonts.lua
+-- mtxrun --script package --merge --stripcontext luatex-fonts.lua
--
-- A needed resource file is made by:
--
diff --git a/tex/generic/context/luatex/luatex-pdf.tex b/tex/generic/context/luatex/luatex-pdf.tex
index b698285e3..bd6690860 100644
--- a/tex/generic/context/luatex/luatex-pdf.tex
+++ b/tex/generic/context/luatex/luatex-pdf.tex
@@ -123,6 +123,7 @@
\xdef\pdfcompresslevel {\pdfvariable compresslevel}
\xdef\pdfobjcompresslevel {\pdfvariable objcompresslevel}
+ %xdef\pdfrecompress {\pdfvariable recompress}
\xdef\pdfdecimaldigits {\pdfvariable decimaldigits}
\xdef\pdfgamma {\pdfvariable gamma}
\xdef\pdfimageresolution {\pdfvariable imageresolution}
@@ -165,6 +166,7 @@
\global\pdfcompresslevel 9
\global\pdfobjcompresslevel 1
+ %global\pdfrecompress 0
\global\pdfdecimaldigits 4
\global\pdfgamma 1000
\global\pdfimageresolution 72