diff options
author | Marius <mariausol@gmail.com> | 2012-07-10 01:40:15 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-07-10 01:40:15 +0300 |
commit | 6f124794f7dc253f8b83f2517c26ce17e50d66ff (patch) | |
tree | b60c4965f6564da448d06ccc7333fc9275c09d42 /tex | |
parent | f7f5e6779a6e1db630c21151d30858a2c8c97cbd (diff) | |
download | context-6f124794f7dc253f8b83f2517c26ce17e50d66ff.tar.gz |
beta 2012.07.10 00:14
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4140 -> 4143 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 105441 -> 105722 bytes | |||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-ctx.lua | 3 | ||||
-rw-r--r-- | tex/context/base/node-rul.lua | 32 | ||||
-rw-r--r-- | tex/context/base/node-rul.mkiv | 37 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24481 -> 24472 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 179530 -> 179535 bytes | |||
-rw-r--r-- | tex/context/base/strc-num.mkiv | 14 | ||||
-rw-r--r-- | tex/context/base/strc-sec.mkiv | 33 | ||||
-rw-r--r-- | tex/context/base/util-dim.lua | 8 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
15 files changed, 89 insertions, 48 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index b589b1eb6..226a859f2 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{2012.07.09 23:06} +\newcontextversion{2012.07.10 00:14} %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 3895ea717..f4d55037b 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{2012.07.09 23:06} +\newcontextversion{2012.07.10 00:14} %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-version.pdf b/tex/context/base/context-version.pdf Binary files differindex a36bc4c60..655d9263c 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 4b3cf9635..124e0cc4d 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index c186c4a71..2b5608204 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{2012.07.09 23:06} +\edef\contextversion{2012.07.10 00:14} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 962bb4314..e5e07c4d4 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{2012.07.09 23:06} +\edef\contextversion{2012.07.10 00:14} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index fa6708d0c..a7dcd6edd 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -1428,7 +1428,8 @@ function helpers.dimenfactor(unit,tfmdata) -- could be a method of a font instan elseif unit == "em" then return (tfmdata and tfmdata.parameters.em_width) or 655360 else - return dimenfactors[unit] or unit + local du = dimenfactors[unit] + return du and 1/du or tonumber(unit) or 1 end end diff --git a/tex/context/base/node-rul.lua b/tex/context/base/node-rul.lua index 7f49edffc..d81016af0 100644 --- a/tex/context/base/node-rul.lua +++ b/tex/context/base/node-rul.lua @@ -86,6 +86,7 @@ local hpack_nodes = node.hpack local fontdata = fonts.hashes.identifiers local variables = interfaces.variables local dimenfactor = fonts.helpers.dimenfactor +local splitdimen = number.splitdimen local nodecodes = nodes.nodecodes local skipcodes = nodes.skipcodes @@ -258,26 +259,43 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a return head end local w = list_dimensions(parent.glue_set,parent.glue_sign,parent.glue_order,f,l.next) - local method, offset, continue, dy, rulethickness, unit, order, max, ma, ca, ta = - d.method, d.offset, d.continue, d.dy, d.rulethickness, d.unit, d.order, d.max, d.ma, d.ca, d.ta - local e = dimenfactor(unit,fontdata[f.font]) -- what if no glyph node + local method, offset, continue, dy, order, max = d.method, d.offset, d.continue, d.dy, d.order, d.max + local rulethickness, unit = d.rulethickness, d.unit + local ma, ca, ta = d.ma, d.ca, d.ta local colorspace = (ma > 0 and ma) or has_attribute(f,a_colorspace) or 1 local color = (ca > 0 and ca) or has_attribute(f,a_color) local transparency = (ta > 0 and ta) or has_attribute(f,a_transparency) local foreground = order == variables.foreground - rulethickness= rulethickness/2 + + local e = dimenfactor(unit,fontdata[f.font]) -- what if no glyph node + + local rt = tonumber(rulethickness) + if rt then + rulethickness = e * rulethickness / 2 + else + local n, u = splitdimen(rulethickness) + if n and u then -- we need to intercept ex and em and % and ... + rulethickness = n * dimenfactor(u,fontdata[f.font]) / 2 + else + rulethickness = 1/5 + end + end + if level > max then level = max end if method == 0 then -- center offset = 2*offset - m = (offset+(level-1)*dy+rulethickness)*e/2 +-- m = (offset+(level-1)*dy+rulethickness)*e/2 + m = (offset+(level-1)*dy)*e/2 + rulethickness/2 else m = 0 end for i=1,level do - local ht = (offset+(i-1)*dy+rulethickness)*e - m - local dp = -(offset+(i-1)*dy-rulethickness)*e + m +-- local ht = (offset+(i-1)*dy+rulethickness)*e - m +-- local dp = -(offset+(i-1)*dy-rulethickness)*e + m + local ht = (offset+(i-1)*dy)*e + rulethickness - m + local dp = -(offset+(i-1)*dy)*e + rulethickness + m local r = new_rule(w,ht,dp) local v = has_attribute(f,a_viewerlayer) -- quick hack diff --git a/tex/context/base/node-rul.mkiv b/tex/context/base/node-rul.mkiv index 5b260e669..54a43a006 100644 --- a/tex/context/base/node-rul.mkiv +++ b/tex/context/base/node-rul.mkiv @@ -21,15 +21,14 @@ %D overstrike,overstrikes, %D setupbar} %D -%D In the rare case that we need undelined words, for instance -%D because all font alternatives are already in use, one can -%D use \type{\underbar} and \type{\overstrike} and their plural -%D forms. +%D In the rare case that we need undelined words, for instance because all font +%D alternatives are already in use, one can use \type {\underbar} and \type +%D {\overstrike} and their plural forms. %D %D \startbuffer -%D \underbars{drawing \underbar{bars} under words is a typewriter leftover} -%D \overstrikes{striking words makes them \overstrike{unreadable} but -%D sometimes even \overbar{top lines} come into view.} +%D \underbars {drawing \underbar{bars} under words is a typewriter leftover} +%D \overstrikes {striking words makes them \overstrike {unreadable} but +%D sometimes even \overbar {top lines} come into view.} %D \stopbuffer %D %D \typebuffer @@ -38,9 +37,9 @@ %D \getbuffer %D \stoplines %D -%D The next macros are derived from the \PLAIN\ \TEX\ one, but -%D also supports nesting. The \type{$} keeps us in horizontal -%D mode and at the same time applies grouping. +%D The next macros are derived from the \PLAIN\ \TEX\ one, but also supports +%D nesting. The \type{$} keeps us in horizontal mode and at the same time +%D applies grouping. %D %D \showsetup{underbar} %D \showsetup{underbars} @@ -51,9 +50,19 @@ %D %D \showsetup{setupunderbar} %D -%D Nested bars can be configured by appending \type {:<index>} to the -%D category. - +%D Nested bars can be configured by appending \type {:<index>} to the category. +%D Normally units in combination with a unitless thickness specification but +%D there units can be used too. +%D +%D \startbuffer +%D \setupbars[unit=mm,rulethickness=1] bar\startbar[underbar]foo\stopbar bar\blank +%D \setupbars[unit=ex,rulethickness=1] bar\startbar[underbar]foo\stopbar bar\blank +%D \setupbars[unit=pt,rulethickness=1] bar\startbar[underbar]foo\stopbar bar\blank +%D \setupbars[unit=pt,rulethickness=10pt] bar\startbar[underbar]foo\stopbar bar +%D \stopbuffer +%D +%D \typebuffer \blank \getbuffer \blank +%D %D As with many early usage of \LUA\ in \MKIV\ this mechanism explores a way %D to deal with local settings at the \TEX\ end and remembering parameters %D at the \LUA\ end. We might do things differently now, but as settings normally @@ -107,7 +116,7 @@ offset = \barparameter\c!offset, continue = "\barparameter\c!continue", dy = \barparameter\c!dy, - rulethickness = \barparameter\c!rulethickness, + rulethickness = "\barparameter\c!rulethickness", unit = "\barparameter\c!unit", order = "\barparameter\c!order", max = \barparameter\c!max, diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 98c3cd6e6..4fc22a521 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 6b21762f5..e33c94278 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index 7ce638acb..0b8f72e53 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -109,20 +109,6 @@ \def\thenamedcounterlevel#1% {\xthenamedheadlevel{\strc_counters_way{#1}}} -\def\xthenamedheadlevel#1% - {\xsectionlevel{#1}{\sectionheadsection{\sectionheadcoupling{#1}}}} - -\def\xsectionlevel#1#2% direct indirect - {\csname\??headlevel - \ifcsname\??headlevel#1\endcsname - #1% - \else\ifcsname\??headlevel#2\endcsname - #2% - \else - \v!none - \fi\fi - \endcsname} - \def\strc_counters_check_setup#1% does it have to happen here? {% this can be done at the lua end / a bit messy here ... todo ... \ifcsname\??counter#1\c!number\endcsname diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index 29f3c07ea..0eb531832 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -447,13 +447,34 @@ \def\resetcurrentstructuremarks {\resetmarking[\lastsectionname]} % will become option %def\resetcurrentstructuremarkswithpage{\resetmarking[\lastsectionname]} % will become option -% -2=text -1=manual 0=block 1+=structurelevel +% We could use a commandhandler here but sections are somewhat special in the +% sense that we have two ways of chaining: the main section (levels) as well +% as rendering (head). + +% -2 = text +% -1 = manual +% 0 = block +% +1 = structurelevel 1 .. n \newcount\maxstructuredepth \def\sectionlevel#1% {\csname\??headlevel\ifcsname\??headlevel#1\endcsname#1\else\v!none\fi\endcsname} +\def\namedsectionlevel#1#2% direct indirect + {\csname\??headlevel + \ifcsname\??headlevel#1\endcsname + #1% + \else\ifcsname\??headlevel#2\endcsname + #2% + \else + \v!none + \fi\fi + \endcsname} + +\def\xthenamedheadlevel#1% + {\namedsectionlevel{#1}{\sectionheadsection{\sectionheadcoupling{#1}}}} + \setvalue{\??headlevel\v!block}{0} \setvalue{\??headlevel\v!none }{-1} \setvalue{\??headlevel\v!text }{-2} @@ -481,16 +502,16 @@ \fi} \unexpanded\def\setupsection - {\dotripleempty\dosetupsection} + {\dotripleempty\strc_sectioning_setup} -\def\dosetupsection[#1][#2][#3]% +\def\strc_sectioning_setup[#1][#2][#3]% {\ifcsname\??headlevel#1\endcsname - \dodosetupsection[#1][#2][#3]% + \strc_sectioning_setup_indeed[#1][#2][#3]% \else - \dodosetupsection[\sectionheadsection{#1}][#2][#3]% + \strc_sectioning_setup_indeed[\sectionheadsection{#1}][#2][#3]% \fi} -\def\dodosetupsection[#1][#2][#3]% +\def\strc_sectioning_setup_indeed[#1][#2][#3]% {\pushmacro\currenthead \ifthirdargument \edef\currenthead{#1#2}% % not used at any more in mkiv (sets now) diff --git a/tex/context/base/util-dim.lua b/tex/context/base/util-dim.lua index 47e43c386..4668326df 100644 --- a/tex/context/base/util-dim.lua +++ b/tex/context/base/util-dim.lua @@ -16,7 +16,7 @@ table.</p> --ldx]]-- local format, match, gsub, type, setmetatable = string.format, string.match, string.gsub, type, setmetatable -local P, S, R, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.match +local P, S, R, Cc, C, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.C, lpeg.match local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex @@ -141,6 +141,12 @@ local dimenpair = amount/tonumber * (unit^1/dimenfactors + Cc(1)) -- tonumber is lpeg.patterns.dimenpair = dimenpair +local splitter = amount/tonumber * C(unit^1) + +function number.splitdimen(str) + return lpegmatch(splitter,str) +end + --[[ldx-- <p>We use a metatable to intercept errors. When no key is found in the table with factors, the metatable will be consulted for an diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5e7472c00..80c8be2e0 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 : 07/09/12 23:06:25 +-- merge date : 07/10/12 00:14:53 do -- begin closure to overcome local limits and interference |