summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-08-04 02:15:04 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-08-04 02:15:04 +0200
commit30b56919983d704ecd26f1681e42a1a8c3c15044 (patch)
treee7af4451327dd0a6f31fc379c22587300be80b06
parent22570ae5671af164143a1831310fe3d4b73f4983 (diff)
downloadcontext-30b56919983d704ecd26f1681e42a1a8c3c15044.tar.gz
2015-08-04 01:27:00
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4199 -> 4198 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua27
-rw-r--r--tex/context/base/core-con.mkiv8
-rw-r--r--tex/context/base/pack-rul.mkiv18
-rw-r--r--tex/context/base/spac-prf.lua103
-rw-r--r--tex/context/base/status-files.pdfbin24460 -> 24463 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin255415 -> 255437 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
10 files changed, 103 insertions, 59 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index c19f3f4a2..8a835e568 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{2015.08.03 15:33}
+\newcontextversion{2015.08.04 01:25}
%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 febc7fa42..ba07df476 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index baef083fc..2e5b71d87 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2015.08.03 15:33}
+\edef\contextversion{2015.08.04 01:25}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index 37942ae71..63dfcae90 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -17,7 +17,7 @@ slower but look nicer this way.</p>
--ldx]]--
local floor, date, time, concat = math.floor, os.date, os.time, table.concat
-local lower, rep, match = string.lower, string.rep, string.match
+local lower, rep, match, gsub = string.lower, string.rep, string.match, string.gsub
local utfchar, utfbyte = utf.char, utf.byte
local tonumber, tostring = tonumber, tostring
local P, C, Cs, lpegmatch = lpeg.P, lpeg.C, lpeg.Cs, lpeg.match
@@ -161,6 +161,19 @@ counters['koreancirclenumerals'] = counters['korean-circle']
counters['sloveniannumerals'] = counters['slovenian']
counters['spanishnumerals'] = counters['spanish']
+local decimals = allocate {
+ ['arabic'] = {
+ ["0"] = "٠", ["1"] = "١", ["2"] = "٢", ["3"] = "٣", ["4"] = "٤",
+ ["5"] = "٥", ["6"] = "٦", ["7"] = "٧", ["8"] = "٨", ["9"] = "٩",
+ },
+ ['persian'] = {
+ ["0"] = "۰", ["1"] = "۱", ["2"] = "۲", ["3"] = "۳", ["4"] = "۴",
+ ["5"] = "۵", ["6"] = "۶", ["7"] = "۷", ["8"] = "۸", ["9"] = "۹",
+ }
+}
+
+languages.decimals = decimals
+
local fallback = utfbyte('0')
local function chr(n,m)
@@ -233,6 +246,16 @@ end
converters.alphabetic = alphabetic
converters.Alphabetic = Alphabetic
+-- we could make a replacer
+
+local function todecimals(n,name)
+ local stream = tostring(n)
+ local mapping = decimals[name]
+ return mapping and gsub(stream,".",mapping) or stream
+end
+
+converters.decimals = todecimals
+
local lower_offset = 96
local upper_offset = 64
@@ -254,6 +277,8 @@ implement { name = "Character", actions = { chr, context }, arguments = { "int
implement { name = "characters", actions = { chrs, context }, arguments = { "integer", lower_offset } }
implement { name = "Characters", actions = { chrs, context }, arguments = { "integer", upper_offset } }
+implement { name = "decimals", actions = { todecimals, context }, arguments = { "integer", "string" } }
+
local weekday = os.weekday -- moved to l-os
local isleapyear = os.isleapyear -- moved to l-os
local nofdays = os.nofdays -- moved to l-os
diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv
index f7d718f44..cf4817cf9 100644
--- a/tex/context/base/core-con.mkiv
+++ b/tex/context/base/core-con.mkiv
@@ -91,6 +91,8 @@
\def\Greeknumerals #1{\clf_Alphabetic\numexpr#1\relax{greek}}
\def\arabicnumerals #1{\clf_alphabetic\numexpr#1\relax{arabic}}
\def\persiannumerals #1{\clf_alphabetic\numexpr#1\relax{persian}}
+\def\arabicdecimals #1{\clf_decimals \numexpr#1\relax{arabic}}
+\def\persiandecimals #1{\clf_decimals \numexpr#1\relax{persian}}
\let\arabicexnumerals \persiannumerals
@@ -684,8 +686,8 @@
%defineconversion [Ñ] [\Spanishnumerals]
\defineconversion [abjadnumerals] [\abjadnumerals]
-\defineconversion [abjadnodotnumerals] [\adjadnodotnumerals]
-\defineconversion [abjadnaivenumerals] [\adjadnaivenumerals]
+\defineconversion [abjadnodotnumerals] [\abjadnodotnumerals]
+\defineconversion [abjadnaivenumerals] [\abjadnaivenumerals]
\defineconversion [thainumerals] [\thainumerals]
\defineconversion [devanagarinumerals] [\devanagarinumerals]
@@ -697,6 +699,8 @@
\defineconversion [arabicnumerals] [\arabicnumerals]
\defineconversion [persiannumerals] [\persiannumerals]
\defineconversion [arabicexnumerals] [\arabicexnumerals]
+\defineconversion [arabicdecimals] [\arabicdecimals]
+\defineconversion [persiandecimals] [\persiandecimals]
\defineconversion [koreannumerals] [\koreannumerals]
\defineconversion [koreanparentnumerals] [\koreanparentnumerals]
diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv
index 911076f60..2a7cca92a 100644
--- a/tex/context/base/pack-rul.mkiv
+++ b/tex/context/base/pack-rul.mkiv
@@ -1506,12 +1506,12 @@
{%\pack_framed_stop_orientation % hm, wrong place ! should rotate the result (after reshape) .. moved down
\pack_framed_locator_before\p_framed_location
\ifconditional\c_framed_has_format
- \ifconditional\c_framed_has_height \else
- \edef\p_profile{\framedparameter\c!profile}%
- \ifx\p_profile\empty\else
- \pack_framed_profile_box
- \fi
- \fi
+% \ifconditional\c_framed_has_height \else
+% \edef\p_profile{\framedparameter\c!profile}%
+% \ifx\p_profile\empty\else
+% \pack_framed_profile_box
+% \fi
+% \fi
\ifx\p_framed_autowidth\v!force
\pack_framed_finish_a
\else\ifx\localwidth\v!fit
@@ -1525,6 +1525,12 @@
\else
\pack_framed_finish_c
\fi\fi\fi
+ \ifconditional\c_framed_has_height \else
+ \edef\p_profile{\framedparameter\c!profile}%
+ \ifx\p_profile\empty\else
+ \pack_framed_profile_box
+ \fi
+ \fi
\ifconditional\page_postprocessors_needed_box
% quite late
\page_postprocessors_linenumbers_box\b_framed_normal
diff --git a/tex/context/base/spac-prf.lua b/tex/context/base/spac-prf.lua
index 503a31e29..47b51ea30 100644
--- a/tex/context/base/spac-prf.lua
+++ b/tex/context/base/spac-prf.lua
@@ -182,12 +182,10 @@ local function getprofile(line,step)
wd = getfield(spec,"width")
if glue_sign == 1 then
if getfield(spec,"stretch_order") == glue_order then
- -- wd = (wd + getfield(spec,"stretch")) * glue_set
wd = wd + getfield(spec,"stretch") * glue_set
end
elseif glue_sign == 2 then
if getfield(spec,"shrink_order") == glue_order then
- -- wd = (wd - getfield(spec,"shrink")) * glue_set
wd = wd - getfield(spec,"shrink") * glue_set
end
end
@@ -242,6 +240,8 @@ local function getprofile(line,step)
ht = 0
dp = 0
progress()
+ else
+-- print(nodecodes[id])
end
current = getnext(current)
end
@@ -471,7 +471,7 @@ end
-- lineskip | lineskiplimit
-local function inject(top,bot,amount)
+local function inject(top,bot,amount) -- todo: look at penalties
local glue = new_glue(amount)
--
setattr(glue,a_profilemethod,0)
@@ -541,24 +541,18 @@ methods[v_fixed] = function(top,bot,t_profile,b_profile,specification)
local snapmethod = getattr(top,a_snapmethod)
if snapmethod then
- distance = 0 -- if needed take it from the snapper
- end
- if delta >= distance then
- setfield(top,"depth",strutdp)
- setfield(bot,"height",strutht)
- return true
- end
+ -- no distance (yet)
- local delta = getdelta(t_profile,b_profile)
+ if delta < lineheight then
+ setfield(top,"depth",strutdp)
+ setfield(bot,"height",strutht)
+ return true
+ end
- if delta < lineheight + distance then
- setfield(top,"depth",strutdp)
- setfield(bot,"height",strutht)
- return true
- end
- if snapmethod then
+ local delta = getdelta(t_profile,b_profile)
+
local dp = strutdp
while depth > lineheight - strutdp do
depth = depth - lineheight
@@ -575,25 +569,44 @@ methods[v_fixed] = function(top,bot,t_profile,b_profile,specification)
if lines > 0 then
inject(top,bot,-lines * lineheight)
end
+
return true
+
end
- local room = total - delta
+ if delta < lineheight + distance then
+ setfield(top,"depth",strutdp)
+ setfield(bot,"height",strutht)
+ return true
+ end
+
+ if depth < strutdp then
+ setfield(top,"depth",strutdp)
+ total = total - depth + strutdp
+ end
+ if height < strutht then
+ setfield(bot,"height",strutht)
+ total = total - height + strutht
+ end
+
+ local target = total - delta
local factor = specification.factor or 1
- local lines = specification.lines or 0 -- todo
+ -- local lines = specification.lines or 0
local step = lineheight / factor
local correction = 0
- local initial = room - distance
local nofsteps = 0
- while initial > step do -- a loop is more accurate, for now
+ while correction < target - step do -- a loop is more accurate, for now
correction = correction + step
- initial = initial - step
nofsteps = nofsteps + 1
end
- if correction + total <= lineheight then
- setfield(top,"depth",strutdp)
- setfield(bot,"height",strutht)
+ -- target + distance = wanted
+ -- total - correction = calculated
+
+ local d = (total - correction) - (target + distance)
+
+ if d > 0 then
+ correction = correction - d
end
if trace_profile then
@@ -604,20 +617,16 @@ methods[v_fixed] = function(top,bot,t_profile,b_profile,specification)
report(" total : %p",total)
report(" lineheight : %p",lineheight)
report(" delta : %p",delta)
- report(" room : %p",room)
+ report(" target : %p",target)
report(" factor : %i",factor)
report(" distance : %p",distance)
report(" step : %p",step)
report(" nofsteps : %i",nofsteps)
- report(" max lines : %s",lines == 0 and "unset" or lines)
+ -- report(" max lines : %s",lines == 0 and "unset" or lines)
report(" correction : %p",correction)
end
- correction = correction - distance
-
- if correction ~= 0 then
- inject(top,bot,-correction) -- we could mess with the present glue (if present)
- end
+ inject(top,bot,-correction) -- we could mess with the present glue (if present)
return true -- remove interlineglue
@@ -862,28 +871,28 @@ function profiling.profilebox(specification)
bot = nil
end
elseif id == glue_code then
-local subtype = getsubtype(current)
-if subtype == lineskip_code or subtype == baselineskip_code then
- if top then
- local spec = getfield(current,"spec")
- local wd = getfield(spec,"width")
- if wd > 0 then
- distance = wd
- lastglue = current
- elseif wd < 0 then
+ local subtype = getsubtype(current)
+ if subtype == lineskip_code or subtype == baselineskip_code then
+ if top then
+ local spec = getfield(current,"spec")
+ local wd = getfield(spec,"width")
+ if wd > 0 then
+ distance = wd
+ lastglue = current
+ elseif wd < 0 then
+ top = nil
+ bot = nil
+ else
+ -- ok
+ end
+ else
top = nil
bot = nil
- else
- -- ok
end
else
top = nil
bot = nil
end
-else
- top = nil
- bot = nil
-end
elseif id == penalty_code then
-- okay
else
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 8d209396f..dd044e140 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index baf4424a1..7b199667f 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 67366bfed..680952a7a 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 : 08/03/15 15:33:36
+-- merge date : 08/04/15 01:25:05
do -- begin closure to overcome local limits and interference