From a90bcf0dcd9265b64b65b1f874b39f4c75553137 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 1 Oct 2013 21:20:26 +0300 Subject: beta 2013.10.01 20:08 --- metapost/context/base/mp-tool.mpiv | 4 +- metapost/context/fonts/demo-symbols.mp | 21 ++++ metapost/context/fonts/demo-symbols.tex | 21 ++++ tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4118 -> 4105 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/meta-fnt.lua | 131 ++++++++++++--------- tex/context/base/status-files.pdf | Bin 24733 -> 24732 bytes tex/context/base/status-lua.log | 2 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 10 files changed, 122 insertions(+), 63 deletions(-) create mode 100644 metapost/context/fonts/demo-symbols.mp create mode 100644 metapost/context/fonts/demo-symbols.tex diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv index a39219c67..bb5ae288e 100644 --- a/metapost/context/base/mp-tool.mpiv +++ b/metapost/context/base/mp-tool.mpiv @@ -2454,8 +2454,10 @@ def beginglyph(expr unicode, width, height, depth) = enddef ; def endglyph = - currentpicture := currentpicture scaled charscale ; setbounds currentpicture to (boundingbox unitsquare xscaled charwd yscaled (charht + chardp) shifted (0,-chardp)) ; + if known charscale : + currentpicture := currentpicture scaled charscale ; + fi ; endfig ; enddef ; diff --git a/metapost/context/fonts/demo-symbols.mp b/metapost/context/fonts/demo-symbols.mp new file mode 100644 index 000000000..822854c94 --- /dev/null +++ b/metapost/context/fonts/demo-symbols.mp @@ -0,0 +1,21 @@ +%D \module +%D [ file=demo-symbols.mp, +%D version=2013.09.06, +%D title=\CONTEXT\ \METAPOST\ graphics, +%D subtitle=demo font, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +passvariable("fontname","demo-symbols") ; +passvariable("fontversion","1.005") ; + +beginglyph(9754,2,4,0) ; % high voltage + interim ahlength := 1 ; + drawarrow (1,4) -- (0,2) -- (2,3) -- (1,0) withcolor darkred ; +endglyph ; + diff --git a/metapost/context/fonts/demo-symbols.tex b/metapost/context/fonts/demo-symbols.tex new file mode 100644 index 000000000..e9af4a027 --- /dev/null +++ b/metapost/context/fonts/demo-symbols.tex @@ -0,0 +1,21 @@ +\starttext + + \definemetafont[demo-symbols][demo-symbols.mp] + + \startbuffer + watch this: {\demo\char"261A} \quad \ruledhbox{\demo\char"261A} + \stopbuffer + + \definefont[demo][demo@demo-symbols] + + \getbuffer \blank + + \definefont[demo][demo@demo-symbols at \the\dimexpr3\exheight] + + \getbuffer \blank + + \definefont[demo][demo@demo-symbols at \the\dimexpr4\exheight] + + \getbuffer \blank + +\stoptext diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 5b54b459f..c1008d722 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.10.01 19:00} +\newcontextversion{2013.10.01 20:08} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 224eaeec1..e62eb1541 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 20ba815f4..674f8a2bf 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.10.01 19:00} +\edef\contextversion{2013.10.01 20:08} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/meta-fnt.lua b/tex/context/base/meta-fnt.lua index 0ebe8e0dc..3d13b0b34 100644 --- a/tex/context/base/meta-fnt.lua +++ b/tex/context/base/meta-fnt.lua @@ -26,7 +26,7 @@ metapost.fonts = metapost.fonts or { } -- a few glocals local characters, descriptions = { }, { } -local factor, code, slot, width, height, depth, total, variants = 100, { }, 0, 0, 0, 0, 0, 0, true +local factor, code, slot, width, height, depth, total, variants, bbox, llx, lly, urx, ury = 100, { }, 0, 0, 0, 0, 0, 0, true, 0, 0, 0, 0 -- The next variant of ActualText is what Taco and I could come up with -- eventually. As of September 2013 Acrobat copies okay, Summatra copies a @@ -48,9 +48,13 @@ end -- end local flusher = { - startfigure = function(chrnum,llx,lly,urx,ury) + startfigure = function(_chr_,_llx_,_lly_,_urx_,_ury_) code = { } - slot = chrnum + slot = _chr_ + llx = _llx_ + lly = _lly_ + urx = _urx_ + ury = _ury_ width = urx - llx height = ury depth = -lly @@ -70,7 +74,7 @@ local flusher = { width = width * 100, height = height * 100, depth = depth * 100, - boundingbox = { 0, -depth, width, height }, + boundingbox = { llx, lly, urx, ury }, } if inline then characters[slot] = { @@ -95,63 +99,74 @@ local flusher = { } local function process(mpxformat,name,instances,scalefactor) - statistics.starttiming(metapost.fonts) - scalefactor = scalefactor or 1 - instances = instances or metapost.fonts.instances or 1 - local fontname = file.removesuffix(file.basename(name)) - local hash = file.robustname(formatters["%s %05i %03i"](fontname,scalefactor*1000,instances)) - local lists = containers.read(mpfonts.cache,hash) - if not lists or lists.version ~= version then - statistics.starttiming(flusher) - local data = io.loaddata(resolvers.findfile(name)) - metapost.reset(mpxformat) - metapost.setoutercolor(2) -- no outer color and no reset either - lists = { } - for i=1,instances do - characters = { } - descriptions = { } - metapost.process( - mpxformat, - { - formatters["randomseed := %s ;"](i*10), - formatters["charscale := %s ;"](scalefactor), - data, - }, - false, - flusher, - false, - false, - "all" - ) - lists[i] = { - characters = characters, - descriptions = descriptions, - parameters = { - designsize = 655360, - slant = 0, - space = 333 * scalefactor, - space_stretch = 166.5 * scalefactor, - space_shrink = 111 * scalefactor, - x_height = 431 * scalefactor, - quad = 1000 * scalefactor, - extra_space = 0, - }, - properties = { - name = formatters["%s-%03i"](hash,i), - virtualized = true, - spacer = "space", + local filename = resolvers.findfile(name) + local attributes = filename and lfs.isfile(filename) and lfs.attributes(filename) + if attributes then + statistics.starttiming(metapost.fonts) + scalefactor = scalefactor or 1 + instances = instances or metapost.fonts.instances or 1 -- maybe store in liost too + local fontname = file.removesuffix(file.basename(name)) + local modification = attributes.modification + local filesize = attributes.size + local hash = file.robustname(formatters["%s %05i %03i"](fontname,scalefactor*1000,instances)) + local lists = containers.read(mpfonts.cache,hash) + if not lists or lists.modification ~= modification or lists.filesize ~= filesize or lists.instances ~= instances or lists.scalefactor ~= scalefactor then + statistics.starttiming(flusher) + local data = io.loaddata(filename) + metapost.reset(mpxformat) + metapost.setoutercolor(2) -- no outer color and no reset either + lists = { } + for i=1,instances do + characters = { } + descriptions = { } + metapost.process( + mpxformat, + { + formatters["randomseed := %s ;"](i*10), + formatters["charscale := %s ;"](scalefactor), + data, + }, + false, + flusher, + false, + false, + "all" + ) + lists[i] = { + characters = characters, + descriptions = descriptions, + parameters = { + designsize = 655360, + slant = 0, + space = 333 * scalefactor, + space_stretch = 166.5 * scalefactor, + space_shrink = 111 * scalefactor, + x_height = 431 * scalefactor, + quad = 1000 * scalefactor, + extra_space = 0, + }, + properties = { + name = formatters["%s-%03i"](hash,i), + virtualized = true, + spacer = "space", + } } - } + end + lists.version = metapost.variables.fontversion or "1.000" + lists.modification = modification + lists.filesize = filesize + lists.instances = instances + lists.scalefactor = scalefactor + metapost.reset(mpxformat) -- saves memory + lists = containers.write(mpfonts.cache, hash, lists) + statistics.stoptiming(flusher) end --- inspect(lists) - lists.version = metapost.variables.fontversion or "1.000" - metapost.reset(mpxformat) -- saves memory - lists = containers.write(mpfonts.cache, hash, lists) - statistics.stoptiming(flusher) + variants = variants + #lists + statistics.stoptiming(metapost.fonts) + return lists + else + return { } end - variants = variants + #lists - statistics.stoptiming(metapost.fonts) - return lists end metapost.fonts.flusher = flusher diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 3825c5148..2f5997597 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index be7dbe7e1..f2a3738c2 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.10.01 19:00 MKIV beta fmt: 2013.10.1 int: english/english +ConTeXt ver: 2013.10.01 20:08 MKIV beta fmt: 2013.10.1 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 62f1b874c..ef78f0ef8 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 : 10/01/13 19:00:22 +-- merge date : 10/01/13 20:08:43 do -- begin closure to overcome local limits and interference -- cgit v1.2.3