diff options
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 688cfecb5..228b9727c 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 : 12/20/13 00:55:14 +-- merge date : 12/20/13 23:45:10 do -- begin closure to overcome local limits and interference @@ -3762,6 +3762,33 @@ function constructors.beforecopyingcharacters(target,original) end function constructors.aftercopyingcharacters(target,original) end +constructors.sharefonts=false +constructors.nofsharedfonts=0 +local sharednames={} +function constructors.trytosharefont(target,tfmdata) + if constructors.sharefonts then + local characters=target.characters + local n=1 + local t={ target.psname } + local u=sortedkeys(characters) + for i=1,#u do + n=n+1;t[n]=k + n=n+1;t[n]=characters[u[i]].index or k + end + local h=md5.HEX(concat(t," ")) + local s=sharednames[h] + if s then + if trace_defining then + report_defining("font %a uses backend resources of font %a",target.fullname,s) + end + target.fullname=s + constructors.nofsharedfonts=constructors.nofsharedfonts+1 + target.properties.sharedwith=s + else + sharednames[h]=target.fullname + end + end +end function constructors.enhanceparameters(parameters) local xheight=parameters.x_height local quad=parameters.quad @@ -4194,6 +4221,7 @@ function constructors.scale(tfmdata,specification) targetcharacters[unicode]=chr end constructors.aftercopyingcharacters(target,tfmdata) + constructors.trytosharefont(target,tfmdata) return target end function constructors.finalize(tfmdata) @@ -6396,7 +6424,7 @@ local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf otf.glists={ "gsub","gpos" } -otf.version=2.748 +otf.version=2.749 otf.cache=containers.define("fonts","otf",otf.version,true) local fontdata=fonts.hashes.identifiers local chardata=characters and characters.data @@ -6439,21 +6467,23 @@ function otf.fileformat(filename) local leader=lower(io.loadchunk(filename,4)) local suffix=lower(file.suffix(filename)) if leader=="otto" then - return "opentype","otf",suffix=="otf" + return formats.otf,suffix=="otf" elseif leader=="ttcf" then - return "truetype","ttc",suffix=="ttc" + return formats.ttc,suffix=="ttc" elseif suffix=="ttc" then - return "truetype","ttc",true + return formats.ttc,true + elseif suffix=="dfont" then + return formats.dfont,true else - return "truetype","ttf",suffix=="ttf" + return formats.ttf,suffix=="ttf" end end local function otf_format(filename) - local format,suffix,okay=otf.fileformat(filename) + local format,okay=otf.fileformat(filename) if not okay then report_otf("font %a is actually an %a file",filename,format) end - return suffix + return format end local function load_featurefile(raw,featurefile) if featurefile and featurefile~="" then |