From 48aee08be6614bf30710ae7c42248f64d55f8f22 Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 20 Apr 2011 17:40:12 +0300 Subject: beta 2011.04.20 16:23 --- scripts/context/lua/mtxrun.lua | 20 +++++++--- scripts/context/stubs/mswin/mtxrun.lua | 20 +++++++--- scripts/context/stubs/unix/mtxrun | 20 +++++++--- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-mis.mkii | 2 + tex/context/base/grph-inc.lua | 28 ++++++++++++++ tex/context/base/grph-swf.lua | 57 +++++++++++++++++++++++++++- tex/context/base/l-number.lua | 30 ++++++++++++--- tex/context/base/pack-rul.mkiv | 17 +++++++++ tex/context/base/s-abr-01.tex | 1 + tex/context/base/scrn-but.mkvi | 8 ++-- tex/context/base/spac-ali.mkiv | 7 +++- tex/context/base/status-files.pdf | Bin 23614 -> 23622 bytes tex/context/base/status-lua.pdf | Bin 155189 -> 155222 bytes tex/generic/context/luatex-fonts-merged.lua | 2 +- 18 files changed, 184 insertions(+), 36 deletions(-) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index a72c56251..2f81b4629 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -1899,16 +1899,24 @@ function number.clearbit(x, p) return hasbit(x, p) and x - p or x end + function number.tobitstring(n) if n == 0 then - return "0" + return "00000000" else - local t = { } + tc = 0 + t = {} while n > 0 do - insert(t,1,n % 2 > 0 and 1 or 0) - n = floor(n/2) - end - return concat(t) + table.insert(t,1,n % 2 > 0 and 1 or 0) + n = math.floor(n/2) + tc = tc + 1 + end + while tc % 8 > 0 do + table.insert(t,1,0) + tc = tc + 1 + end + n = table.concat(t) + return n end end diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index a72c56251..2f81b4629 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -1899,16 +1899,24 @@ function number.clearbit(x, p) return hasbit(x, p) and x - p or x end + function number.tobitstring(n) if n == 0 then - return "0" + return "00000000" else - local t = { } + tc = 0 + t = {} while n > 0 do - insert(t,1,n % 2 > 0 and 1 or 0) - n = floor(n/2) - end - return concat(t) + table.insert(t,1,n % 2 > 0 and 1 or 0) + n = math.floor(n/2) + tc = tc + 1 + end + while tc % 8 > 0 do + table.insert(t,1,0) + tc = tc + 1 + end + n = table.concat(t) + return n end end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index a72c56251..2f81b4629 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -1899,16 +1899,24 @@ function number.clearbit(x, p) return hasbit(x, p) and x - p or x end + function number.tobitstring(n) if n == 0 then - return "0" + return "00000000" else - local t = { } + tc = 0 + t = {} while n > 0 do - insert(t,1,n % 2 > 0 and 1 or 0) - n = floor(n/2) - end - return concat(t) + table.insert(t,1,n % 2 > 0 and 1 or 0) + n = math.floor(n/2) + tc = tc + 1 + end + while tc % 8 > 0 do + table.insert(t,1,0) + tc = tc + 1 + end + n = table.concat(t) + return n end end diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index f32124f84..5075f36f5 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.04.19 22:49} +\newcontextversion{2011.04.20 16:23} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 158e48b95..3c4f74b42 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{2011.04.19 22:49} +\newcontextversion{2011.04.20 16:23} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index a6e41c766..e34e83e42 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.04.19 22:49} +\edef\contextversion{2011.04.20 16:23} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index c301fc844..c210f5667 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.04.19 22:49} +\edef\contextversion{2011.04.20 16:23} %D For those who want to use this: diff --git a/tex/context/base/core-mis.mkii b/tex/context/base/core-mis.mkii index a412ebaf4..6d77ef18e 100644 --- a/tex/context/base/core-mis.mkii +++ b/tex/context/base/core-mis.mkii @@ -54,6 +54,8 @@ \appendtoks \def\MetaFun{MetaFun}\to\simplifiedcommands %appendtoks \def||{-}\to\simplifiedcommands \appendtoks \def|#1|{\ifx#1\empty\empty-\else#1\fi}\to\simplifiedcommands +\appendtoks \let\crlf\space\to\simplifiedcommands +\appendtoks \let\\\space\to\simplifiedcommands \appendtoks\let\buildtextaccent\secondoftwoarguments\to\simplifiedcommands diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index 04d335862..eb85bbb19 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -1255,3 +1255,31 @@ statistics.register("graphics processing time", function() return nil end end) + +-- helper + +function figures.applyratio(width,height,w,h) -- width and height are strings and w and h are numbers + if not width or width == "" then + if not height or height == "" then + return figures.defaultwidth, figures.defaultheight + else + height = string.todimen(height) + if w and h then + return height * w/h, height + else + return figures.defaultwidth, height + end + end + else + width = string.todimen(width) + if not height or height == "" then + if w and h then + return width, width * h/w + else + return width, figures.defaultheight + end + else + return width, string.todimen(height) + end + end +end diff --git a/tex/context/base/grph-swf.lua b/tex/context/base/grph-swf.lua index 62667bbba..ed1c20eeb 100644 --- a/tex/context/base/grph-swf.lua +++ b/tex/context/base/grph-swf.lua @@ -6,6 +6,13 @@ if not modules then modules = { } end modules ['grph-swf'] = { license = "see context related readme files" } +local sub, format, match, byte = string.sub, string.format, string.match, string.byte +local readstring, readnumber = io.readstring, io.readnumber +local concat = table.concat +local floor = math.floor +local tonumber = tonumber +local tobitstring = number.tobitstring + local todimen = number.todimen local nodeinjections = backends.nodeinjections @@ -13,11 +20,57 @@ local nodeinjections = backends.nodeinjections local figures = figures local context = context +local function getheader(name) + local f = io.open(name,"rb") + if not f then + return + end + local signature = readstring(f,3) -- F=uncompressed, C=compressed (zlib) + local version = readnumber(f,1) + local filelength = readnumber(f,-4) + local compressed = sub(signature,1,1) == "C" + local buffer + if compressed then + buffer = zlib.decompress(f:read('*a')) + else + buffer = f:read(20) -- ('*a') + end + f:close() + buffer = { match(buffer,"(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)") } + for i=1,9 do + buffer[i] = tobitstring(byte(buffer[i])) + end + local framebits = concat(buffer,"",1,9) + local n = tonumber(sub(framebits,1,5),2) + local frame = { } -- xmin xmax ymin ymax + local xmin = tonumber(sub(framebits,6, 5 + n),2) + local xmax = tonumber(sub(framebits,6 + 1*n,5 + 2*n),2) + local ymin = tonumber(sub(framebits,6 + 2*n,5 + 3*n),2) + local ymax = tonumber(sub(framebits,6 + 3*n,5 + 4*n),2) + return { + filename = name, + version = version, + filelength = filelength, + framerate = tonumber(byte(buffer[10]) * 256 + byte(buffer[11])), + framecount = tonumber(byte(buffer[12]) * 256 + byte(buffer[13])), + -- framebits = framebits, + compressed = compressed, + width = floor((xmax - xmin) / 20), + height = floor((ymax - ymin) / 20), + rectangle = { + xmin = xmin, + xmax = xmax, + ymin = ymin, + ymax = ymax, + } + } +end + function figures.checkers.swf(data) local dr, du, ds = data.request, data.used, data.status - local width = (dr.width or figures.defaultwidth):todimen() - local height = (dr.height or figures.defaultheight):todimen() local foundname = du.fullname + local header = getheader(foundname) + local width, height = figures.applyratio(dr.width,dr.height,header.width,header.height) dr.width, dr.height = width, height du.width, du.height, du.foundname = width, height, foundname context.startfoundexternalfigure(todimen(width),todimen(height)) diff --git a/tex/context/base/l-number.lua b/tex/context/base/l-number.lua index e4eae3d72..9e99667cd 100644 --- a/tex/context/base/l-number.lua +++ b/tex/context/base/l-number.lua @@ -79,15 +79,35 @@ function number.clearbit(x, p) return hasbit(x, p) and x - p or x end +--~ function number.tobitstring(n) +--~ if n == 0 then +--~ return "0" +--~ else +--~ local t = { } +--~ while n > 0 do +--~ insert(t,1,n % 2 > 0 and 1 or 0) +--~ n = floor(n/2) +--~ end +--~ return concat(t) +--~ end +--~ end + function number.tobitstring(n) if n == 0 then - return "0" + return "00000000" else - local t = { } + tc = 0 + t = {} while n > 0 do - insert(t,1,n % 2 > 0 and 1 or 0) - n = floor(n/2) + table.insert(t,1,n % 2 > 0 and 1 or 0) + n = math.floor(n/2) + tc = tc + 1 + end + while tc % 8 > 0 do + table.insert(t,1,0) + tc = tc + 1 end - return concat(t) + n = table.concat(t) + return n end end diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index d6299a292..c137aea01 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -1174,6 +1174,23 @@ %D Nevertheless we implement the whole scheme, if not for %D future extensions. +%D \macros +%D {\doassigncheckedframeoffset} +%D +%D Offset helper (see menus): + +\def\doassigncheckedframeoffset#1#2% + {\edef\checkedframeoffset{#2}% + #1% + \ifx\checkedframeoffset\empty \zeropoint\else + \ifx\checkedframeoffset\v!overlay\zeropoint\else + \ifx\checkedframeoffset\v!none \zeropoint\else + \ifx\checkedframeoffset\v!frame \zeropoint\else + \ifx\checkedframeoffset\v!default\zeropoint\else + #2% + \fi\fi\fi\fi\fi + \relax} + %D \macros %D {ifreshapeframebox} %D diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex index 45c5e4297..e9d322b2b 100644 --- a/tex/context/base/s-abr-01.tex +++ b/tex/context/base/s-abr-01.tex @@ -95,6 +95,7 @@ \logo [EXAMPLET] {examplet} \logo [EXAMPLEX] {examplex} \logo [EXIMPLE] {eXiMpLe} +\logo [FLAC] {flac} \logo [FAQ] {faq} \logo [FDF] {fdf} \logo [FONTFORGE] {FontForge} diff --git a/tex/context/base/scrn-but.mkvi b/tex/context/base/scrn-but.mkvi index 3a3a86a01..338f3090b 100644 --- a/tex/context/base/scrn-but.mkvi +++ b/tex/context/base/scrn-but.mkvi @@ -417,10 +417,10 @@ \newdimen\scrn_menu_offset_right \def\scrn_menu_set_used - {\scrn_menu_offset_left \interactionmenuparameter\c!leftoffset - \scrn_menu_offset_right \interactionmenuparameter\c!rightoffset - \scrn_menu_offset_top \interactionmenuparameter\c!topoffset - \scrn_menu_offset_bottom\interactionmenuparameter\c!bottomoffset + {\doassigncheckedframeoffset\scrn_menu_offset_left {\interactionmenuparameter\c!leftoffset }% + \doassigncheckedframeoffset\scrn_menu_offset_right {\interactionmenuparameter\c!rightoffset }% + \doassigncheckedframeoffset\scrn_menu_offset_top {\interactionmenuparameter\c!topoffset }% + \doassigncheckedframeoffset\scrn_menu_offset_bottom{\interactionmenuparameter\c!bottomoffset}% \scrn_menu_asked_width \interactionmenuparameter\c!maxwidth \scrn_menu_asked_height \interactionmenuparameter\c!maxheight \scrn_menu_used_width\dimexpr diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index cccfe181a..6050ef7dd 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -105,11 +105,11 @@ \def\dosetraggedvbox#1% can be more keys {\let\raggedbox\vbox - \processcommacommand[#1]\dodosetraggedvbox} + \processcommacommand[#1]\dosetraggedvbox} \def\dosetraggedhbox#1% can be more keys {\let\raggedbox\hbox - \processcommacommand[#1]\dodosetraggedhbox} + \processcommacommand[#1]\dosetraggedhbox} \def\dosetraggedvbox#1% {\ifcsname\@@ragged@@vbox#1\endcsname @@ -151,10 +151,13 @@ % slow, we can do this in lua ... some day +\let\raggedbox\relax + \unexpanded\def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that! {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty \let\raggedtopcommand\empty \let\raggedbottomcommand\empty + \let\raggedbox\relax \setfalse\raggedonelinerstate \doifsomething{#1}% {\doifinsetelse\v!broad{#1}\!!doneatrue\!!doneafalse diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 7e4138217..7a6da08e2 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.pdf b/tex/context/base/status-lua.pdf index 3cc3340de..2bd85687e 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 17f136b29..01e745f62 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/19/11 22:49:01 +-- merge date : 04/20/11 16:23:12 do -- begin closure to overcome local limits and interference -- cgit v1.2.3