diff options
Diffstat (limited to 'tex')
45 files changed, 668 insertions, 523 deletions
diff --git a/tex/context/base/char-cjk.lua b/tex/context/base/char-cjk.lua index bce1df615..75daf2e01 100644 --- a/tex/context/base/char-cjk.lua +++ b/tex/context/base/char-cjk.lua @@ -17,36 +17,125 @@ local ranges = characters.ranges -- Hangul Syllable -- The following conversion is taken from unicode.org/reports/tr15/tr15-23.html#Hangul --- but adapted to our needs +-- but adapted to our needs. + +-- local SBase = 0xAC00 +-- +-- local LBase, LCount = 0x1100, 19 +-- local VBase, VCount = 0x1161, 21 +-- local TBase, TCount = 0x11A7, 28 +-- +-- local NCount = VCount * TCount +-- local SCount = LCount * NCount +-- +-- local function decomposed(unicode) +-- local SIndex = unicode - SBase +-- if SIndex >= 0 and SIndex < SCount then +-- local lead_consonant = LBase + floor( SIndex / NCount) +-- local medial_vowel = VBase + floor((SIndex % NCount) / TCount) +-- local tail_consonant = TBase + SIndex % TCount +-- if tail_consonant ~= TBase then +-- return lead_consonant, medial_vowel, tail_consonant +-- else +-- return lead_consonant, medial_vowel +-- end +-- end +-- end +-- +-- Lua will optimize the inline constants so the next variant is +-- 10% faster. In practice this will go unnoticed, but it's also less +-- code, so let's do it. Pushing the constant section into the +-- function body saves 5%. -local SBase = 0xAC00 - -local LBase, LCount = 0x1100, 19 -local VBase, VCount = 0x1161, 21 -local TBase, TCount = 0x11A7, 28 - -local NCount = VCount * TCount -local SCount = LCount * NCount +local function decomposed(unicode) + local index = unicode - 0xAC00 + if index >= 0 and index < 19 * 21 * 28 then + local lead_consonant = 0x1100 + floor( index / (21 * 28)) + local medial_vowel = 0x1161 + floor((index % (21 * 28)) / 28) + local tail_consonant = 0x11A7 + index % 28 + if tail_consonant ~= 0x11A7 then + return lead_consonant, medial_vowel, tail_consonant + else + return lead_consonant, medial_vowel + end + end +end -local L_TABLE = { [0] = +local lead_consonants = { [0] = "G", "GG", "N", "D", "DD", "R", "M", "B", "BB", "S", "SS", "", "J", "JJ", "C", "K", "T", "P", "H" } -local V_TABLE = { [0] = +local medial_vowels = { [0] = "A", "AE", "YA", "YAE", "EO", "E", "YEO", "YE", "O", "WA", "WAE", "OE", "YO", "U", "WEO", "WE", "WI", "YU", "EU", "YI", "I" } -local T_TABLE = { [0] = +local tail_consonants = { [0] = "", "G", "GG", "GS", "N", "NJ", "NH", "D", "L", "LG", "LM", "LB", "LS", "LT", "LP", "LH", "M", "B", "BS", "S", "SS", "NG", "J", "C", "K", "T", "P", "H" } +-- local function description(unicode) +-- local index = unicode - 0xAC00 +-- if index >= 0 and index < 19 * 21 * 28 then +-- local lead_consonant = floor( index / NCount) +-- local medial_vowel = floor((index % NCount) / TCount) +-- local tail_consonant = index % TCount +-- return format( +-- "HANGUL SYLLABLE %s%s%s", +-- lead_consonants[lead_consonant], +-- medial_vowels [medial_vowel ], +-- tail_consonants[tail_consonant] +-- ) +-- end +-- end + +local function description(unicode) + local index = unicode - 0xAC00 + if index >= 0 and index < 19 * 21 * 28 then + local lead_consonant = floor( index / (21 * 28)) + local medial_vowel = floor((index % (21 * 28)) / 28) + local tail_consonant = index % 28 + return format( + "HANGUL SYLLABLE %s%s%s", + lead_consonants[lead_consonant], + medial_vowels [medial_vowel ], + tail_consonants[tail_consonant] + ) + end +end + +-- so far -local remapped = { -- this will be merged into char-def.lua +-- We have a [lead consonant,medial vowel,tail consonant] where the last one +-- is optional. For sort ranges we need the first one but some are collapsed. +-- Beware, we map to modern so the font should support it. + +local function leadconsonant(unicode) + return + -- unicode < 0xAC00 and nil -- original + -- unicode > 0xD7AF and nil or -- original + unicode >= 0xD558 and 0x314E or -- 하 => ㅎ + unicode >= 0xD30C and 0x314D or -- 파 => ㅍ + unicode >= 0xD0C0 and 0x314C or -- 타 => ㅌ + unicode >= 0xCE74 and 0x314B or -- 카 => ㅋ + unicode >= 0xCC28 and 0x314A or -- 차 => ㅊ + unicode >= 0xC790 and 0x3148 or -- 자 => ㅈ + unicode >= 0xC544 and 0x3147 or -- 아 => ㅇ + unicode >= 0xC0AC and 0x3145 or -- 사 => ㅅ + unicode >= 0xBC14 and 0x3142 or -- 바 => ㅂ + unicode >= 0xB9C8 and 0x3141 or -- 마 => ㅁ + unicode >= 0xB77C and 0x3139 or -- 라 => ㄹ + unicode >= 0xB2E4 and 0x3137 or -- 다 => ㄷ + unicode >= 0xB098 and 0x3134 or -- 나 => ㄴ + unicode >= 0xAC00 and 0x3131 or -- 가 => ㄱ + nil -- can't happen +end + +local remapped = { -- this might be merged into char-def.lua [0x1100] = 0x3131, -- G [0x1101] = 0x3132, -- GG [0x1102] = 0x3134, -- N @@ -120,34 +209,11 @@ local remapped = { -- this will be merged into char-def.lua [0x11C1] = 0x314E, -- H } -local function decomposed(unicode) - local SIndex = unicode - SBase - if SIndex >= 0 and SIndex < SCount then - local L = LBase + floor(SIndex / NCount) - local V = VBase + floor((SIndex % NCount) / TCount) - local T = TBase + SIndex % TCount - if T ~= TBase then - return L, V, T - else - return L, V - end - end -end - -local function description(unicode) - local SIndex = unicode - SBase - if SIndex >= 0 and SIndex < SCount then - local LIndex = floor(SIndex / NCount) - local VIndex = floor((SIndex % NCount) / TCount) - local TIndex = SIndex % TCount - return format("HANGUL SYLLABLE %s%s%s",L_TABLE[LIndex],V_TABLE[VIndex],T_TABLE[TIndex]) - end -end - characters.hangul = { - decomposed = decomposed, - description = description, - remapped = remapped, + decomposed = decomposed, + description = description, + leadconsonant = leadconsonant, + remapped = remapped, } -- so far @@ -164,32 +230,14 @@ local hangul_syllable_metatable = { __index = function(t,k) local u = t.unicodeslot if k == "fscode" then - local fscode = -- firstsplitcode - u < 0xAC00 and nil -- original - or u > 0xD7AF and nil -- original - or u >= 0xD558 and 0x314E -- 하 => ㅎ - or u >= 0xD30C and 0x314D -- 파 => ㅍ - or u >= 0xD0C0 and 0x314C -- 타 => ㅌ - or u >= 0xCE74 and 0x314B -- 카 => ㅋ - or u >= 0xCC28 and 0x314A -- 차 => ㅊ - or u >= 0xC790 and 0x3148 -- 자 => ㅈ - or u >= 0xC544 and 0x3147 -- 아 => ㅇ - or u >= 0xC0AC and 0x3145 -- 사 => ㅅ - or u >= 0xBC14 and 0x3142 -- 바 => ㅂ - or u >= 0xB9C8 and 0x3141 -- 마 => ㅁ - or u >= 0xB77C and 0x3139 -- 라 => ㄹ - or u >= 0xB2E4 and 0x3137 -- 다 => ㄷ - or u >= 0xB098 and 0x3134 -- 나 => ㄴ - or u >= 0xAC00 and 0x3131 -- 가 => ㄱ -- was 0xAC20 - or nil -- can't happen - t[k] = fscode - return fscode + -- no need to cache this as we normally use fscodes + return leadconsonant(u) elseif k == "specials" then return { "char", decomposed(u) } elseif k == "description" then return description(u) else - return hangul_syllable_basetable[k]-- no store + return hangul_syllable_basetable[k] end end } diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index f53f870b7..88a7aa6e2 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -685,6 +685,7 @@ characters.data={ adobename="I", category="lu", cjkwd="na", + contextname="dotlessI", description="LATIN CAPITAL LETTER I", direction="l", lccode=0x0069, @@ -696,6 +697,7 @@ characters.data={ adobename="J", category="lu", cjkwd="na", + contextname="dotlessJ", description="LATIN CAPITAL LETTER J", direction="l", lccode=0x006A, diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua index 6b6900ecd..bb7cce997 100644 --- a/tex/context/base/char-ini.lua +++ b/tex/context/base/char-ini.lua @@ -127,188 +127,190 @@ end ) --~ setmetatable(data,{ __index = function(t,k) return "" end }) -- quite old, obsolete -characters.blocks = allocate { - ["aegeannumbers"] = { 0x10100, 0x1013F, "Aegean Numbers" }, - ["alphabeticpresentationforms"] = { 0x0FB00, 0x0FB4F, "Alphabetic Presentation Forms" }, - ["ancientgreekmusicalnotation"] = { 0x1D200, 0x1D24F, "Ancient Greek Musical Notation" }, - ["ancientgreeknumbers"] = { 0x10140, 0x1018F, "Ancient Greek Numbers" }, - ["ancientsymbols"] = { 0x10190, 0x101CF, "Ancient Symbols" }, - ["arabic"] = { 0x00600, 0x006FF, "Arabic" }, - ["arabicpresentationformsa"] = { 0x0FB50, 0x0FDFF, "Arabic Presentation Forms-A" }, - ["arabicpresentationformsb"] = { 0x0FE70, 0x0FEFF, "Arabic Presentation Forms-B" }, - ["arabicsupplement"] = { 0x00750, 0x0077F, "Arabic Supplement" }, - ["armenian"] = { 0x00530, 0x0058F, "Armenian" }, - ["arrows"] = { 0x02190, 0x021FF, "Arrows" }, - ["balinese"] = { 0x01B00, 0x01B7F, "Balinese" }, - ["basiclatin"] = { 0x00000, 0x0007F, "Basic Latin" }, - ["bengali"] = { 0x00980, 0x009FF, "Bengali" }, - ["blockelements"] = { 0x02580, 0x0259F, "Block Elements" }, - ["bopomofo"] = { 0x03100, 0x0312F, "Bopomofo" }, - ["bopomofoextended"] = { 0x031A0, 0x031BF, "Bopomofo Extended" }, - ["boxdrawing"] = { 0x02500, 0x0257F, "Box Drawing" }, - ["braillepatterns"] = { 0x02800, 0x028FF, "Braille Patterns" }, - ["buginese"] = { 0x01A00, 0x01A1F, "Buginese" }, - ["buhid"] = { 0x01740, 0x0175F, "Buhid" }, - ["byzantinemusicalsymbols"] = { 0x1D000, 0x1D0FF, "Byzantine Musical Symbols" }, - ["carian"] = { 0x102A0, 0x102DF, "Carian" }, - ["cham"] = { 0x0AA00, 0x0AA5F, "Cham" }, - ["cherokee"] = { 0x013A0, 0x013FF, "Cherokee" }, - ["cjkcompatibility"] = { 0x03300, 0x033FF, "CJK Compatibility" }, - ["cjkcompatibilityforms"] = { 0x0FE30, 0x0FE4F, "CJK Compatibility Forms" }, - ["cjkcompatibilityideographs"] = { 0x0F900, 0x0FAFF, "CJK Compatibility Ideographs" }, - ["cjkcompatibilityideographssupplement"] = { 0x2F800, 0x2FA1F, "CJK Compatibility Ideographs Supplement" }, - ["cjkradicalssupplement"] = { 0x02E80, 0x02EFF, "CJK Radicals Supplement" }, - ["cjkstrokes"] = { 0x031C0, 0x031EF, "CJK Strokes" }, - ["cjksymbolsandpunctuation"] = { 0x03000, 0x0303F, "CJK Symbols and Punctuation" }, - ["cjkunifiedideographs"] = { 0x04E00, 0x09FFF, "CJK Unified Ideographs" }, - ["cjkunifiedideographsextensiona"] = { 0x03400, 0x04DBF, "CJK Unified Ideographs Extension A" }, - ["cjkunifiedideographsextensionb"] = { 0x20000, 0x2A6DF, "CJK Unified Ideographs Extension B" }, - ["combiningdiacriticalmarks"] = { 0x00300, 0x0036F, "Combining Diacritical Marks" }, - ["combiningdiacriticalmarksforsymbols"] = { 0x020D0, 0x020FF, "Combining Diacritical Marks for Symbols" }, - ["combiningdiacriticalmarkssupplement"] = { 0x01DC0, 0x01DFF, "Combining Diacritical Marks Supplement" }, - ["combininghalfmarks"] = { 0x0FE20, 0x0FE2F, "Combining Half Marks" }, - ["controlpictures"] = { 0x02400, 0x0243F, "Control Pictures" }, - ["coptic"] = { 0x02C80, 0x02CFF, "Coptic" }, - ["countingrodnumerals"] = { 0x1D360, 0x1D37F, "Counting Rod Numerals" }, - ["cuneiform"] = { 0x12000, 0x123FF, "Cuneiform" }, - ["cuneiformnumbersandpunctuation"] = { 0x12400, 0x1247F, "Cuneiform Numbers and Punctuation" }, - ["currencysymbols"] = { 0x020A0, 0x020CF, "Currency Symbols" }, - ["cypriotsyllabary"] = { 0x10800, 0x1083F, "Cypriot Syllabary" }, - ["cyrillic"] = { 0x00400, 0x004FF, "Cyrillic" }, - ["cyrillicextendeda"] = { 0x02DE0, 0x02DFF, "Cyrillic Extended-A" }, - ["cyrillicextendedb"] = { 0x0A640, 0x0A69F, "Cyrillic Extended-B" }, - ["cyrillicsupplement"] = { 0x00500, 0x0052F, "Cyrillic Supplement" }, - ["deseret"] = { 0x10400, 0x1044F, "Deseret" }, - ["devanagari"] = { 0x00900, 0x0097F, "Devanagari" }, - ["dingbats"] = { 0x02700, 0x027BF, "Dingbats" }, - ["dominotiles"] = { 0x1F030, 0x1F09F, "Domino Tiles" }, - ["enclosedalphanumerics"] = { 0x02460, 0x024FF, "Enclosed Alphanumerics" }, - ["enclosedcjklettersandmonths"] = { 0x03200, 0x032FF, "Enclosed CJK Letters and Months" }, - ["ethiopic"] = { 0x01200, 0x0137F, "Ethiopic" }, - ["ethiopicextended"] = { 0x02D80, 0x02DDF, "Ethiopic Extended" }, - ["ethiopicsupplement"] = { 0x01380, 0x0139F, "Ethiopic Supplement" }, - ["generalpunctuation"] = { 0x02000, 0x0206F, "General Punctuation" }, - ["geometricshapes"] = { 0x025A0, 0x025FF, "Geometric Shapes" }, - ["georgian"] = { 0x010A0, 0x010FF, "Georgian" }, - ["georgiansupplement"] = { 0x02D00, 0x02D2F, "Georgian Supplement" }, - ["glagolitic"] = { 0x02C00, 0x02C5F, "Glagolitic" }, - ["gothic"] = { 0x10330, 0x1034F, "Gothic" }, - ["greekandcoptic"] = { 0x00370, 0x003FF, "Greek and Coptic" }, - ["greekextended"] = { 0x01F00, 0x01FFF, "Greek Extended" }, - ["gujarati"] = { 0x00A80, 0x00AFF, "Gujarati" }, - ["gurmukhi"] = { 0x00A00, 0x00A7F, "Gurmukhi" }, - ["halfwidthandfullwidthforms"] = { 0x0FF00, 0x0FFEF, "Halfwidth and Fullwidth Forms" }, - ["hangulcompatibilityjamo"] = { 0x03130, 0x0318F, "Hangul Compatibility Jamo" }, - ["hanguljamo"] = { 0x01100, 0x011FF, "Hangul Jamo" }, - ["hangulsyllables"] = { 0x0AC00, 0x0D7AF, "Hangul Syllables" }, - ["hanunoo"] = { 0x01720, 0x0173F, "Hanunoo" }, - ["hebrew"] = { 0x00590, 0x005FF, "Hebrew" }, - ["highprivateusesurrogates"] = { 0x0DB80, 0x0DBFF, "High Private Use Surrogates" }, - ["highsurrogates"] = { 0x0D800, 0x0DB7F, "High Surrogates" }, - ["hiragana"] = { 0x03040, 0x0309F, "Hiragana" }, - ["ideographicdescriptioncharacters"] = { 0x02FF0, 0x02FFF, "Ideographic Description Characters" }, - ["ipaextensions"] = { 0x00250, 0x02AF, "IPA Extensions" }, - ["kanbun"] = { 0x03190, 0x0319F, "Kanbun" }, - ["kangxiradicals"] = { 0x02F00, 0x02FDF, "Kangxi Radicals" }, - ["kannada"] = { 0x00C80, 0x00CFF, "Kannada" }, - ["katakana"] = { 0x030A0, 0x030FF, "Katakana" }, - ["katakanaphoneticextensions"] = { 0x031F0, 0x031FF, "Katakana Phonetic Extensions" }, - ["kayahli"] = { 0x0A900, 0x0A92F, "Kayah Li" }, - ["kharoshthi"] = { 0x10A00, 0x10A5F, "Kharoshthi" }, - ["khmer"] = { 0x01780, 0x017FF, "Khmer" }, - ["khmersymbols"] = { 0x019E0, 0x019FF, "Khmer Symbols" }, - ["lao"] = { 0x00E80, 0x00EFF, "Lao" }, - ["latinextendeda"] = { 0x00100, 0x0017F, "Latin Extended-A" }, - ["latinextendedadditional"] = { 0x01E00, 0x01EFF, "Latin Extended Additional" }, - ["latinextendedb"] = { 0x00180, 0x0024F, "Latin Extended-B" }, - ["latinextendedc"] = { 0x02C60, 0x02C7F, "Latin Extended-C" }, - ["latinextendedd"] = { 0x0A720, 0x0A7FF, "Latin Extended-D" }, - ["latinsupplement"] = { 0x00080, 0x000FF, "Latin-1 Supplement" }, - ["lepcha"] = { 0x01C00, 0x01C4F, "Lepcha" }, - ["letterlikesymbols"] = { 0x02100, 0x0214F, "Letterlike Symbols" }, - ["limbu"] = { 0x01900, 0x0194F, "Limbu" }, - ["linearbideograms"] = { 0x10080, 0x100FF, "Linear B Ideograms" }, - ["linearbsyllabary"] = { 0x10000, 0x1007F, "Linear B Syllabary" }, - ["lowsurrogates"] = { 0x0DC00, 0x0DFFF, "Low Surrogates" }, - ["lycian"] = { 0x10280, 0x1029F, "Lycian" }, - ["lydian"] = { 0x10920, 0x1093F, "Lydian" }, - ["mahjongtiles"] = { 0x1F000, 0x1F02F, "Mahjong Tiles" }, - ["malayalam"] = { 0x00D00, 0x00D7F, "Malayalam" }, - ["mathematicalalphanumericsymbols"] = { 0x1D400, 0x1D7FF, "Mathematical Alphanumeric Symbols" }, - ["mathematicaloperators"] = { 0x02200, 0x022FF, "Mathematical Operators" }, - ["miscellaneousmathematicalsymbolsa"] = { 0x027C0, 0x027EF, "Miscellaneous Mathematical Symbols-A" }, - ["miscellaneousmathematicalsymbolsb"] = { 0x02980, 0x029FF, "Miscellaneous Mathematical Symbols-B" }, - ["miscellaneoussymbols"] = { 0x02600, 0x026FF, "Miscellaneous Symbols" }, - ["miscellaneoussymbolsandarrows"] = { 0x02B00, 0x02BFF, "Miscellaneous Symbols and Arrows" }, - ["miscellaneoustechnical"] = { 0x02300, 0x023FF, "Miscellaneous Technical" }, - ["modifiertoneletters"] = { 0x0A700, 0x0A71F, "Modifier Tone Letters" }, - ["mongolian"] = { 0x01800, 0x018AF, "Mongolian" }, - ["musicalsymbols"] = { 0x1D100, 0x1D1FF, "Musical Symbols" }, - ["myanmar"] = { 0x01000, 0x0109F, "Myanmar" }, - ["newtailue"] = { 0x01980, 0x019DF, "New Tai Lue" }, - ["nko"] = { 0x007C0, 0x007FF, "NKo" }, - ["numberforms"] = { 0x02150, 0x0218F, "Number Forms" }, - ["ogham"] = { 0x01680, 0x0169F, "Ogham" }, - ["olchiki"] = { 0x01C50, 0x01C7F, "Ol Chiki" }, - ["olditalic"] = { 0x10300, 0x1032F, "Old Italic" }, - ["oldpersian"] = { 0x103A0, 0x103DF, "Old Persian" }, - ["opticalcharacterrecognition"] = { 0x02440, 0x0245F, "Optical Character Recognition" }, - ["oriya"] = { 0x00B00, 0x00B7F, "Oriya" }, - ["osmanya"] = { 0x10480, 0x104AF, "Osmanya" }, - ["phagspa"] = { 0x0A840, 0x0A87F, "Phags-pa" }, - ["phaistosdisc"] = { 0x101D0, 0x101FF, "Phaistos Disc" }, - ["phoenician"] = { 0x10900, 0x1091F, "Phoenician" }, - ["phoneticextensions"] = { 0x01D00, 0x01D7F, "Phonetic Extensions" }, - ["phoneticextensionssupplement"] = { 0x01D80, 0x01DBF, "Phonetic Extensions Supplement" }, - ["privateusearea"] = { 0x0E000, 0x0F8FF, "Private Use Area" }, - ["rejang"] = { 0x0A930, 0x0A95F, "Rejang" }, - ["runic"] = { 0x016A0, 0x016FF, "Runic" }, - ["saurashtra"] = { 0x0A880, 0x0A8DF, "Saurashtra" }, - ["shavian"] = { 0x10450, 0x1047F, "Shavian" }, - ["sinhala"] = { 0x00D80, 0x00DFF, "Sinhala" }, - ["smallformvariants"] = { 0x0FE50, 0x0FE6F, "Small Form Variants" }, - ["spacingmodifierletters"] = { 0x002B0, 0x002FF, "Spacing Modifier Letters" }, - ["specials"] = { 0x0FFF0, 0x0FFFF, "Specials" }, - ["sundanese"] = { 0x01B80, 0x01BBF, "Sundanese" }, - ["superscriptsandsubscripts"] = { 0x02070, 0x0209F, "Superscripts and Subscripts" }, - ["supplementalarrowsa"] = { 0x027F0, 0x027FF, "Supplemental Arrows-A" }, - ["supplementalarrowsb"] = { 0x02900, 0x0297F, "Supplemental Arrows-B" }, - ["supplementalmathematicaloperators"] = { 0x02A00, 0x02AFF, "Supplemental Mathematical Operators" }, - ["supplementalpunctuation"] = { 0x02E00, 0x02E7F, "Supplemental Punctuation" }, - ["supplementaryprivateuseareaa"] = { 0xF0000, 0xFFFFF, "Supplementary Private Use Area-A" }, - ["supplementaryprivateuseareab"] = { 0x100000,0x10FFFF,"Supplementary Private Use Area-B" }, - ["sylotinagri"] = { 0x0A800, 0x0A82F, "Syloti Nagri" }, - ["syriac"] = { 0x00700, 0x0074F, "Syriac" }, - ["tagalog"] = { 0x01700, 0x0171F, "Tagalog" }, - ["tagbanwa"] = { 0x01760, 0x0177F, "Tagbanwa" }, - ["tags"] = { 0xE0000, 0xE007F, "Tags" }, - ["taile"] = { 0x01950, 0x0197F, "Tai Le" }, - ["taixuanjingsymbols"] = { 0x1D300, 0x1D35F, "Tai Xuan Jing Symbols" }, - ["tamil"] = { 0x00B80, 0x00BFF, "Tamil" }, - ["telugu"] = { 0x00C00, 0x00C7F, "Telugu" }, - ["thaana"] = { 0x00780, 0x007BF, "Thaana" }, - ["thai"] = { 0x00E00, 0x00E7F, "Thai" }, - ["tibetan"] = { 0x00F00, 0x00FFF, "Tibetan" }, - ["tifinagh"] = { 0x02D30, 0x02D7F, "Tifinagh" }, - ["ugaritic"] = { 0x10380, 0x1039F, "Ugaritic" }, - ["unifiedcanadianaboriginalsyllabics"] = { 0x01400, 0x0167F, "Unified Canadian Aboriginal Syllabics" }, - ["vai"] = { 0x0A500, 0x0A63F, "Vai" }, - ["variationselectors"] = { 0x0FE00, 0x0FE0F, "Variation Selectors" }, - ["variationselectorssupplement"] = { 0xE0100, 0xE01EF, "Variation Selectors Supplement" }, - ["verticalforms"] = { 0x0FE10, 0x0FE1F, "Vertical Forms" }, - ["yijinghexagramsymbols"] = { 0x04DC0, 0x04DFF, "Yijing Hexagram Symbols" }, - ["yiradicals"] = { 0x0A490, 0x0A4CF, "Yi Radicals" }, - ["yisyllables"] = { 0x0A000, 0x0A48F, "Yi Syllables" }, +local blocks = allocate { + ["aegeannumbers"] = { first = 0x10100, last = 0x1013F, description = "Aegean Numbers" }, + ["alphabeticpresentationforms"] = { first = 0x0FB00, last = 0x0FB4F, description = "Alphabetic Presentation Forms" }, + ["ancientgreekmusicalnotation"] = { first = 0x1D200, last = 0x1D24F, description = "Ancient Greek Musical Notation" }, + ["ancientgreeknumbers"] = { first = 0x10140, last = 0x1018F, description = "Ancient Greek Numbers" }, + ["ancientsymbols"] = { first = 0x10190, last = 0x101CF, description = "Ancient Symbols" }, + ["arabic"] = { first = 0x00600, last = 0x006FF, description = "Arabic" }, + ["arabicpresentationformsa"] = { first = 0x0FB50, last = 0x0FDFF, description = "Arabic Presentation Forms-A" }, + ["arabicpresentationformsb"] = { first = 0x0FE70, last = 0x0FEFF, description = "Arabic Presentation Forms-B" }, + ["arabicsupplement"] = { first = 0x00750, last = 0x0077F, description = "Arabic Supplement" }, + ["armenian"] = { first = 0x00530, last = 0x0058F, description = "Armenian" }, + ["arrows"] = { first = 0x02190, last = 0x021FF, description = "Arrows" }, + ["balinese"] = { first = 0x01B00, last = 0x01B7F, description = "Balinese" }, + ["basiclatin"] = { first = 0x00000, last = 0x0007F, description = "Basic Latin" }, + ["bengali"] = { first = 0x00980, last = 0x009FF, description = "Bengali" }, + ["blockelements"] = { first = 0x02580, last = 0x0259F, description = "Block Elements" }, + ["bopomofo"] = { first = 0x03100, last = 0x0312F, description = "Bopomofo" }, + ["bopomofoextended"] = { first = 0x031A0, last = 0x031BF, description = "Bopomofo Extended" }, + ["boxdrawing"] = { first = 0x02500, last = 0x0257F, description = "Box Drawing" }, + ["braillepatterns"] = { first = 0x02800, last = 0x028FF, description = "Braille Patterns" }, + ["buginese"] = { first = 0x01A00, last = 0x01A1F, description = "Buginese" }, + ["buhid"] = { first = 0x01740, last = 0x0175F, description = "Buhid" }, + ["byzantinemusicalsymbols"] = { first = 0x1D000, last = 0x1D0FF, description = "Byzantine Musical Symbols" }, + ["carian"] = { first = 0x102A0, last = 0x102DF, description = "Carian" }, + ["cham"] = { first = 0x0AA00, last = 0x0AA5F, description = "Cham" }, + ["cherokee"] = { first = 0x013A0, last = 0x013FF, description = "Cherokee" }, + ["cjkcompatibility"] = { first = 0x03300, last = 0x033FF, description = "CJK Compatibility" }, + ["cjkcompatibilityforms"] = { first = 0x0FE30, last = 0x0FE4F, description = "CJK Compatibility Forms" }, + ["cjkcompatibilityideographs"] = { first = 0x0F900, last = 0x0FAFF, description = "CJK Compatibility Ideographs" }, + ["cjkcompatibilityideographssupplement"] = { first = 0x2F800, last = 0x2FA1F, description = "CJK Compatibility Ideographs Supplement" }, + ["cjkradicalssupplement"] = { first = 0x02E80, last = 0x02EFF, description = "CJK Radicals Supplement" }, + ["cjkstrokes"] = { first = 0x031C0, last = 0x031EF, description = "CJK Strokes" }, + ["cjksymbolsandpunctuation"] = { first = 0x03000, last = 0x0303F, description = "CJK Symbols and Punctuation" }, + ["cjkunifiedideographs"] = { first = 0x04E00, last = 0x09FFF, description = "CJK Unified Ideographs" }, + ["cjkunifiedideographsextensiona"] = { first = 0x03400, last = 0x04DBF, description = "CJK Unified Ideographs Extension A" }, + ["cjkunifiedideographsextensionb"] = { first = 0x20000, last = 0x2A6DF, description = "CJK Unified Ideographs Extension B" }, + ["combiningdiacriticalmarks"] = { first = 0x00300, last = 0x0036F, description = "Combining Diacritical Marks" }, + ["combiningdiacriticalmarksforsymbols"] = { first = 0x020D0, last = 0x020FF, description = "Combining Diacritical Marks for Symbols" }, + ["combiningdiacriticalmarkssupplement"] = { first = 0x01DC0, last = 0x01DFF, description = "Combining Diacritical Marks Supplement" }, + ["combininghalfmarks"] = { first = 0x0FE20, last = 0x0FE2F, description = "Combining Half Marks" }, + ["controlpictures"] = { first = 0x02400, last = 0x0243F, description = "Control Pictures" }, + ["coptic"] = { first = 0x02C80, last = 0x02CFF, description = "Coptic" }, + ["countingrodnumerals"] = { first = 0x1D360, last = 0x1D37F, description = "Counting Rod Numerals" }, + ["cuneiform"] = { first = 0x12000, last = 0x123FF, description = "Cuneiform" }, + ["cuneiformnumbersandpunctuation"] = { first = 0x12400, last = 0x1247F, description = "Cuneiform Numbers and Punctuation" }, + ["currencysymbols"] = { first = 0x020A0, last = 0x020CF, description = "Currency Symbols" }, + ["cypriotsyllabary"] = { first = 0x10800, last = 0x1083F, description = "Cypriot Syllabary" }, + ["cyrillic"] = { first = 0x00400, last = 0x004FF, description = "Cyrillic" }, + ["cyrillicextendeda"] = { first = 0x02DE0, last = 0x02DFF, description = "Cyrillic Extended-A" }, + ["cyrillicextendedb"] = { first = 0x0A640, last = 0x0A69F, description = "Cyrillic Extended-B" }, + ["cyrillicsupplement"] = { first = 0x00500, last = 0x0052F, description = "Cyrillic Supplement" }, + ["deseret"] = { first = 0x10400, last = 0x1044F, description = "Deseret" }, + ["devanagari"] = { first = 0x00900, last = 0x0097F, description = "Devanagari" }, + ["dingbats"] = { first = 0x02700, last = 0x027BF, description = "Dingbats" }, + ["dominotiles"] = { first = 0x1F030, last = 0x1F09F, description = "Domino Tiles" }, + ["enclosedalphanumerics"] = { first = 0x02460, last = 0x024FF, description = "Enclosed Alphanumerics" }, + ["enclosedcjklettersandmonths"] = { first = 0x03200, last = 0x032FF, description = "Enclosed CJK Letters and Months" }, + ["ethiopic"] = { first = 0x01200, last = 0x0137F, description = "Ethiopic" }, + ["ethiopicextended"] = { first = 0x02D80, last = 0x02DDF, description = "Ethiopic Extended" }, + ["ethiopicsupplement"] = { first = 0x01380, last = 0x0139F, description = "Ethiopic Supplement" }, + ["generalpunctuation"] = { first = 0x02000, last = 0x0206F, description = "General Punctuation" }, + ["geometricshapes"] = { first = 0x025A0, last = 0x025FF, description = "Geometric Shapes" }, + ["georgian"] = { first = 0x010A0, last = 0x010FF, description = "Georgian" }, + ["georgiansupplement"] = { first = 0x02D00, last = 0x02D2F, description = "Georgian Supplement" }, + ["glagolitic"] = { first = 0x02C00, last = 0x02C5F, description = "Glagolitic" }, + ["gothic"] = { first = 0x10330, last = 0x1034F, description = "Gothic" }, + ["greekandcoptic"] = { first = 0x00370, last = 0x003FF, description = "Greek and Coptic" }, + ["greekextended"] = { first = 0x01F00, last = 0x01FFF, description = "Greek Extended" }, + ["gujarati"] = { first = 0x00A80, last = 0x00AFF, description = "Gujarati" }, + ["gurmukhi"] = { first = 0x00A00, last = 0x00A7F, description = "Gurmukhi" }, + ["halfwidthandfullwidthforms"] = { first = 0x0FF00, last = 0x0FFEF, description = "Halfwidth and Fullwidth Forms" }, + ["hangulcompatibilityjamo"] = { first = 0x03130, last = 0x0318F, description = "Hangul Compatibility Jamo" }, + ["hanguljamo"] = { first = 0x01100, last = 0x011FF, description = "Hangul Jamo" }, + ["hangulsyllables"] = { first = 0x0AC00, last = 0x0D7AF, description = "Hangul Syllables" }, + ["hanunoo"] = { first = 0x01720, last = 0x0173F, description = "Hanunoo" }, + ["hebrew"] = { first = 0x00590, last = 0x005FF, description = "Hebrew" }, + ["highprivateusesurrogates"] = { first = 0x0DB80, last = 0x0DBFF, description = "High Private Use Surrogates" }, + ["highsurrogates"] = { first = 0x0D800, last = 0x0DB7F, description = "High Surrogates" }, + ["hiragana"] = { first = 0x03040, last = 0x0309F, description = "Hiragana" }, + ["ideographicdescriptioncharacters"] = { first = 0x02FF0, last = 0x02FFF, description = "Ideographic Description Characters" }, + ["ipaextensions"] = { first = 0x00250, last = 0x002AF, description = "IPA Extensions" }, + ["kanbun"] = { first = 0x03190, last = 0x0319F, description = "Kanbun" }, + ["kangxiradicals"] = { first = 0x02F00, last = 0x02FDF, description = "Kangxi Radicals" }, + ["kannada"] = { first = 0x00C80, last = 0x00CFF, description = "Kannada" }, + ["katakana"] = { first = 0x030A0, last = 0x030FF, description = "Katakana" }, + ["katakanaphoneticextensions"] = { first = 0x031F0, last = 0x031FF, description = "Katakana Phonetic Extensions" }, + ["kayahli"] = { first = 0x0A900, last = 0x0A92F, description = "Kayah Li" }, + ["kharoshthi"] = { first = 0x10A00, last = 0x10A5F, description = "Kharoshthi" }, + ["khmer"] = { first = 0x01780, last = 0x017FF, description = "Khmer" }, + ["khmersymbols"] = { first = 0x019E0, last = 0x019FF, description = "Khmer Symbols" }, + ["lao"] = { first = 0x00E80, last = 0x00EFF, description = "Lao" }, + ["latinextendeda"] = { first = 0x00100, last = 0x0017F, description = "Latin Extended-A" }, + ["latinextendedadditional"] = { first = 0x01E00, last = 0x01EFF, description = "Latin Extended Additional" }, + ["latinextendedb"] = { first = 0x00180, last = 0x0024F, description = "Latin Extended-B" }, + ["latinextendedc"] = { first = 0x02C60, last = 0x02C7F, description = "Latin Extended-C" }, + ["latinextendedd"] = { first = 0x0A720, last = 0x0A7FF, description = "Latin Extended-D" }, + ["latinsupplement"] = { first = 0x00080, last = 0x000FF, description = "Latin-1 Supplement" }, + ["lepcha"] = { first = 0x01C00, last = 0x01C4F, description = "Lepcha" }, + ["letterlikesymbols"] = { first = 0x02100, last = 0x0214F, description = "Letterlike Symbols" }, + ["limbu"] = { first = 0x01900, last = 0x0194F, description = "Limbu" }, + ["linearbideograms"] = { first = 0x10080, last = 0x100FF, description = "Linear B Ideograms" }, + ["linearbsyllabary"] = { first = 0x10000, last = 0x1007F, description = "Linear B Syllabary" }, + ["lowsurrogates"] = { first = 0x0DC00, last = 0x0DFFF, description = "Low Surrogates" }, + ["lycian"] = { first = 0x10280, last = 0x1029F, description = "Lycian" }, + ["lydian"] = { first = 0x10920, last = 0x1093F, description = "Lydian" }, + ["mahjongtiles"] = { first = 0x1F000, last = 0x1F02F, description = "Mahjong Tiles" }, + ["malayalam"] = { first = 0x00D00, last = 0x00D7F, description = "Malayalam" }, + ["mathematicalalphanumericsymbols"] = { first = 0x1D400, last = 0x1D7FF, description = "Mathematical Alphanumeric Symbols" }, + ["mathematicaloperators"] = { first = 0x02200, last = 0x022FF, description = "Mathematical Operators" }, + ["miscellaneousmathematicalsymbolsa"] = { first = 0x027C0, last = 0x027EF, description = "Miscellaneous Mathematical Symbols-A" }, + ["miscellaneousmathematicalsymbolsb"] = { first = 0x02980, last = 0x029FF, description = "Miscellaneous Mathematical Symbols-B" }, + ["miscellaneoussymbols"] = { first = 0x02600, last = 0x026FF, description = "Miscellaneous Symbols" }, + ["miscellaneoussymbolsandarrows"] = { first = 0x02B00, last = 0x02BFF, description = "Miscellaneous Symbols and Arrows" }, + ["miscellaneoustechnical"] = { first = 0x02300, last = 0x023FF, description = "Miscellaneous Technical" }, + ["modifiertoneletters"] = { first = 0x0A700, last = 0x0A71F, description = "Modifier Tone Letters" }, + ["mongolian"] = { first = 0x01800, last = 0x018AF, description = "Mongolian" }, + ["musicalsymbols"] = { first = 0x1D100, last = 0x1D1FF, description = "Musical Symbols" }, + ["myanmar"] = { first = 0x01000, last = 0x0109F, description = "Myanmar" }, + ["newtailue"] = { first = 0x01980, last = 0x019DF, description = "New Tai Lue" }, + ["nko"] = { first = 0x007C0, last = 0x007FF, description = "NKo" }, + ["numberforms"] = { first = 0x02150, last = 0x0218F, description = "Number Forms" }, + ["ogham"] = { first = 0x01680, last = 0x0169F, description = "Ogham" }, + ["olchiki"] = { first = 0x01C50, last = 0x01C7F, description = "Ol Chiki" }, + ["olditalic"] = { first = 0x10300, last = 0x1032F, description = "Old Italic" }, + ["oldpersian"] = { first = 0x103A0, last = 0x103DF, description = "Old Persian" }, + ["opticalcharacterrecognition"] = { first = 0x02440, last = 0x0245F, description = "Optical Character Recognition" }, + ["oriya"] = { first = 0x00B00, last = 0x00B7F, description = "Oriya" }, + ["osmanya"] = { first = 0x10480, last = 0x104AF, description = "Osmanya" }, + ["phagspa"] = { first = 0x0A840, last = 0x0A87F, description = "Phags-pa" }, + ["phaistosdisc"] = { first = 0x101D0, last = 0x101FF, description = "Phaistos Disc" }, + ["phoenician"] = { first = 0x10900, last = 0x1091F, description = "Phoenician" }, + ["phoneticextensions"] = { first = 0x01D00, last = 0x01D7F, description = "Phonetic Extensions" }, + ["phoneticextensionssupplement"] = { first = 0x01D80, last = 0x01DBF, description = "Phonetic Extensions Supplement" }, + ["privateusearea"] = { first = 0x0E000, last = 0x0F8FF, description = "Private Use Area" }, + ["rejang"] = { first = 0x0A930, last = 0x0A95F, description = "Rejang" }, + ["runic"] = { first = 0x016A0, last = 0x016FF, description = "Runic" }, + ["saurashtra"] = { first = 0x0A880, last = 0x0A8DF, description = "Saurashtra" }, + ["shavian"] = { first = 0x10450, last = 0x1047F, description = "Shavian" }, + ["sinhala"] = { first = 0x00D80, last = 0x00DFF, description = "Sinhala" }, + ["smallformvariants"] = { first = 0x0FE50, last = 0x0FE6F, description = "Small Form Variants" }, + ["spacingmodifierletters"] = { first = 0x002B0, last = 0x002FF, description = "Spacing Modifier Letters" }, + ["specials"] = { first = 0x0FFF0, last = 0x0FFFF, description = "Specials" }, + ["sundanese"] = { first = 0x01B80, last = 0x01BBF, description = "Sundanese" }, + ["superscriptsandsubscripts"] = { first = 0x02070, last = 0x0209F, description = "Superscripts and Subscripts" }, + ["supplementalarrowsa"] = { first = 0x027F0, last = 0x027FF, description = "Supplemental Arrows-A" }, + ["supplementalarrowsb"] = { first = 0x02900, last = 0x0297F, description = "Supplemental Arrows-B" }, + ["supplementalmathematicaloperators"] = { first = 0x02A00, last = 0x02AFF, description = "Supplemental Mathematical Operators" }, + ["supplementalpunctuation"] = { first = 0x02E00, last = 0x02E7F, description = "Supplemental Punctuation" }, + ["supplementaryprivateuseareaa"] = { first = 0xF0000, last = 0xFFFFF, description = "Supplementary Private Use Area-A" }, + ["supplementaryprivateuseareab"] = { first = 0x100000,last = 0x10FFFF,description = "Supplementary Private Use Area-B" }, + ["sylotinagri"] = { first = 0x0A800, last = 0x0A82F, description = "Syloti Nagri" }, + ["syriac"] = { first = 0x00700, last = 0x0074F, description = "Syriac" }, + ["tagalog"] = { first = 0x01700, last = 0x0171F, description = "Tagalog" }, + ["tagbanwa"] = { first = 0x01760, last = 0x0177F, description = "Tagbanwa" }, + ["tags"] = { first = 0xE0000, last = 0xE007F, description = "Tags" }, + ["taile"] = { first = 0x01950, last = 0x0197F, description = "Tai Le" }, + ["taixuanjingsymbols"] = { first = 0x1D300, last = 0x1D35F, description = "Tai Xuan Jing Symbols" }, + ["tamil"] = { first = 0x00B80, last = 0x00BFF, description = "Tamil" }, + ["telugu"] = { first = 0x00C00, last = 0x00C7F, description = "Telugu" }, + ["thaana"] = { first = 0x00780, last = 0x007BF, description = "Thaana" }, + ["thai"] = { first = 0x00E00, last = 0x00E7F, description = "Thai" }, + ["tibetan"] = { first = 0x00F00, last = 0x00FFF, description = "Tibetan" }, + ["tifinagh"] = { first = 0x02D30, last = 0x02D7F, description = "Tifinagh" }, + ["ugaritic"] = { first = 0x10380, last = 0x1039F, description = "Ugaritic" }, + ["unifiedcanadianaboriginalsyllabics"] = { first = 0x01400, last = 0x0167F, description = "Unified Canadian Aboriginal Syllabics" }, + ["vai"] = { first = 0x0A500, last = 0x0A63F, description = "Vai" }, + ["variationselectors"] = { first = 0x0FE00, last = 0x0FE0F, description = "Variation Selectors" }, + ["variationselectorssupplement"] = { first = 0xE0100, last = 0xE01EF, description = "Variation Selectors Supplement" }, + ["verticalforms"] = { first = 0x0FE10, last = 0x0FE1F, description = "Vertical Forms" }, + ["yijinghexagramsymbols"] = { first = 0x04DC0, last = 0x04DFF, description = "Yijing Hexagram Symbols" }, + ["yiradicals"] = { first = 0x0A490, last = 0x0A4CF, description = "Yi Radicals" }, + ["yisyllables"] = { first = 0x0A000, last = 0x0A48F, description = "Yi Syllables" }, } -setmetatable(characters.blocks, { __index = function(t,k) +characters.blocks = blocks + +setmetatable(blocks, { __index = function(t,k) return k and rawget(t,lower(gsub(k,"[^a-zA-Z]",""))) end } ) function characters.getrange(name) -- used in font fallback definitions (name or range) - local range = characters.blocks[name] + local range = blocks[name] if range then - return range[1], range[2], range[3] + return range.first, range.last, range.description end name = gsub(name,'"',"0x") -- goodie: tex hex notation local start, stop = match(name,"^(.-)[%-%:](.-)$") @@ -506,11 +508,26 @@ function characters.define(tobelettered, tobeactivated) -- catcodetables local contextname = chr.contextname if contextname then local category = chr.category +--~ if is_character[category] then +--~ if chr.unicodeslot < 128 then +--~ texprint(ctxcatcodes,format("\\chardef\\%s=%s",contextname,u)) +--~ else +--~ texprint(ctxcatcodes,format("\\let\\%s=%s",contextname,utfchar(u))) +--~ end +--~ elseif is_command[category] then +--~ texsprint("{\\catcode",u,"=13\\unexpanded\\gdef ",utfchar(u),"{\\"..contextname,"}}") -- no texprint +--~ a = a + 1 +--~ activated[a] = u +--~ end if is_character[category] then if chr.unicodeslot < 128 then - texprint(ctxcatcodes,format("\\chardef\\%s=%s",contextname,u)) + if is_letter[category] then + texprint(ctxcatcodes,format("\\def\\%s{%s}",contextname,utfchar(u))) + else + texprint(ctxcatcodes,format("\\chardef\\%s=%s",contextname,u)) + end else - texprint(ctxcatcodes,format("\\let\\%s=%s",contextname,utfchar(u))) + texprint(ctxcatcodes,format("\\def\\%s{%s}",contextname,utfchar(u))) end elseif is_command[category] then texsprint("{\\catcode",u,"=13\\unexpanded\\gdef ",utfchar(u),"{\\"..contextname,"}}") -- no texprint @@ -522,9 +539,9 @@ function characters.define(tobelettered, tobeactivated) -- catcodetables end if tobelettered then -- shared - local saved = tex.catcodetable - for i=1,#tobelettered do - tex.catcodetable = tobelettered[i] + local saved = tex.catcodetable + for i=1,#tobelettered do + tex.catcodetable = tobelettered[i] if trace_defining then report_defining("defining letters (global, shared)") end @@ -541,8 +558,8 @@ function characters.define(tobelettered, tobeactivated) -- catcodetables end texsetcatcode(0x200C,11) -- non-joiner texsetcatcode(0x200D,11) -- joiner - end - tex.catcodetable = saved + end + tex.catcodetable = saved end local nofactivated = #tobeactivated diff --git a/tex/context/base/char-tex.lua b/tex/context/base/char-tex.lua index 36eb7f889..e6d6c41e0 100644 --- a/tex/context/base/char-tex.lua +++ b/tex/context/base/char-tex.lua @@ -22,7 +22,7 @@ local accentmapping = allocate { ['"'] = { [""] = "¨", A = "Ä", a = "ä", E = "Ë", e = "ë", - I = "Ï", i = "ï", + I = "Ï", i = "ï", ["ı"] = "ï", O = "Ö", o = "ö", U = "Ü", u = "ü", Y = "Ÿ", y = "ÿ", @@ -31,7 +31,7 @@ local accentmapping = allocate { A = "Á", a = "á", C = "Ć", c = "ć", E = "É", e = "é", - I = "Í", i = "í", + I = "Í", i = "í", ["ı"] = "í", L = "Ĺ", l = "ĺ", N = "Ń", n = "ń", O = "Ó", o = "ó", @@ -45,13 +45,13 @@ local accentmapping = allocate { C = "Ċ", c = "ċ", E = "Ė", e = "ė", G = "Ġ", g = "ġ", - I = "İ", i = "i", + I = "İ", i = "i", ["ı"] = "i", Z = "Ż", z = "ż", }, ["="] = { [""] = "¯", A = "Ā", a = "ā", E = "Ē", e = "ē", - I = "Ī", i = "ī", + I = "Ī", i = "ī", ["ı"] = "ī", O = "Ō", o = "ō", U = "Ū", u = "ū", }, @@ -65,7 +65,7 @@ local accentmapping = allocate { E = "Ê", e = "ê", G = "Ĝ", g = "ĝ", H = "Ĥ", h = "ĥ", - I = "Î", i = "î", + I = "Î", i = "î", ["ı"] = "î", J = "Ĵ", j = "ĵ", O = "Ô", o = "ô", S = "Ŝ", s = "ŝ", @@ -76,7 +76,7 @@ local accentmapping = allocate { ["`"] = { [""] = "`", A = "À", a = "à", E = "È", e = "è", - I = "Ì", i = "ì", + I = "Ì", i = "ì", ["ı"] = "ì", O = "Ò", o = "ò", U = "Ù", u = "ù", Y = "Ỳ", y = "ỳ", @@ -104,7 +104,7 @@ local accentmapping = allocate { A = "Ă", a = "ă", E = "Ĕ", e = "ĕ", G = "Ğ", g = "ğ", - I = "Ĭ", i = "ĭ", + I = "Ĭ", i = "ĭ", ["ı"] = "ĭ", O = "Ŏ", o = "ŏ", U = "Ŭ", u = "ŭ", }, @@ -121,7 +121,7 @@ local accentmapping = allocate { }, ["~"] = { [""] = "˜", A = "Ã", a = "ã", - I = "Ĩ", i = "ĩ", + I = "Ĩ", i = "ĩ", ["ı"] = "ĩ", N = "Ñ", n = "ñ", O = "Õ", o = "õ", U = "Ũ", u = "ũ", diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index dce53bc21..d6f583309 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.02.16 17:05} +\newcontextversion{2011.02.18 17:17} %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 795ea147b..dc1b85f9b 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.02.16 17:05} +\newcontextversion{2011.02.18 17:17} %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 ac46fe3d9..7662f832a 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.02.16 17:05} +\edef\contextversion{2011.02.18 17:17} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index f33d4366c..90c8debbe 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.02.16 17:05} +\edef\contextversion{2011.02.18 17:17} %D For those who want to use this: diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv index 32ae27531..e2ae88f60 100644 --- a/tex/context/base/core-con.mkiv +++ b/tex/context/base/core-con.mkiv @@ -676,6 +676,7 @@ \defineconversion [AK] [\smallcappedcharacters] \defineconversion [KA] [\smallcappedcharacters] +\defineconversion [\v!number] [\numbers] \defineconversion [\v!numbers] [\numbers] \defineconversion [\v!Numbers] [\Numbers] \defineconversion [\v!mediaeval] [\mediaeval] diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 3b97181cf..7d4e102fe 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -983,8 +983,8 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo : local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - filename = fl[3] - result[#result+1] = filename + filename = fl[3] -- not local? + result[#result+1] = resolvers.resolve(filename) done = true end else @@ -1335,7 +1335,7 @@ end --~ local filelist = collect_files(wantedfiles) --~ local fl = filelist and filelist[1] --~ if fl then ---~ return { fl[3] } -- filename +--~ return { resolvers.resolve(fl[3]) } -- filename --~ end --~ end diff --git a/tex/context/base/enco-ini.mkiv b/tex/context/base/enco-ini.mkiv index 737a8b6f1..491084b8c 100644 --- a/tex/context/base/enco-ini.mkiv +++ b/tex/context/base/enco-ini.mkiv @@ -54,7 +54,11 @@ \dodefineaccent{#1}{#2}{#3}} \def\dohandleaccent#1#2% - {\csname\??ac\string#1\string#2\empty\endcsname} + {\ifcsname\??ac\string#1#2\empty\endcsname + \csname\??ac\string#1#2\empty\endcsname + \else\ifcsname\??ac\string#1\string#2\empty\endcsname + \csname\??ac\string#1\string#2\empty\endcsname + \fi\fi} \unexpanded\def\definecharacter#1 #2 % {\doifnumberelse{\string#2} @@ -71,11 +75,6 @@ \newtoks \everylowercase \newtoks \everysanitize -%D Some saved meanings (not really needed): - -\let\textaccent \accent -\let\normaltextaccent\accent - %D Accent handling (try to avoid this): \newbox\accenttestbox % no longer global so we could use \scratchbox @@ -151,83 +150,48 @@ % from enco-com: -\def\AA{\Aring} -\def\aa{\aring} -\def\AE{\AEligature} -\def\ae{\aeligature} -\def\CC{\Ccedilla} -\def\cc{\ccedilla} -\def \L{\Lstroke} -\def \l{\lstroke} -\def \O{\Ostroke} -\def \o{\ostroke} -\def\OE{\OEligature} -\def\oe{\oeligature} -\def\SZ{\Ssharp} -\def\sz{\ssharp} -\def\SS{\ssharp} -\def\IJ{\IJligature} -\def\ij{\ijligature} -\def \i{\dotlessi} -\def \j{\dotlessj} +\def\AA{Å} \def\aa{å} +\def\AE{Æ} \def\ae{æ} +\def\CC{Ç} \def\cc{ç} +\def \L{Ł} \def \l{ł} +\def \O{Ø} \def \o{ø} +\def\OE{Œ} \def\oe{œ} +\def\SZ{SS} \def\sz{ß} \def\SS{ß} +\def\IJ{IJ} \def\ij{ij} % from enco-def: -\def\dotlessI {I} -\def\dotlessJ {J} - -\def\Ssharp {SS} - -\def\eszett {\ssharp} -\def\Eszett {\Ssharp} - -\def\lslash {\lstroke} -\def\Lslash {\Lstroke} -\def\dslash {\dstroke} -\def\Dslash {\Dstroke} -\def\oslash {\ostroke} -\def\Oslash {\Ostroke} -\def\dcroat {\dstroke} -\def\Dcroat {\Dstroke} - -\def\Kcedilla {\Kcommaaccent} -\def\kcedilla {\kcommaaccent} -\def\Lcedilla {\Lcommaaccent} -\def\lcedilla {\lcommaaccent} -\def\Ncedilla {\Ncommaaccent} -\def\ncedilla {\ncommaaccent} -\def\Rcedilla {\Rcommaaccent} -\def\rcedilla {\rcommaaccent} - -\def\S {\sectionmark} -\def\P {\paragraphmark} - -\def\aumlaut {\adiaeresis} -\def\eumlaut {\ediaeresis} -\def\iumlaut {\idiaeresis} -\def\oumlaut {\odiaeresis} -\def\uumlaut {\udiaeresis} -\def\Aumlaut {\Adiaeresis} -\def\Eumlaut {\Ediaeresis} -\def\Iumlaut {\Idiaeresis} -\def\Oumlaut {\Odiaeresis} -\def\Uumlaut {\Udiaeresis} - -% for latex users - -\def\textS {\sectionmark} -\def\textP {\paragraphmark} - -% for old times sake - -\def\textflorin{\fhook} -\def\florin {\textflorin} -\def\dollar {\textdollar} -\def\pound {\textsterling} -\def\sterling {\textsterling} -\def\promille {\perthousand} -\def\permille {\perthousand} +\def\i{ı} +\def\j{ȷ} + +\def\S{§} \def\textS {§} % obsolete (surfaced in bibliographic files) +\def\P{¶} \def\textP {¶} % obsolete (surfaced in bibliographic files) + +\def\eszett {ß} \def\Eszett {SS} \def\Ssharp{SS} +\def\lslash {ł} \def\Lslash {Ł} +\def\dslash {đ} \def\Dslash {Đ} +\def\oslash {ø} \def\Oslash {Ø} +\def\dcroat {đ} \def\Dcroat {Đ} +\def\kcedilla{ķ} \def\Kcedilla{Ķ} +\def\lcedilla{ļ} \def\Lcedilla{Ļ} +\def\ncedilla{ņ} \def\Ncedilla{Ņ} +\def\rcedilla{ŗ} \def\Rcedilla{Ŗ} +\def\aumlaut {ä} \def\Aumlaut {Ä} +\def\eumlaut {ë} \def\Eumlaut {Ë} +\def\iumlaut {ï} \def\Iumlaut {Ï} +\def\oumlaut {ö} \def\Oumlaut {Ö} +\def\uumlaut {ü} \def\Uumlaut {Ü} + +% for old times sake (obsolete) + +\def\textflorin{ƒ} \def\florin {ƒ} +\def\pound {£} \def\sterling{£} +\def\promille {‰} \def\permille{‰} + +% tex specific (obsolete) + \def\procent {\percent} +\def\dollar {\textdollar} \def\permine {\fakepermine} % some more diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index 19429c5b5..83b395f2e 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -525,10 +525,10 @@ local function locate(request) -- name, format, cache local askedconversion = request.conversion local askedresolution = request.resolution if askedformat ~= "" then + askedformat = lower(askedformat) if trace_figures then - report_inclusion("strategy: forced format") + report_inclusion("strategy: forced format %s",askedformat) end - askedformat = lower(askedformat) local format = figures.suffixes[askedformat] if not format then local figurepatterns = figures.patterns @@ -541,7 +541,7 @@ local function locate(request) -- name, format, cache end end if format then - local foundname = figures.exists(askedname,format,resolve_too) -- not askedformat + local foundname, quitscanning = figures.exists(askedname,format,resolve_too) -- not askedformat if foundname then return register(askedname, { askedname = askedname, @@ -552,7 +552,11 @@ local function locate(request) -- name, format, cache conversion = askedconversion, resolution = askedresolution, }) + elseif quitscanning then + return register(askedname) end + elseif trace_figures then + report_inclusion("strategy: unknown format %s",askedformat) end if askedpath then -- path and type given, todo: strip pieces of path @@ -742,23 +746,28 @@ function figures.identify(data) end return data end + function figures.exists(askedname,format,resolve) return (existers[format] or existers.generic)(askedname,resolve) end + function figures.check(data) data = data or figures.current() local dr, du, ds = data.request, data.used, data.status return (checkers[ds.format] or checkers.generic)(data) end + function figures.include(data) data = data or figures.current() local dr, du, ds = data.request, data.used, data.status return (includers[ds.format] or includers.generic)(data) end + function figures.scale(data) -- will become lua code context.doscalefigure() return data end + function figures.done(data) figures.nofprocessed = figures.nofprocessed + 1 data = data or figures.current() @@ -960,6 +969,7 @@ function existers.mps(askedname) return existers.generic(askedname) end end + function checkers.mps(data) local mprun, mpnum = internal(data.used.fullname) if mpnum then @@ -968,6 +978,7 @@ function checkers.mps(data) return checkers.nongeneric(data,function() context.docheckfiguremps(data.used.fullname) end) end end + includers.mps = includers.nongeneric -- -- -- tex -- -- -- @@ -976,25 +987,35 @@ function existers.tex(askedname) askedname = resolvers.findfile(askedname) return (askedname ~= "" and askedname) or false end + function checkers.tex(data) return checkers.nongeneric(data,function() context.docheckfiguretex(data.used.fullname) end) end + includers.tex = includers.nongeneric -- -- -- buffer -- -- -- -existers.buffer = existers.tex +function existers.buffer(askedname) + local name = file.nameonly(askedname) + local okay = buffers.exists(name) + return okay and name, true -- always quit scanning +end + function checkers.buffer(data) return checkers.nongeneric(data,function() context.docheckfigurebuffer(file.nameonly(data.used.fullname)) end) end + includers.buffers = includers.nongeneric -- -- -- cld -- -- -- existers.cld = existers.tex + function checkers.cld(data) return checkers.nongeneric(data,function() context.docheckfigurecld(data.used.fullname) end) end + includers.cld = includers.nongeneric -- -- -- converters -- -- -- diff --git a/tex/context/base/l-math.lua b/tex/context/base/l-math.lua index fc8db4721..48089957f 100644 --- a/tex/context/base/l-math.lua +++ b/tex/context/base/l-math.lua @@ -9,33 +9,26 @@ if not modules then modules = { } end modules ['l-math'] = { local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan if not math.round then - function math.round(x) - return floor(x + 0.5) - end + function math.round(x) return floor(x + 0.5) end end if not math.div then - function math.div(n,m) - return floor(n/m) - end + function math.div(n,m) return floor(n/m) end end if not math.mod then - function math.mod(n,m) - return n % m - end + function math.mod(n,m) return n % m end end local pipi = 2*math.pi/360 -function math.sind(d) - return sin(d*pipi) +if not math.sind then + function math.sind(d) return sin(d*pipi) end + function math.cosd(d) return cos(d*pipi) end + function math.tand(d) return tan(d*pipi) end end -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) +if not math.odd then + function math.odd (n) return n % 2 == 0 end + function math.even(n) return n % 2 ~= 0 end end diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua index 014763b0b..73ffbae48 100644 --- a/tex/context/base/l-unicode.lua +++ b/tex/context/base/l-unicode.lua @@ -357,3 +357,27 @@ local utftype = lpeg.patterns.utftype function unicode.filetype(data) return data and lpegmatch(utftype,data) or "unknown" end + +--~ local utfchr = { } -- 60K -> 2.638 M extra mem but currently not called that often (on latin) +--~ +--~ setmetatable(utfchr, { __index = function(t,k) local v = utfchar(k) t[k] = v return v end } ) +--~ +--~ collectgarbage("collect") +--~ local u = collectgarbage("count")*1024 +--~ local t = os.clock() +--~ for i=1,1000 do +--~ for i=1,600 do +--~ local a = utfchr[i] +--~ end +--~ end +--~ print(os.clock()-t,collectgarbage("count")*1024-u) + +--~ collectgarbage("collect") +--~ local t = os.clock() +--~ for i=1,1000 do +--~ for i=1,600 do +--~ local a = utfchar(i) +--~ end +--~ end +--~ print(os.clock()-t,collectgarbage("count")*1024-u) + diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index c86c522cb..473a18e08 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -108,22 +108,6 @@ \expandafter\noexpand\csname doset#2attributes\endcsname \expandafter\noexpand\csname #2parameterhash\endcsname}} -% \unexpanded\def\doinstalldefinehandler#1#2#3#4#5#6#7% -% {\unexpanded\def#2{\dotripleempty#5}% -% \newtoks#6% -% \newtoks#7% -% \def#5[##1][##2][##3]% [child][parent][settings] -% {\edef#4{##1}% [child][settings] -% \the#6% predefine [child] -% \ifsecondargument -% \doifassignmentelse{##2} -% {\getparameters[#1#4][\s!parent=#3,##2]} -% {\getparameters[#1#4][\s!parent=#1##2,##3]}% -% \else -% \getparameters[#1#4][\s!parent=#3]% -% \fi -% \the#7}} - \unexpanded\def\doinstalldefinehandler#1#2#3#4#5#6#7% {\unexpanded\def#2{\dotripleempty#5}% \newtoks#6% diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index aec2b075a..ffdc666e7 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -580,6 +580,7 @@ \setinterfaceconstant{bottomstate}{untenstatus} \setinterfaceconstant{cache}{cache} \setinterfaceconstant{calculate}{berechnen} +\setinterfaceconstant{category}{category} \setinterfaceconstant{ccommand}{cbefehl} \setinterfaceconstant{click}{klick} \setinterfaceconstant{clickin}{klickin} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 69d1edb84..886138386 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -7053,6 +7053,10 @@ return { ["pe"]="محاسبه", ["ro"]="calculeaza", }, + ["category"]={ + ["en"]="category", + ["nl"]="categorie", + }, ["ccommand"]={ ["cs"]="cprikaz", ["de"]="cbefehl", diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index 608cd6706..3e21fb078 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -580,6 +580,7 @@ \setinterfaceconstant{bottomstate}{bottomstate} \setinterfaceconstant{cache}{cache} \setinterfaceconstant{calculate}{calculate} +\setinterfaceconstant{category}{category} \setinterfaceconstant{ccommand}{ccommand} \setinterfaceconstant{click}{click} \setinterfaceconstant{clickin}{clickin} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index 283f66df6..509d7c8f8 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -580,6 +580,7 @@ \setinterfaceconstant{bottomstate}{etatinf} \setinterfaceconstant{cache}{cache} \setinterfaceconstant{calculate}{calculer} +\setinterfaceconstant{category}{category} \setinterfaceconstant{ccommand}{ccommande} \setinterfaceconstant{click}{clic} \setinterfaceconstant{clickin}{clicinterieur} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 6dbedaa41..b8555d9f6 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -580,6 +580,7 @@ \setinterfaceconstant{bottomstate}{statofondo} \setinterfaceconstant{cache}{cache} \setinterfaceconstant{calculate}{calcola} +\setinterfaceconstant{category}{category} \setinterfaceconstant{ccommand}{ccomando} \setinterfaceconstant{click}{click} \setinterfaceconstant{clickin}{clickdentro} diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index 21778c3a4..659f99982 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -580,6 +580,7 @@ \setinterfaceconstant{bottomstate}{onderstatus} \setinterfaceconstant{cache}{cache} \setinterfaceconstant{calculate}{bereken} +\setinterfaceconstant{category}{categorie} \setinterfaceconstant{ccommand}{ccommando} \setinterfaceconstant{click}{klik} \setinterfaceconstant{clickin}{klikin} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 862fac2c2..b5b3d7ec2 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -580,6 +580,7 @@ \setinterfaceconstant{bottomstate}{وضعیتپایین} \setinterfaceconstant{cache}{میانگیر} \setinterfaceconstant{calculate}{محاسبه} +\setinterfaceconstant{category}{category} \setinterfaceconstant{ccommand}{فرمان} \setinterfaceconstant{click}{فشردن} \setinterfaceconstant{clickin}{فشردنداخل} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index 8e04db7c0..fdbc06ad8 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -580,6 +580,7 @@ \setinterfaceconstant{bottomstate}{starejos} \setinterfaceconstant{cache}{cache} \setinterfaceconstant{calculate}{calculeaza} +\setinterfaceconstant{category}{category} \setinterfaceconstant{ccommand}{comandac} \setinterfaceconstant{click}{click} \setinterfaceconstant{clickin}{clickintru} diff --git a/tex/context/base/node-pro.lua b/tex/context/base/node-pro.lua index b316f2fe3..a901616b5 100644 --- a/tex/context/base/node-pro.lua +++ b/tex/context/base/node-pro.lua @@ -90,30 +90,43 @@ function processors.pre_linebreak_filter(head,groupcode,size,packtype,direction) return true end +local enabled = true + function processors.hpack_filter(head,groupcode,size,packtype,direction) - local first, found = first_glyph(head) - if found then - if trace_callbacks then - local before = nodes.count(head,true) - local head, done = actions(head,groupcode,size,packtype,direction) - local after = nodes.count(head,true) - if done then - tracer("hpack","changed",head,groupcode,before,after,true) + if enabled then + local first, found = first_glyph(head) + if found then + if trace_callbacks then + local before = nodes.count(head,true) + local head, done = actions(head,groupcode,size,packtype,direction) + local after = nodes.count(head,true) + if done then + tracer("hpack","changed",head,groupcode,before,after,true) + else + tracer("hpack","unchanged",head,groupcode,before,after,true) + end + return (done and head) or true else - tracer("hpack","unchanged",head,groupcode,before,after,true) + local head, done = actions(head,groupcode,size,packtype,direction) + return (done and head) or true end - return (done and head) or true - else - local head, done = actions(head,groupcode,size,packtype,direction) - return (done and head) or true + elseif trace_callbacks then + local n = nodes.count(head,false) + tracer("hpack","no chars",head,groupcode,n,n) end - elseif trace_callbacks then - local n = nodes.count(head,false) - tracer("hpack","no chars",head,groupcode,n,n) end return true end +local hpack = node.hpack + +function nodes.fasthpack(...) -- todo: pass explicit arguments + enabled = false + local hp = hpack(...) + enabled = true + return hp +end + callbacks.register('pre_linebreak_filter', processors.pre_linebreak_filter,"all kind of horizontal manipulations (before par break)") callbacks.register('hpack_filter' , processors.hpack_filter,"all kind of horizontal manipulations") @@ -123,6 +136,8 @@ local actions = tasks.actions("finalizers") -- head, where -- maybe some day a hash with valid groupcodes -- -- beware, much can pass twice, for instance vadjust passes two times +-- +-- something weird here .. group mvl when making a vbox function processors.post_linebreak_filter(head,groupcode) --~ local first, found = first_glyph(head) @@ -132,9 +147,9 @@ function processors.post_linebreak_filter(head,groupcode) local head, done = actions(head,groupcode) local after = nodes.count(head,true) if done then - tracer("finalizer","changed",head,groupcode,before,after,true) + tracer("post_linebreak","changed",head,groupcode,before,after,true) else - tracer("finalizer","unchanged",head,groupcode,before,after,true) + tracer("post_linebreak","unchanged",head,groupcode,before,after,true) end return (done and head) or true else @@ -143,7 +158,7 @@ function processors.post_linebreak_filter(head,groupcode) end --~ elseif trace_callbacks then --~ local n = nodes.count(head,false) ---~ tracer("finalizer","no chars",head,groupcode,n,n) +--~ tracer("post_linebreak","no chars",head,groupcode,n,n) --~ end --~ return true end diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua index 7f52f6f64..a56b80d82 100644 --- a/tex/context/base/node-res.lua +++ b/tex/context/base/node-res.lua @@ -126,19 +126,27 @@ function pool.kern(k) return n end -function pool.gluespec(width,stretch,shrink) +function pool.gluespec(width,stretch,shrink,stretch_order,shrink_order) local s = copy_node(glue_spec) - s.width, s.stretch, s.shrink = width, stretch, shrink + if width then s.width = width end + if stretch then s.stretch = stretch end + if shrink then s.shrink = shrink end + if stretch_order then s.stretch_order = stretch_order end + if shrink_order then s.shrink_order = shrink_order end return s end -local function someskip(skip,width,stretch,shrink) +local function someskip(skip,width,stretch,shrink,stretch_order,shrink_order) local n = copy_node(skip) if not width then -- no spec - elseif tonumber(width) then + elseif width == false or tonumber(width) then local s = copy_node(glue_spec) - s.width, s.stretch, s.shrink = width, stretch, shrink + if width then s.width = width end + if stretch then s.stretch = stretch end + if shrink then s.shrink = shrink end + if stretch_order then s.stretch_order = stretch_order end + if shrink_order then s.shrink_order = shrink_order end n.spec = s else -- shared @@ -147,20 +155,49 @@ local function someskip(skip,width,stretch,shrink) return n end -function pool.glue(width,stretch,shrink) - return someskip(glue,width,stretch,shrink) +function pool.stretch(a,b) + local n = copy_node(glue) + local s = copy_node(glue_spec) + if b then + s.stretch = a + s.stretch_order = b + else + s.stretch = 1 + s.stretch_order = a or 1 + end + n.spec = s + return n +end + +function pool.shrink(a,b) + local n = copy_node(glue) + local s = copy_node(glue_spec) + if b then + s.shrink = a + s.shrink_order = b + else + s.shrink = 1 + s.shrink_order = a or 1 + end + n.spec = s + return n +end + + +function pool.glue(width,stretch,shrink,stretch_order,shrink_order) + return someskip(glue,width,stretch,shrink,stretch_order,shrink_order) end -function pool.leftskip(width,stretch,shrink) - return someskip(leftskip,width,stretch,shrink) +function pool.leftskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(leftskip,width,stretch,shrink,stretch_order,shrink_order) end -function pool.rightskip(width,stretch,shrink) - return someskip(rightskip,width,stretch,shrink) +function pool.rightskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(rightskip,width,stretch,shrink,stretch_order,shrink_order) end -function pool.lineskip(width,stretch,shrink) - return someskip(lineskip,width,stretch,shrink) +function pool.lineskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(lineskip,width,stretch,shrink,stretch_order,shrink_order) end function pool.baselineskip(width,stretch,shrink) diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua index ba081c884..96a9c7005 100644 --- a/tex/context/base/node-tra.lua +++ b/tex/context/base/node-tra.lua @@ -527,7 +527,7 @@ local function showsimplelist(h,depth,n) if not depth or n < depth then local id = h.id if id == hlist_code or id == vlist_code then - show_simple_list(h.list,depth,n+1) + showsimplelist(h.list,depth,n+1) end end h = h.next @@ -542,7 +542,7 @@ end --~ callback.register('buildpage_filter',nil) --~ \stopluacode -nodes.show_simple_list = function(h,depth) show_simple_list(h,depth,0) end +nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end function nodes.listtoutf(h,joiner) local joiner = (joiner ==true and utfchar(0x200C)) or joiner -- zwnj diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index b1aa05494..3dc6bd7a9 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -2716,6 +2716,26 @@ \localhsize\hsize \fi\fi} +\def\doftstartdepthcorrection + {\bgroup + \verticalstrut + % we need \nowhitespace in case of setups setting whitespace + % nb, not safe, text vs \vbox as next + \vskip-\struttotal + \nowhitespace} % na vskip ! new 20/05/2004, fails with next content being box (\scale{..}) + +\def\doftstopdepthcorrection + {\forgetall + \vskip-\struttotal + \verticalstrut + \egroup + \forgetall % brrr too often + \vskip-\lineheight + % will be an option, not default + % \setbaselinecorrections + % \donegbotbaselinecorrection + \verticalstrut} + \def\dododostartframedtext[#1][#2][#3]% #3 only passed to framed, not to framedtext {\doifsomething{#2}{\setvalue{\??kd#1\c!location}{#2}}% does not listen to #3 \setfalse\framedtextlocationnone @@ -2746,16 +2766,9 @@ \bgroup \let\\=\endgraf \framedtextparameter{#1}\c!inner % oud spul - \doifvalue{\??kd#1\c!depthcorrection}\v!on % new, inside box - {\bgroup - \verticalstrut - % we need \nowhitespace in case of setups setting whitespace - % nb, not safe, text vs \vbox as next - \vskip-\struttotal - \nowhitespace % na vskip ! new 20/05/2004, fails with next content being box (\scale{..}) - }% + \doifvalue{\??kd#1\c!depthcorrection}\v!on\doftstartdepthcorrection \doinhibitblank % \blank[\v!disable]% plaatst signal -\setupindenting[\framedtextparameter{#1}\c!indenting]% + \setupindenting[\framedtextparameter{#1}\c!indenting]% \doconvertfont{\framedtextparameter{#1}\c!style}\empty \def\dostopframedtext{\dodostopframedtext{#1}{#2}}} @@ -2766,17 +2779,7 @@ \def\dodostopframedtext#1#2% % no \baselinecorrection, see faq docs {\endgraf \removelastskip - \doifvalue{\??kd#1\c!depthcorrection}\v!on % local and global - {\forgetall - \vskip-\struttotal - \verticalstrut - \egroup - \forgetall % brrr too often - \vskip-\lineheight - % will be an option, not default - % \setbaselinecorrections - % \donegbotbaselinecorrection - \verticalstrut} + \doifvalue{\??kd#1\c!depthcorrection}\v!on\doftstopdepthcorrection \stopboxedcontent \stopcolor \ifconditional\framedtextlocationnone diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index bdd78e445..9588dbb3e 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -115,9 +115,6 @@ %D is no area, we use a zero distance in case there is no %D area. -\def\layoutdistance#1#2% - {\ifdim\zeropoint<#1\layoutparameter#2\else\zeropoint\fi} - %D The horizontal distances are: \newdimen \leftedgedistance @@ -134,23 +131,53 @@ %D We need to calculate the extra distances: +\newdimen\naturalmarginwidth +\newdimen\naturaledgewidth +\newdimen\naturalmargindistance +\newdimen\naturaledgedistance +\newdimen\naturalleftedgedistance +\newdimen\naturalrightedgedistance +\newdimen\naturalleftmargindistance +\newdimen\naturalrightmargindistance +\newdimen\naturaltopdistance +\newdimen\naturalheaderdistance +\newdimen\naturalfooterdistance +\newdimen\naturalbottomdistance + +\def\layoutdistance#1#2{\ifdim\zeropoint<#1#2\else\zeropoint\fi} + \def\setlayoutdimensions - {\global\marginwidth \layoutparameter\c!margin - \global\edgewidth \layoutparameter\c!edge - \global\margindistance \layoutparameter\c!margindistance - \global\edgedistance \layoutparameter\c!edgedistance - \global\leftedgedistance \layoutdistance \leftedgewidth \c!leftedgedistance - \global\rightedgedistance \layoutdistance \rightedgewidth \c!rightedgedistance - \global\leftmargindistance \layoutdistance \leftmarginwidth \c!leftmargindistance - \global\rightmargindistance\layoutdistance \rightmarginwidth \c!rightmargindistance - \global\topdistance \layoutdistance \topheight \c!topdistance - \global\headerdistance \layoutdistance \headerheight \c!headerdistance - \global\footerdistance \layoutdistance \footerheight \c!footerdistance - \global\bottomdistance \layoutdistance \bottomheight \c!bottomdistance} + {\global\naturalmarginwidth \layoutparameter\c!margin + \global\naturaledgewidth \layoutparameter\c!edge + \global\naturalmargindistance \layoutparameter\c!margindistance + \global\naturaledgedistance \layoutparameter\c!edgedistance + \global\naturalleftedgedistance \layoutparameter\c!leftedgedistance + \global\naturalrightedgedistance \layoutparameter\c!rightedgedistance + \global\naturalleftmargindistance \layoutparameter\c!leftmargindistance + \global\naturalrightmargindistance\layoutparameter\c!rightmargindistance + \global\naturaltopdistance \layoutparameter\c!topdistance + \global\naturalheaderdistance \layoutparameter\c!headerdistance + \global\naturalfooterdistance \layoutparameter\c!footerdistance + \global\naturalbottomdistance \layoutparameter\c!bottomdistance + % + \global\marginwidth \naturalmarginwidth + \global\edgewidth \naturaledgewidth + \global\margindistance \naturalmargindistance + \global\edgedistance \naturaledgedistance + % + \global\leftedgedistance \layoutdistance\leftedgewidth \naturalleftedgedistance + \global\rightedgedistance \layoutdistance\rightedgewidth \naturalrightedgedistance + \global\leftmargindistance \layoutdistance\leftmarginwidth \naturalleftmargindistance + \global\rightmargindistance \layoutdistance\rightmarginwidth\naturalrightmargindistance + \global\topdistance \layoutdistance\topheight \naturaltopdistance + \global\headerdistance \layoutdistance\headerheight \naturalheaderdistance + \global\footerdistance \layoutdistance\footerheight \naturalfooterdistance + \global\bottomdistance \layoutdistance\bottomheight \naturalbottomdistance + } \def\setlayoutdistances % local in \setreducedvsize - {\headerdistance\layoutdistance\headerheight\c!headerdistance - \footerdistance\layoutdistance\footerheight\c!footerdistance} + {\headerdistance\layoutdistance\headerheight\naturalheaderdistance + \footerdistance\layoutdistance\footerheight\naturalfooterdistance} % these are wrong in the running text, assumes some swapping, needs a cleanup diff --git a/tex/context/base/page-mar.mkiv b/tex/context/base/page-mar.mkiv index 1ae76f2cd..100729d20 100644 --- a/tex/context/base/page-mar.mkiv +++ b/tex/context/base/page-mar.mkiv @@ -411,14 +411,6 @@ %\hbox{\lower\strutdp\box\scratchbox}} % alas, wrong lapping, therefore useless \dopositionmarginbox\scratchbox} -% \def\domarginblockskip#1% -% {\hskip\margincontenthoffset -% \hskip\compensatedinnermakeupmargin\relax -% \doifelsenothing\margincontentdistance -% {\hskip\getvalue{\??im#1\c!distance}} -% {\hskip\margincontentdistance}% -% \relax} - \def\domarginblockskip#1% {\doifelsenothing\margincontentdistance {\hskip\dimexpr @@ -477,26 +469,6 @@ \edef\inmargintaglist{+,-,\v!low,\v!left,\v!right,\v!inner,\v!outer} -% the old one: -% -% \def\doinmargin[#1][#2][#3][#4][#5]% #6 #7 -% {\doifcommonelse{+,-,\v!laag}{#4} -% {\dodoinmargin[#1][#2][#3][#4][#5]} -% {\dodoinmargin[#1][#2][#3][][#4]}} -% -% an alternative: -% -% \letvalueempty{\??im\v!laag\c!offset} -% \letvalueempty{\??im +\c!offset} -% \letvalueempty{\??im -\c!offset} -% -% \def\doinmargin[#1][#2][#3][#4][#5]% #6 #7 -% {\doifnumberelse{#4} -% {\dodoinmargin[#1][#2][#3][#4][#5]} -% {\doifdefinedelse{\??im#4\c!offset} -% {\dodoinmargin[#1][#2][#3][#4][#5]} -% {\dodoinmargin[#1][#2][#3][][#4]}}} -% % the problem is that we need to keep downward compatibility % with respect to the first argument thing a reference or a % directive; the alternative is to force users to pass a diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index d0736dd5f..d9a85920f 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -108,14 +108,23 @@ \v!flushright=>\def\raggedbox{\doalignedline\v!left }, \v!center=>\def\raggedbox{\doalignedline\v!middle}]} +\newconditional \injectraggedpagesignals \settrue\injectraggedpagesignals + \def\dosetraggedcommand#1% {\normalexpanded{\noexpand\dodosetraggedcommand{#1}}} +\def\dosetpureraggedcommand#1% + {\setfalse\injectraggedpagesignals + \normalexpanded{\dodosetraggedcommand{#1}}% + \settrue\injectraggedpagesignals} + \newtoks\everyraggedcommand \def\raggedcommand{\the\everyraggedcommand} -\def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that! +% slow, we can do this in lua ... some day + +\unexpanded\def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that! {\everyraggedcommand\emptytoks \let\raggedtopcommand\empty \let\raggedbottomcommand\empty @@ -193,17 +202,29 @@ \setvalue{\@@ragged@@command\v!normal}% {\appendtoks\notragged\to\everyraggedcommand} -\setvalue{\@@ragged@@command\v!inner}% not yet perfect - {\signalrightpage % may interfere - \doifrightpageelse - {\getvalue{\@@ragged@@command\v!right}} - {\getvalue{\@@ragged@@command\v!left}}} - -\setvalue{\@@ragged@@command\v!outer}% not yet perfect - {\signalrightpage % may interfere - \doifrightpageelse - {\getvalue{\@@ragged@@command\v!left}} - {\getvalue{\@@ragged@@command\v!right}}} +\setvalue{\@@ragged@@command\v!inner}% + {\ifconditional\injectraggedpagesignals + \signalrightpage % may interfere + \doifrightpageelse + {\getvalue{\@@ragged@@command\v!right}}% + {\getvalue{\@@ragged@@command\v!left }}% + \else + \rightorleftpageaction + {\getvalue{\@@ragged@@command\v!left }}% + {\getvalue{\@@ragged@@command\v!right}}% + \fi} + +\setvalue{\@@ragged@@command\v!outer}% + {\ifconditional\injectraggedpagesignals + \signalrightpage % may interfere + \doifrightpageelse + {\getvalue{\@@ragged@@command\v!left }}% + {\getvalue{\@@ragged@@command\v!right}}% + \else + \rightorleftpageaction + {\getvalue{\@@ragged@@command\v!right}}% + {\getvalue{\@@ragged@@command\v!left }}% + \fi} \setvalue{\@@ragged@@command\v!lesshyphenation}% {\appendtoks\lesshyphens\to\everyraggedcommand} diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 9690c9638..fb84e186f 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -992,20 +992,24 @@ %D \NC \NC a normal strut \NC {\showstruts\setupstrut\strut} \NC \NR %D \stoptabulate +\setvalue{@strut@\v!yes }{\setstrut} +\setvalue{@strut@\v!auto }{\setautostrut} +\setvalue{@strut@\v!no }{\setnostrut} +\setvalue{@strut@\v!cap }{\setcapstrut} +\setvalue{@strut@\v!fit }{\setfontstrut} +\setvalue{@strut@\v!line }{\setstrut} +\setvalue{@strut@\s!default}{\setstrut} +\setvalue{@strut@\s!empty }{\setstrut} + \unexpanded\def\setupstrut {\dosingleempty\dosetupstrut} \def\dosetupstrut[#1]% yet undocumented, todo: fontstrut - {\processaction - [#1] - [ \v!yes=>\setstrut, - \v!auto=>\setautostrut, - \v!no=>\setnostrut, - \v!cap=>\setcapstrut, - \v!fit=>\setfontstrut, - \v!line=>\setstrut, - \s!default=>\setstrut, - \s!unknown=>\setcharstrut\commalistelement]} + {\ifcsname @strut@#1\endcsname + \csname @strut@#1\endcsname + \else + \setcharstrut{#1}% + \fi} \def\showstruts {\setteststrut diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex c70c006c4..c5b05a4cc 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/strc-pag.mkiv b/tex/context/base/strc-pag.mkiv index 8d18b9e56..f4b658365 100644 --- a/tex/context/base/strc-pag.mkiv +++ b/tex/context/base/strc-pag.mkiv @@ -253,8 +253,8 @@ % States: \newif\ifrightpage \rightpagetrue -\newif\ifdoublesided -\newif\ifsinglesided +\newif\ifdoublesided \newconditional\layoutisdoublesided +\newif\ifsinglesided \newconditional\layoutissinglesided % Realpage and subpage numbers: @@ -304,12 +304,12 @@ {\getparameters[\??nm][#1]\the\everysetuppagenumbering} \appendtoks - \singlesidedfalse - \doublesidedfalse + \singlesidedfalse \setfalse\layoutisdoublesided + \doublesidedfalse \setfalse\layoutissinglesided \normalexpanded{\noexpand\processallactionsinset[\@@nmalternative]} - [ \v!singlesided=>\singlesidedtrue, - \v!doublesided=>\doublesidedtrue]% - \ifx\trackingmarginnotestrue\undefined\else + [ \v!singlesided=>\singlesidedtrue\settrue\layoutissinglesided, + \v!doublesided=>\doublesidedtrue\settrue\layoutisdoublesided]% + \ifdefined\trackingmarginnotestrue \ifdoublesided \trackingmarginnotestrue \else diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv index 63cf65f35..3c51a837c 100644 --- a/tex/context/base/syst-ini.mkiv +++ b/tex/context/base/syst-ini.mkiv @@ -251,7 +251,7 @@ \newlinechar=10 \edef\outputnewlinechar{^^J} %D One reason to start high with allocation is that it permits us to -%D allocate consecutive ranges more easily, for instance in \MPLIB\ +%D allocate consecutive ranges more easily, for instance if for \MPLIB\ %D we want to allocate a continuous range of boxes. It also permits us %D to do a proper upward allocation for inserts. The current code %D evolved from code that dealt with older engines but as all engines diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index d3f58b5b4..a8e60954e 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -62,7 +62,7 @@ tasks.appendaction("math", "normalizers", "noads.handlers.tags", nil tasks.appendaction("math", "builders", "builders.kernel.mlist_to_hlist") -- always on --- quite experimental +-- quite experimental (nodes.handlers.graphicvadjust might go away) tasks.appendaction("finalizers", "lists", "nodes.handlers.graphicvadjust") -- todo tasks.appendaction("finalizers", "fonts", "builders.paragraphs.solutions.splitters.optimize") -- experimental diff --git a/tex/context/base/trac-inf.lua b/tex/context/base/trac-inf.lua index 2c3aa1dec..5719b953f 100644 --- a/tex/context/base/trac-inf.lua +++ b/tex/context/base/trac-inf.lua @@ -120,7 +120,7 @@ function statistics.show(reporter) end) register("callbacks", function() local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) + return format("%s direct, %s indirect, %s total", total-indirect, indirect, total) end) collectgarbage("collect") register("current memory usage", statistics.memused) diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 2a2fbe2ec..c0ca64b55 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -586,6 +586,7 @@ <cd:constant name='bottomstate' value='statusspodku'/> <cd:constant name='cache' value='cache'/> <cd:constant name='calculate' value='pocitat'/> + <cd:constant name='category' value='category'/> <cd:constant name='ccommand' value='cprikaz'/> <cd:constant name='click' value='klik'/> <cd:constant name='clickin' value='klikuvnitr'/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 3e67c7286..a1a4d2eee 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -586,6 +586,7 @@ <cd:constant name='bottomstate' value='untenstatus'/> <cd:constant name='cache' value='cache'/> <cd:constant name='calculate' value='berechnen'/> + <cd:constant name='category' value='category'/> <cd:constant name='ccommand' value='cbefehl'/> <cd:constant name='click' value='klick'/> <cd:constant name='clickin' value='klickin'/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index d152c78e9..5daa3a118 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -586,6 +586,7 @@ <cd:constant name='bottomstate' value='bottomstate'/> <cd:constant name='cache' value='cache'/> <cd:constant name='calculate' value='calculate'/> + <cd:constant name='category' value='category'/> <cd:constant name='ccommand' value='ccommand'/> <cd:constant name='click' value='click'/> <cd:constant name='clickin' value='clickin'/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 0725ecc62..73a9b3579 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -586,6 +586,7 @@ <cd:constant name='bottomstate' value='etatinf'/> <cd:constant name='cache' value='cache'/> <cd:constant name='calculate' value='calculer'/> + <cd:constant name='category' value='category'/> <cd:constant name='ccommand' value='ccommande'/> <cd:constant name='click' value='clic'/> <cd:constant name='clickin' value='clicinterieur'/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index e564d79f3..a558e4fb1 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -586,6 +586,7 @@ <cd:constant name='bottomstate' value='statofondo'/> <cd:constant name='cache' value='cache'/> <cd:constant name='calculate' value='calcola'/> + <cd:constant name='category' value='category'/> <cd:constant name='ccommand' value='ccomando'/> <cd:constant name='click' value='click'/> <cd:constant name='clickin' value='clickdentro'/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index eb13b9861..ec6ec9949 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -586,6 +586,7 @@ <cd:constant name='bottomstate' value='onderstatus'/> <cd:constant name='cache' value='cache'/> <cd:constant name='calculate' value='bereken'/> + <cd:constant name='category' value='categorie'/> <cd:constant name='ccommand' value='ccommando'/> <cd:constant name='click' value='klik'/> <cd:constant name='clickin' value='klikin'/> diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 8c7102906..80c834304 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -586,6 +586,7 @@ <cd:constant name='bottomstate' value='وضعیتپایین'/> <cd:constant name='cache' value='میانگیر'/> <cd:constant name='calculate' value='محاسبه'/> + <cd:constant name='category' value='category'/> <cd:constant name='ccommand' value='فرمان'/> <cd:constant name='click' value='فشردن'/> <cd:constant name='clickin' value='فشردنداخل'/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index b081430d8..52ce9255d 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -586,6 +586,7 @@ <cd:constant name='bottomstate' value='starejos'/> <cd:constant name='cache' value='cache'/> <cd:constant name='calculate' value='calculeaza'/> + <cd:constant name='category' value='category'/> <cd:constant name='ccommand' value='comandac'/> <cd:constant name='click' value='click'/> <cd:constant name='clickin' value='clickintru'/> diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 79a3517a8..8e52f44a5 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 : 02/16/11 17:05:36 +-- merge date : 02/18/11 17:17:08 do -- begin closure to overcome local limits and interference @@ -741,35 +741,28 @@ if not modules then modules = { } end modules ['l-math'] = { local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan if not math.round then - function math.round(x) - return floor(x + 0.5) - end + function math.round(x) return floor(x + 0.5) end end if not math.div then - function math.div(n,m) - return floor(n/m) - end + function math.div(n,m) return floor(n/m) end end if not math.mod then - function math.mod(n,m) - return n % m - end + function math.mod(n,m) return n % m end end local pipi = 2*math.pi/360 -function math.sind(d) - return sin(d*pipi) -end - -function math.cosd(d) - return cos(d*pipi) +if not math.sind then + function math.sind(d) return sin(d*pipi) end + function math.cosd(d) return cos(d*pipi) end + function math.tand(d) return tan(d*pipi) end end -function math.tand(d) - return tan(d*pipi) +if not math.odd then + function math.odd (n) return n % 2 == 0 end + function math.even(n) return n % 2 ~= 0 end end end -- closure |