ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* 2013.03.21 broken nightly?
@ 2013-03-22 20:00 Kip Warner
  2013-03-22 20:56 ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Kip Warner @ 2013-03-22 20:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen


[-- Attachment #1.1: Type: text/plain, Size: 1495 bytes --]

Hey list,

The last few nightlies, including the most recent one I have installed,
2013.03.21, keeps bailing when attempting to typeset one of my documents
with the same error:

        ! Undefined control sequence.
        <argument> \????sf 
                           :\v!style :\v!serif 
        \setvalue #1->\expandafter \def \csname #1
                                                  \endcsname 
        l.256 \setvalue{\????sf:\v!style :\v!serif      }
                                                         {rm}
        E
        ? You want to edit
        file /usr/share/texmf/tex/context/third/simplefonts/t-simplefonts.mkvi at line 256
        
        mkiv lua stats  > used config
        file: /usr/share/texmf/web2c/texmfcnf.lua
        ! LuaTeX error <local type = type...>:21: attempt to concatenate
        a table value.
        <argument> \????sf 
                           :\v!style :\v!serif 
        \setvalue #1->\expandafter \def \csname #1
                                                  \endcsname 
        l.256 \setvalue{\????sf:\v!style :\v!serif      }
                                                         {rm}

The line it is referring to contains the following:

        \setvalue{\????sf:\v!style :\v!serif      }{rm}

I hope that is helpful.

PS Please cc me, as my subscription is not currently active.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 20:00 2013.03.21 broken nightly? Kip Warner
@ 2013-03-22 20:56 ` Hans Hagen
  2013-03-22 21:35   ` Kip Warner
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2013-03-22 20:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Kip Warner

On 3/22/2013 9:00 PM, Kip Warner wrote:
> Hey list,
>
> The last few nightlies, including the most recent one I have installed,
> 2013.03.21, keeps bailing when attempting to typeset one of my documents
> with the same error:
>
>          ! Undefined control sequence.
>          <argument> \????sf
>                             :\v!style :\v!serif
>          \setvalue #1->\expandafter \def \csname #1
>                                                    \endcsname
>          l.256 \setvalue{\????sf:\v!style :\v!serif      }
>                                                           {rm}
>          E
>          ? You want to edit
>          file /usr/share/texmf/tex/context/third/simplefonts/t-simplefonts.mkvi at line 256
>
>          mkiv lua stats  > used config
>          file: /usr/share/texmf/web2c/texmfcnf.lua
>          ! LuaTeX error <local type = type...>:21: attempt to concatenate
>          a table value.
>          <argument> \????sf
>                             :\v!style :\v!serif
>          \setvalue #1->\expandafter \def \csname #1
>                                                    \endcsname
>          l.256 \setvalue{\????sf:\v!style :\v!serif      }
>                                                           {rm}
>
> The line it is referring to contains the following:
>
>          \setvalue{\????sf:\v!style :\v!serif      }{rm}
>
> I hope that is helpful.
>
> PS Please cc me, as my subscription is not currently active.

Are you sure that your simplefonts is as up to date as context itself?

(looks like some namespace issue but that has been stable for ages now)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 20:56 ` Hans Hagen
@ 2013-03-22 21:35   ` Kip Warner
  2013-03-22 21:51     ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Kip Warner @ 2013-03-22 21:35 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 467 bytes --]

On Fri, 2013-03-22 at 21:56 +0100, Hans Hagen wrote:
> Are you sure that your simplefonts is as up to date as context itself?
> 
> (looks like some namespace issue but that has been stable for ages now)
> 
> Hans

Hey Hans. How can I verify? I am using debs installed from Adam's PPA.

PS Please cc me, as my subscription is not currently active.


-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 21:35   ` Kip Warner
@ 2013-03-22 21:51     ` Hans Hagen
  2013-03-22 21:58       ` Kip Warner
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2013-03-22 21:51 UTC (permalink / raw)
  To: Kip Warner; +Cc: mailing list for ConTeXt users

On 3/22/2013 10:35 PM, Kip Warner wrote:
> On Fri, 2013-03-22 at 21:56 +0100, Hans Hagen wrote:
>> Are you sure that your simplefonts is as up to date as context itself?
>>
>> (looks like some namespace issue but that has been stable for ages now)
>>
>> Hans
>
> Hey Hans. How can I verify? I am using debs installed from Adam's PPA.
>
> PS Please cc me, as my subscription is not currently active.

I have no clue as I use the garden distribution. Last year most 
mechanisms have been move to the new namespace model and I'm pretty sure 
that Wolfgang, as he's involved in that, has adapted simplefonts so the 
question is what version of context/simplefonts do you really run?

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 21:51     ` Hans Hagen
@ 2013-03-22 21:58       ` Kip Warner
  2013-03-22 22:58         ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Kip Warner @ 2013-03-22 21:58 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1.1: Type: text/plain, Size: 592 bytes --]

On Fri, 2013-03-22 at 22:51 +0100, Hans Hagen wrote:
> I have no clue as I use the garden distribution. Last year most 
> mechanisms have been move to the new namespace model and I'm pretty sure 
> that Wolfgang, as he's involved in that, has adapted simplefonts so the 
> question is what version of context/simplefonts do you really run?

I'm actually not sure either. But I've attached some source files
associated with the simplefonts module which may give an indication.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

[-- Attachment #1.1.2: t-simplefonts.lua --]
[-- Type: text/x-lua, Size: 8987 bytes --]

if not modules then modules = { } end modules ['t-simplefonts'] = {
    version   = 1.000,
    comment   = "Simplefonts",
    author    = "Wolfgang Schuster",
    copyright = "Wolfgang Schuster",
    email     = "schuster.wolfgang@googlemail.com",
    license   = "GNU General Public License"
}

local texsprint, ctxcatcodes, prtcatcodes, format, lower, gsub, find = tex.sprint, tex.ctxcatcodes, tex.prtcatcodes, string.format, string.lower, string.gsub, string.find

thirddata             = thirddata             or { }
thirddata.simplefonts = thirddata.simplefonts or { }

local simplefonts = thirddata.simplefonts 

simplefonts.fontlist   = simplefonts.fontlist   or { }
simplefonts.extlist    = simplefonts.extlist    or { }
simplefonts.features   = simplefonts.features   or { }
simplefonts.scripts    = simplefonts.scripts    or { }
simplefonts.languages  = simplefonts.languages  or { }

simplefonts.fontlist = {
    ["hiraginokakugothicpro"] = -- Hiragino Kaku Gothic Pro
        {
            ["normal"] =
                {
                    regular     = "hirakakuprow3" ,
                    italic      = "hirakakuprow3" ,
                    bold        = "hirakakuprow6" ,
                    bolditalic  = "hirakakuprow6" ,
                 } ,
        } ,
    ["hiraginokakugothicpron"] = -- Hiragino Kaku Gothic ProN
        {
            ["normal"] =
                {
                    regular     = "hirakakupronw3" ,
                    italic      = "hirakakupronw3" ,
                    bold        = "hirakakupronw6" ,
                    bolditalic  = "hirakakupronw6" ,
                } ,
        } ,
    ["hiraginokakugothicstd"] = -- Hiragino Kaku Gothic Std
        {
            ["normal"] =
                {
                    regular     = "hirakakustdw8" ,
                    italic      = "hirakakustdw8" ,
                    bold        = "hirakakustdw8" ,
                    bolditalic  = "hirakakustdw8" ,
                } ,
        } ,
    ["hiraginokakugothicstdn"] = -- Hiragino Kaku Gothic StdN
        {
            ["normal"] =
                {
                    regular     = "hirakakustdnw8" ,
                    italic      = "hirakakustdnw8" ,
                    bold        = "hirakakustdnw8" ,
                    bolditalic  = "hirakakustdnw8" ,
                } ,
        } ,
    ["hiraginomarugothicpro"] = -- Hiragino Maru Gothic Pro
        {
            ["normal"] =
                {
                    regular     = "hiramaruprow4" ,
                    italic      = "hiramaruprow4" ,
                    bold        = "hiramaruprow4" ,
                    bolditalic  = "hiramaruprow4" ,
                } ,
        } ,
    ["hiraginomarugothicpron"] = -- Hiragino Maru Gothic ProN
        {
            ["normal"] =
                {
                    regular     = "hiramarupronw4" ,
                    italic      = "hiramarupronw4" ,
                    bold        = "hiramarupronw4" ,
                    bolditalic  = "hiramarupronw4" ,
                } ,
        } ,
    ["hiraginominchopro"] = -- Hiragino Mincho Pro
        {
            ["normal"] =
                {
                    regular     = "hiraminprow3" ,
                    italic      = "hiraminprow3" ,
                    bold        = "hiraminprow6" ,
                    bolditalic  = "hiraminprow6" ,
                } ,
        } ,
    ["hiraginominchopron"] = -- Hiragino Mincho ProN
        {
            ["normal"] =
                {
                    regular     = "hiraminpronw3" ,
                    italic      = "hiraminpronw3" ,
                    bold        = "hiraminpronw6" ,
                    bolditalic  = "hiraminpronw6" ,
                } ,
        } ,
    ["latinmodernmono"] = -- Latin Modern Mono
        {
            ["normal"] =
                {
                    regular     = "lmmono10regular"       ,
                    bold        = "lmmonolt10bold"        ,
                    italic      = "lmmono10italic"        ,
                    slanted     = "lmmono10italic"        ,
                    bolditalic  = "lmmonolt10boldoblique" ,
                    boldslanted = "lmmonolt10boldoblique" ,
                    caps        = "lmmonocaps10regular"   ,
                    slantedcaps = "lmmonocaps10oblique"   ,
                } ,
        } ,
    ["latinmodernroman"] = -- Latin Modern Roman
        {
            ["normal"] =
                {
                    regular     = "lmroman10regular"      ,
                    bold        = "lmroman10bold"         ,
                    italic      = "lmroman10italic"       ,
                    slanted     = "lmromanslant10regular" ,
                    bolditalic  = "lmroman10bolditalic"   ,
                    boldslanted = "lmromanslant10bold"    ,
                    caps        = "lmromancaps10regular"  ,
                    slantedcaps = "lmromancaps10oblique"  ,
                } ,
        } ,
    ["latinmodernsans"] = -- Latin Modern Sans
        {
            ["normal"] =
                {
                    regular     = "lmsans10regular"     ,
                    bold        = "lmsans10bold"        ,
                    italic      = "lmsans10oblique"     ,
                    slanted     = "lmsans10oblique"     ,
                    bolditalic  = "lmsans10boldoblique" ,
                    boldslanted = "lmsans10boldoblique" ,
                } ,
        } ,
}

function simplefonts.selectfont(font,name,extension,style,weight)
    local fontname = {}
    local truename = name
    local name     = lower(gsub(name,"[^a-zA-Z0-9]",""))
    if extension ~= "" then
        ext = find(extension,"*")
        if ext ~= nil then
            fontname = gsub(extension,"*",name)
        else
            fontname = extension
        end
        fontname = "name:" .. lower(gsub(fontname,"[^a-zA-Z0-9]",""))
    else
        if string.match(truename,"file:") then -- can't i check for 'file:' and 'name:' with one string.match?
            fontname = truename
        elseif string.match(truename,"name:") then
            fontname = truename
        elseif simplefonts.fontlist[name] then
            if simplefonts.fontlist[name][weight] then
                if simplefonts.fontlist[name][weight][style] then
                    fontname = simplefonts.fontlist[name][weight][style]
                else
                    fontname = simplefonts.fontlist[name][weight]["regular"]
                end
            elseif simplefonts.fontlist[name]["normal"] then
                if simplefonts.fontlist[name]["normal"][style] then
                    fontname = simplefonts.fontlist[name]["normal"][style]
                else
                    fontname = simplefonts.fontlist[name]["normal"]["regular"]
                end
            end
            fontname = "name:" .. fontname
        else
            -- use comma list
            for _, v in ipairs(simplefonts.extlist[weight][style]) do
                fontname = name .. v
                if global.fonts.names.exists(fontname) then
                    fontname = "name:" .. fontname
                    break
                else
                    --~ interfaces.showmessage("simplefonts","1",fontname) -- wrong place
                    fontname = "DefaultFont" -- no font is found
                end
            end
        end
    end
    --~ print(fontname)
    if fontname == "DefaultFont" then
        interfaces.showmessage("simplefonts","1",name)
    end
    texsprint(prtcatcodes,format("\\setvalue{\\????sf %s%s}{%s}",font,style,fontname))
end

function simplefonts.normalizefontname(name)
    local fontname = lower(gsub(name,"[^a-zA-Z0-9]","")) -- remove spaces and hyphens etc. from the user specified name
    texsprint(ctxcatcodes,fontname)
end

function simplefonts.parameter(key,value,list)
    local feature   = simplefonts.features  [key]
    local script    = simplefonts.scripts   [value]
    local language  = simplefonts.languages [value]
    if feature then
        texsprint(format("\\addvalue{%s}{%s=%s}",list,feature,value))
        --~ print("feature: " .. feature .. " = " .. value)
    else
        if key == "script" then
            if script then
                texsprint(format("\\addvalue{%s}{%s=%s}",list,key,script))
                --~ print("script: " script)
            else
                interfaces.showmessage("simplefonts","4",value)
            end
        elseif key == "language" then
            if language then
                texsprint(format("\\addvalue{%s}{%s=%s}",list,key,language))
                --~ print("language: " language)
            else
                interfaces.showmessage("simplefonts","5",value)
            end
        end
    end
end

[-- Attachment #1.1.3: t-simplefonts.mkiv --]
[-- Type: text/x-matlab, Size: 33640 bytes --]

%D \module
%D   [     file=t-simplefonts,
%D      version=2012.01.09,
%D        title=\CONTEXT\ User Module,
%D     subtitle=Simplefonts,
%D       author=Wolfgang Schuster,
%D         date=\currentdate,
%D    copyright=Wolfgang Schuster,
%D        email=schuster.wolfgang@googlemail.com,
%D      license=GNU General Public License]

%C Copyright (C) 2010  Wolfgang Schuster
%C
%C This program is free software: you can redistribute it and/or modify
%C it under the terms of the GNU General Public License as published by
%C the Free Software Foundation, either version 3 of the License, or
%C (at your option) any later version.
%C
%C This program is distributed in the hope that it will be useful,
%C but WITHOUT ANY WARRANTY; without even the implied warranty of
%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%C GNU General Public License for more details.
%C
%C You should have received a copy of the GNU General Public License
%C along with this program.  If not, see <http://www.gnu.org/licenses/>.

\writestatus{loading}{ConTeXt User Module / Simplefonts}

\unprotect

\startmodule[simplefonts]

%D Constants and variables

\startinterface all
  \setinterfaceconstant {regular}                 {regular}
  \setinterfaceconstant {italic}                  {italic}
  \setinterfaceconstant {slanted}                 {slanted}
  \setinterfaceconstant {bold}                    {bold}
  \setinterfaceconstant {bolditalic}              {bolditalic}
  \setinterfaceconstant {boldslanted}             {boldslanted}
  \setinterfaceconstant {caps}                    {caps}
  \setinterfaceconstant {italiccaps}              {italiccaps}
  \setinterfaceconstant {slantedcaps}             {slantedcaps}
  \setinterfaceconstant {boldcaps}                {boldcaps}
  \setinterfaceconstant {bolditaliccaps}          {bolditaliccaps}
  \setinterfaceconstant {boldslantedcaps}         {boldslantedcaps}
  \setinterfaceconstant {scale}                   {scale}
  \setinterfaceconstant {range}                   {range}
  \setinterfaceconstant {weight}                  {weight}
  \setinterfaceconstant {features}                {features}
  \setinterfaceconstant {regularfont}             {regularfont}
  \setinterfaceconstant {italicfont}              {italicfont}
  \setinterfaceconstant {slantedfont}             {slantedfont}
  \setinterfaceconstant {boldfont}                {boldfont}
  \setinterfaceconstant {bolditalicfont}          {bolditalicfont}
  \setinterfaceconstant {boldslantedfont}         {boldslantedfont}
  \setinterfaceconstant {capsfont}                {capsfont}
  \setinterfaceconstant {italiccapsfont}          {italiccapsfont}
  \setinterfaceconstant {slantedcapsfont}         {slantedcapsfont}
  \setinterfaceconstant {boldcapsfont}            {boldcapsfont}
  \setinterfaceconstant {bolditaliccapsfont}      {bolditaliccapsfont}
  \setinterfaceconstant {boldslantedcapsfont}     {boldslantedcapsfont}
  \setinterfaceconstant {regularfeatures}         {regularfeatures}
  \setinterfaceconstant {italicfeatures}          {italicfeatures}
  \setinterfaceconstant {slantedfeatures}         {slantedfeatures}
  \setinterfaceconstant {boldfeatures}            {boldfeatures}
  \setinterfaceconstant {bolditalicfeatures}      {bolditalicfeatures}
  \setinterfaceconstant {boldslantedfeatures}     {boldslantedfeatures}
  \setinterfaceconstant {smallcapsfeatures}       {smallcapsfeatures}
  \setinterfaceconstant {capsfeatures}            {capsfeatures}
  \setinterfaceconstant {italiccapsfeatures}      {italiccapsfeatures}
  \setinterfaceconstant {slantedcapsfeatures}     {slantedcapsfeatures}
  \setinterfaceconstant {boldcapsfeatures}        {boldcapsfeatures}
  \setinterfaceconstant {bolditaliccapsfeatures}  {bolditaliccapsfeatures}
  \setinterfaceconstant {boldslantedcapsfeatures} {boldslantedcapsfeatures}
  \setinterfaceconstant {typeface}                {typeface}
  \setinterfaceconstant {protrusion}              {protrusion}
  \setinterfaceconstant {contextversion}          {contextversion}
  \setinterfaceconstant {sf}                      {sf}
  \setinterfaceconstant {bc}                      {bc}
  \setinterfaceconstant {mode}                    {mode}
  \setinterfaceconstant {check}                   {check}
\stopinterface

\startinterface all
  \setinterfacevariable {simplefonts}             {simplefonts}
  \setinterfacevariable {simplefont}              {simplefont}
  \setinterfacevariable {style}                   {style}
  \setinterfacevariable {suffix}                  {suffix}
  \setinterfacevariable {serif}                   {serif}
  \setinterfacevariable {sans}                    {sans}
  \setinterfacevariable {mono}                    {mono}
  \setinterfacevariable {math}                    {math}
  \setinterfacevariable {mainfont}                {mainfont}
  \setinterfacevariable {sansfont}                {sansfont}
  \setinterfacevariable {monofont}                {monofont}
  \setinterfacevariable {mathfont}                {mathfont}
  \setinterfacevariable {handwritingfont}         {handwritingfont}
  \setinterfacevariable {calligraphicfont}        {calligraphicfont}
  \setinterfacevariable {cjk}                     {cjk}
  \setinterfacevariable {fallback}                {fallback}
  \setinterfacevariable {condensed}               {condensed}
  \setinterfacevariable {light}                   {light}
  \setinterfacevariable {heavy}                   {heavy}
  \setinterfacevariable {feature}                 {feature}
  \setinterfacevariable {handwriting}             {handwriting}
  \setinterfacevariable {calligraphy}             {calligraphy}
  \setinterfacevariable {fontfamily}              {fontfamily}
  \setinterfacevariable {node}                    {node}
\stopinterface

\startinterface all
  \setinterfaceelement  {set}                     {set}
\stopinterface

%D System constants

\definesystemconstant {Handwriting}
\definesystemconstant {Calligraphy}
\definesystemconstant {Simplefont}

%D Messages

\definemessageconstant {simplefonts}

\startinterface all
  \setinterfacemessage{simplefonts}{title}{simplefonts}
  \setinterfacemessage{simplefonts}{1}    {font '--' not found}
  \setinterfacemessage{simplefonts}{2}    {feature '--' is not defined}
  \setinterfacemessage{simplefonts}{3}    {your context is too old, you need at last version '--'}
  \setinterfacemessage{simplefonts}{4}    {script '--' is not defined}
  \setinterfacemessage{simplefonts}{5}    {language '--' is not defined}
\stopinterface

%D Module setup

\setupmodule
  [ \c!size=12pt,
   \c!style=rm]

%D Lua code

\ctxloadluafile{t-simplefonts}{}

%D Namespace

\def\????sf{@@@@sf}

%D Counter

\newcounter\simplefonts!typeface
\newcounter\simplefonts!fontfamily

\newcounter\simplefonts!mainfont
\newcounter\simplefonts!sansfont
\newcounter\simplefonts!monofont
\newcounter\simplefonts!handwritingfont
\newcounter\simplefonts!calligraphicfont

%D Boolean

\newif\if!!donesimplefonts

%D Tracing

\let\enablesimplefonts \!!donesimplefontstrue
\let\disablesimplefonts\!!donesimplefontsfalse

%D Comma value lists

\letempty\simplefont!features
\letempty\simplefont!localfeatures
\letempty\simplefont!globalfeatures

\def\simplefonts!commands
  {\v!mainfont,\v!sansfont,\v!monofont,\v!mathfont,\v!handwritingfont,\v!calligraphicfont}

\def\simplefonts!weight
  {\v!condensed,\v!light,\v!normal,\v!medium,\v!heavy}

\def\simplefonts!alternative
  {\c!regular,\c!italic,\c!slanted,\c!bold,\c!bolditalic,\c!boldslanted,\c!caps,
   \c!italiccaps,\c!slantedcaps,\c!boldcaps,\c!bolditaliccaps,\c!boldslantedcaps}

%D Simplefont style

\definefontstyle [\c!sf,\v!simplefont] [\c!sf]

\starttypescript [simplefont] [default] [size]
  \definebodyfont
    [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt]
    [sf] [default]
\stoptypescript

\definebodyfont [default] [sf]
  [tf=Simplefont sa 1,
   bf=SimplefontBold sa 1,
   it=SimplefontItalic sa 1,
   sl=SimplefontSlanted sa 1,
   bi=SimplefontBoldItalic sa 1,
   bs=SimplefontBoldSlanted sa 1,
   sc=SimplefontCaps sa 1]

%D \macros
%D   {simplefontparameter,namedsimplefontparameter,
%D    setupsimplefonts,presetsimplefonts}
%D
%D Internal helper macros

\def\simplefontparameter       #1{\csname\????sf\currentsimplefont#1\endcsname}
\def\namedsimplefontparameter#1#2{\csname\????sf                #1#2\endcsname}

\def\setupsimplefonts
  {\dosingleempty\dosetupsimplefonts}

\def\dosetupsimplefonts[#1]% first argument is optional
  {\iffirstargument
     \getparameters[\????sf][#1]%
     \simplefonts@features{#1}\v!global
   \fi
   \if!!donesimplefonts\simplefonts@bodyfont\fi}

\def\presetsimplefonts[#1]%
  {\getparameters
     [#1]
     [\c!regularfont=,
      \c!italicfont=,
      \c!slantedfont=,
      \c!boldfont=,
      \c!bolditalicfont=,
      \c!boldslantedfont=,
      \c!capsfont=,
      \c!italiccapsfont=,
      \c!slantedcapsfont=,
      \c!boldcapsfont=,
      \c!bolditaliccapsfont=,
      \c!boldslantedcapsfont=,
      \c!features=\@@@@sffeatures,
      \c!regularfeatures=\simplefontparameter\c!features,
      \c!italicfeatures=\simplefontparameter\c!features,
      \c!slantedfeatures=\simplefontparameter\c!features,
      \c!boldfeatures=\simplefontparameter\c!features,
      \c!bolditalicfeatures=\simplefontparameter\c!features,
      \c!boldslantedfeatures=\simplefontparameter\c!features,
      \c!smallcapsfeatures=\@@@@sfsmallcapsfeatures,
      \c!capsfeatures=\simplefontparameter\c!smallcapsfeatures,
      \c!italiccapsfeatures=\simplefontparameter\c!smallcapsfeatures,
      \c!slantedcapsfeatures=\simplefontparameter\c!smallcapsfeatures,
      \c!boldcapsfeatures=\simplefontparameter\c!smallcapsfeatures,
      \c!bolditaliccapsfeatures=\simplefontparameter\c!smallcapsfeatures,
      \c!boldslantedcapsfeatures=\simplefontparameter\c!smallcapsfeatures,
      \c!weight=\v!normal,
      \c!mode=,       % the three keys mode, expansion and protrusion
      \c!expansion=,  % are reset for font command when you select
      \c!protrusion=, % a new font to avoid conflicts or unwanted effects
      \c!scale=1.0]}

\setvalue{\????sf:\v!style :\v!serif      }{rm}
\setvalue{\????sf:\v!style :\v!sans       }{ss}
\setvalue{\????sf:\v!style :\v!mono       }{tt}
\setvalue{\????sf:\v!style :\v!math       }{mm}
\setvalue{\????sf:\v!style :\v!handwriting}{hw}
\setvalue{\????sf:\v!style :\v!calligraphy}{cg}
\setvalue{\????sf:\v!style :\v!simplefont }{sf}

\letvalue{\????sf:\v!suffix:\v!serif      }\s!Serif
\letvalue{\????sf:\v!suffix:\v!sans       }\s!Sans
\letvalue{\????sf:\v!suffix:\v!mono       }\s!Mono
\letvalue{\????sf:\v!suffix:\v!handwriting}\s!Handwriting
\letvalue{\????sf:\v!suffix:\v!calligraphy}\s!Calligraphy
\letvalue{\????sf:\v!suffix:\v!simplefont }\s!Simplefont

\definetypescriptsynonym[latinmodernmath][latin-modern]
\definetypescriptsynonym[asanamath]      [asana]

\def\sf@style #1{\csname\????sf:\v!style :#1\endcsname}
\def\sf@suffix#1{\csname\????sf:\v!suffix:#1\endcsname}

\starttexdefinition simplefonts@typeface #1#2#3

    \definetypeface
        [#1]
        [\sf@style{\namedsimplefontparameter{#3}\c!style}]
        [\namedsimplefontparameter{#3}\c!style]
        [#2]
        [\s!default]
        [rscale=\namedsimplefontparameter{#3}\c!scale]

\stoptexdefinition

\starttexdefinition simplefonts@family #1

    \simplefonts@typeface{#1}{\v!mainfont                                    :\simplefonts!mainfont        }{\v!mainfont        }
    \simplefonts@typeface{#1}{\v!sansfont                                    :\simplefonts!sansfont        }{\v!sansfont        }
    \simplefonts@typeface{#1}{\v!monofont                                    :\simplefonts!monofont        }{\v!monofont        }
    \simplefonts@typeface{#1}{\namedsimplefontparameter\v!mathfont\c!typeface                              }{\v!mathfont        }
    \simplefonts@typeface{#1}{\v!handwritingfont                             :\simplefonts!handwritingfont }{\v!handwritingfont }
    \simplefonts@typeface{#1}{\v!calligraphicfont                            :\simplefonts!calligraphicfont}{\v!calligraphicfont}

\stoptexdefinition

\starttexdefinition simplefonts@typescript #1#2

    \startexpanded

        \@NX\starttypescript[#1][#2]

            \simplefonts@fontsynonym{\sf@suffix{#1}\empty               }{\c!regular        }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!Italic            }{\c!italic         }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!Slanted           }{\c!slanted        }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!Bold              }{\c!bold           }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldItalic        }{\c!bolditalic     }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldSlanted       }{\c!boldslanted    }
    
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!Caps              }{\c!caps           }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!Italic\s!Caps     }{\c!italiccaps     }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!Slanted\s!Caps    }{\c!slantedcaps    }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!Bold\s!Caps       }{\c!boldcaps       }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldItalic\s!Caps }{\c!bolditaliccaps }
            \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldSlanted\s!Caps}{\c!boldslantedcaps}

        \@NX\stoptypescript

    \stopexpanded

\stoptexdefinition

\starttexdefinition simplefonts@scripttypescript #1#2

    \startexpanded

        \@NX\starttypescript[#1][#2]

            \simplefonts@fontsynonym{\sf@suffix{#1}}{\c!regular}

        \@NX\stoptypescript

    \stopexpanded

\stoptexdefinition

\starttexdefinition simplefonts@fontsynonym #1#2

    \@NX\definefontsynonym
        [#1]
        [\simplefontparameter{#2}]
        [\s!fallbacks=\currentsimplefont#2\s!fallbacks,
          \s!features=\currentsimplefont#2\s!features ]

\stoptexdefinition

\starttexdefinition simplefonts@fontfallback #1#2#3

    \definefontfallback
        [#1#3\s!fallbacks]
        [\namedsimplefontparameter{#2}{#3}*#2#3\s!features]
        [\namedsimplefontparameter{#2}\c!range]
        [\s!rscale=\namedsimplefontparameter{#2}\c!scale,
          \c!force=\namedsimplefontparameter{#2}\c!force,
          \c!check=\namedsimplefontparameter{#2}\c!check]

\stoptexdefinition

\starttexdefinition simplefonts@bodyfont

    \doglobal\increment\simplefonts!typeface

    \simplefonts@family{\v!simplefonts:\simplefonts!typeface}

    \edef\@@@@sfstyle{\@@@@sfstyle}
    \edef\@@@@sfsize {\@@@@sfsize }

    \setupbodyfont
       [\v!simplefonts:\simplefonts!typeface
        \ifx\@@@@sfstyle\empty\else,\@@@@sfstyle\fi
        \ifx\@@@@sfsize \empty\else,\@@@@sfsize \fi]

\stoptexdefinition

\starttexdefinition simplefonts@fontfeature #1#2

    \letempty\simplefont!features

    % expansion and protrusion could bet se either global for all styles or local for only one style

    \doifvaluesomething{\????sf\c!mode        }{\appendtocommalist{\c!mode      =\csname\????sf\c!mode      \endcsname   }\simplefont!features}
    \doifvaluesomething{\????sf\c!expansion   }{\appendtocommalist{\c!expansion =\csname\????sf\c!expansion \endcsname   }\simplefont!features}
    \doifvaluesomething{\????sf\c!protrusion  }{\appendtocommalist{\c!protrusion=\csname\????sf\c!protrusion\endcsname   }\simplefont!features}

    \doifvaluesomething{\????sf#1\c!mode      }{\appendtocommalist{\c!mode      =\csname\????sf#1\c!mode      \endcsname }\simplefont!features}
    \doifvaluesomething{\????sf#1\c!expansion }{\appendtocommalist{\c!expansion =\csname\????sf#1\c!expansion \endcsname }\simplefont!features}
    \doifvaluesomething{\????sf#1\c!protrusion}{\appendtocommalist{\c!protrusion=\csname\????sf#1\c!protrusion\endcsname }\simplefont!features}

    \appendtocommalist\simplefont!globalfeatures\simplefont!features
    \appendtocommalist\simplefont!localfeatures \simplefont!features

    \normalexpanded{\@NX\definefontfeature[#1#2\s!features][\namedsimplefontparameter{#1}{#2\s!features}][\simplefont!features]}

\stoptexdefinition

\starttexdefinition simplefonts@features #1#2

    \letvalueempty{simplefont!#2features}

    \startprocessassignmentcommand[#1]

        \ctxlua{thirddata.simplefonts.parameter("##1","##2","simplefont!#2features")}

    \stopprocessassignmentcommand

\stoptexdefinition

\starttexdefinition simplefonts@definetextfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currenttypeface{#2}

    \presetsimplefonts[\????sf\currentsimplefont]

    \getparameters[\????sf\currentsimplefont][#4]

    \simplefonts@features{#4}\v!local % parse assignment list for font features

    \startprocesscommacommand[\simplefonts!alternative]

        \simplefonts@fontfeature{#1}{##1}

        \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter{##1\s!font}","##1","\simplefontparameter\c!weight")}

    \stopprocesscommacommand

    \ifx\currenttypeface\v!simplefonts

        \ifx\currentsimplefont\v!mainfont
            \doglobal\increment\simplefonts!mainfont
	        \simplefonts@typescript{\simplefontparameter\c!style}{\v!mainfont:\simplefonts!mainfont}
        \else\ifx\currentsimplefont\v!sansfont
            \doglobal\increment\simplefonts!sansfont
	        \simplefonts@typescript{\simplefontparameter\c!style}{\v!sansfont:\simplefonts!sansfont}
        \else\ifx\currentsimplefont\v!monofont
            \doglobal\increment\simplefonts!monofont
	        \simplefonts@typescript{\simplefontparameter\c!style}{\v!monofont :\simplefonts!monofont}
        \fi\fi\fi

        % don't create a typeface and set bodyfont when the module is loaded

        \if!!donesimplefonts\simplefonts@bodyfont\fi

    \else

        \simplefonts@typescript{\simplefontparameter\c!style}{#1}

        \simplefonts@typeface{#2}{#1}{#1}

    \fi

\stoptexdefinition

\starttexdefinition simplefonts@definescriptfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currenttypeface{#2}

    \presetsimplefonts[\????sf\currentsimplefont]

    \getparameters[\????sf\currentsimplefont][#4]

    \simplefonts@features{#4}\v!local % parse assignment list for font features

    \startprocesscommacommand[\c!regular]

        \simplefonts@fontfeature{#1}{##1}

        \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter{##1\s!font}","##1","\simplefontparameter\c!weight")}

    \stopprocesscommacommand

    \ifx\currenttypeface\v!simplefonts

        \ifx\currentsimplefont\v!handwritingfont
            \doglobal\increment\simplefonts!handwritingfont
            \simplefonts@scripttypescript{\simplefontparameter\c!style}{\v!handwritingfont :\simplefonts!handwritingfont}
        \else\ifx\currentsimplefont\v!calligraphicfont
            \doglobal\increment\simplefonts!calligraphicfont
            \simplefonts@scripttypescript{\simplefontparameter\c!style}{\v!calligraphicfont:\simplefonts!calligraphicfont}
        \fi\fi

        % don't create a typeface and set bodyfont when the module is loaded

        \if!!donesimplefonts\simplefonts@bodyfont\fi

    \else

        \simplefonts@scripttypescript{\simplefontparameter\c!style}{#1}

        \simplefonts@typeface{#2}{#1}{#1}

    \fi

\stoptexdefinition

\starttexdefinition simplefonts@definemathfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currenttypeface{#2}

    \presetsimplefonts[\????sf\currentsimplefont]

    \getparameters[\????sf\currentsimplefont][#4]

    % no fonts are searched for the math fonts, all what happens is to normalize
    % the given name and save it in a macro is is later used to load a predefined
    % typescript

    \setvalue{\????sf\currentsimplefont\c!typeface}{\ctxlua{thirddata.simplefonts.normalizefontname("#3")}}

    \ifx\currenttypeface\v!simplefonts

        % don't create a typeface and set bodyfont when the module is loaded

        \if!!donesimplefonts\simplefonts@bodyfont\fi

    \else

        \simplefonts@typeface{#2}{\namedsimplefontparameter\currentsimplefont\c!typeface}{#1}

    \fi

\stoptexdefinition

\starttexdefinition simplefonts@setfallbackfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currentmainfont{#2}

    \presetsimplefonts[\????sf\currentsimplefont]

    \getparameters[\????sf\currentsimplefont][#4]

    \simplefonts@features{#4}\v!local % parse assignment list for font features

    \startprocesscommacommand[\simplefonts!alternative]

        \simplefonts@fontfeature{#1}{##1}

        \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter{##1\s!font}","##1","\simplefontparameter\c!weight")}

        \simplefonts@fontfallback{#2}{#1}{##1}

    \stopprocesscommacommand

\stoptexdefinition

\starttexdefinition simplefonts@definefallbackfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currentmainfont{#2}

    % to allow more than one fallback font I save the settings
    % in a token register and set then all fallbacks in one turn
    
    % i should wrap this in a macro which checks if a register
    % is already defined, append the setting and flush all

    \unless\ifcsname\currentmainfont\s!fallbacks\endcsname\@EA\newtoks\csname\currentmainfont\s!fallbacks\endcsname\fi

    \csname\currentmainfont\s!fallbacks\endcsname\@EA{\the\@EA\csname\currentmainfont\s!fallbacks\endcsname\simplefonts@setfallbackfont[#1][#2][#3][#4]}

    \the\@EA\csname\currentmainfont\s!fallbacks\endcsname

    % the only way to make fallback fonts working with the module
    % is to create a new typeface and enable it as bodyfont

    % don't create a typeface or set the bodyfont when the module code is loaded

    \if!!donesimplefonts

        \startprocesscommacommand[\simplefonts!commands] % why not \doifinset?

            \ifx\currentcommalistitem\currentmainfont\simplefonts@bodyfont\quitcommalist\fi

        \stopprocesscommacommand

    \fi

\stoptexdefinition

%D \macros
%D   {definefontcommand,definesubfontcommand}

\def\definefontcommand
  {\dotripleempty\dodefinefontcommand}

\def\dodefinefontcommand[#1][#2][#3]%
  {\getparameters[\????sf#1][\c!style=\v!serif,#3]%
   \processaction
     [\namedsimplefontparameter{#1}\c!style]
     [      \v!serif=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont  [#1][#2]},
             \v!sans=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont  [#1][#2]},
             \v!mono=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont  [#1][#2]},
             \v!math=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definemathfont  [#1][#2]},
      \v!handwriting=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definescriptfont[#1][#2]},
      \v!calligraphy=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definescriptfont[#1][#2]},
          \s!unknown=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont  [#1][#2]}]}

\definefontcommand[\v!mainfont        ][\v!simplefonts][\c!style=\v!serif      ]
\definefontcommand[\v!sansfont        ][\v!simplefonts][\c!style=\v!sans       ]
\definefontcommand[\v!monofont        ][\v!simplefonts][\c!style=\v!mono       ]
\definefontcommand[\v!mathfont        ][\v!simplefonts][\c!style=\v!math       ]
\definefontcommand[\v!handwritingfont ][\v!simplefonts][\c!style=\v!handwriting]
\definefontcommand[\v!calligraphicfont][\v!simplefonts][\c!style=\v!calligraphy]

\def\definesubfontcommand
  {\dotripleempty\dodefinesubfontcommand}

\def\dodefinesubfontcommand[#1][#2][#3]%
  {\getparameters[\????sf#1][\c!range=,#3]%
   \setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definefallbackfont[#1][#2]}}

\definesubfontcommand[\v!cjk\v!mainfont][\v!mainfont][\c!range={0x00400-0x2FA1F}]
\definesubfontcommand[\v!cjk\v!sansfont][\v!sansfont][\c!range={0x00400-0x2FA1F}]
\definesubfontcommand[\v!cjk\v!monofont][\v!monofont][\c!range={0x00400-0x2FA1F}]

\definesubfontcommand[\v!mainfont\v!fallback][\v!mainfont][\c!range=]
\definesubfontcommand[\v!sansfont\v!fallback][\v!sansfont][\c!range=]
\definesubfontcommand[\v!monofont\v!fallback][\v!monofont][\c!range=]

%D \macros
%D   {simplefont,definesimplefont}

\def\simplefont
  {\dodoubleempty\dosimplefont}

\def\dosimplefont[#1][#2]%
  {\getparameters[\????sf\v!default][\c!features=\v!default,\c!alternative=\v!regular,\c!weight=\v!normal,\c!size=,#2]%
   \edef\simplefontsize{\namedsimplefontparameter\v!default\c!size}%
   \ifx\simplefontsize\empty\else
     \doifdimenstringelse\simplefontsize
       {\edef\simplefontsize{ at \simplefontsize}}
       {\edef\simplefontsize{    \simplefontsize}}%
   \fi
   \ctxlua{thirddata.simplefonts.selectfont("\v!default","#1","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}%
   \expanded{\definedfont[\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures\simplefontsize]}}

\def\definesimplefont
  {\dotripleempty\dodefinesimplefont}

\def\dodefinesimplefont[#1][#2][#3]%
  {\getparameters[\????sf\v!default][\c!features=\v!default,\c!alternative=\v!regular,\c!weight=\v!normal,\c!size=,#3]%
   \edef\simplefontsize{\namedsimplefontparameter\v!default\c!size}%
   \ifx\simplefontsize\empty\else
     \doifdimenstringelse\simplefontsize
       {\edef\simplefontsize{ at \simplefontsize}}
       {\edef\simplefontsize{    \simplefontsize}}%
   \fi
   \ctxlua{thirddata.simplefonts.selectfont("\v!default","#2","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}%
   \expanded{\definefont[#1][\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures\simplefontsize][#3]}}

%D \macros
%D   {simplefonttypeface,definesimplefonttypeface}

\def\simplefonttypeface
  {\dodoubleempty\dosimplefonttypeface}

\def\dosimplefonttypeface[#1][#2]%
  {\doglobal\increment\simplefonts!fontfamily
   \simplefonts@definetextfont[\v!fontfamily][\v!fontfamily:\simplefonts!fontfamily][#1][\c!style=\v!simplefont,#2]%
   \switchtobodyfont[\v!fontfamily:\simplefonts!fontfamily]}

\def\definesimplefonttypeface
  {\dotripleempty\dodefinesimplefonttypeface}

\def\dodefinesimplefonttypeface[#1][#2][#3]%
  {\getparameters[\????sf#1][\c!style=\v!serif,#3]%
   \processaction
     [\namedsimplefontparameter{#1}\c!style]
     [      \v!serif=>{\simplefonts@definetextfont  [#1][#1][#2][#3]},
             \v!sans=>{\simplefonts@definetextfont  [#1][#1][#2][#3]},
             \v!mono=>{\simplefonts@definetextfont  [#1][#1][#2][#3]},
             \v!math=>{\simplefonts@definemathfont  [#1][#1][#2][#3]},
      \v!handwriting=>{\simplefonts@definescriptfont[#1][#1][#2][#3]},
      \v!calligraphy=>{\simplefonts@definescriptfont[#1][#1][#2][#3]},
          \s!unknown=>{\simplefonts@definetextfont  [#1][#1][#2][#3]}]}

%D Font extensions

\getparameters
  [\????sf\v!condensed]
  [        \c!regular={condensedregular,condregular,condensed},
            \c!italic={condenseditalic,condensedoblique,conditalic,\namedsimplefontparameter\v!condensed\c!regular},
           \c!slanted={\namedsimplefontparameter\v!condensed\c!italic},
              \c!bold={condensedbold,condbold,\namedsimplefontparameter\v!condensed\c!regular},
        \c!bolditalic={condensedbolditalic,condensedboldoblique,condbolditalic,\namedsimplefontparameter\v!condensed\c!bold},
       \c!boldslanted={\namedsimplefontparameter\v!condensed\c!bolditalic},
              \c!caps={\namedsimplefontparameter\v!condensed\c!regular},
        \c!italiccaps={\namedsimplefontparameter\v!condensed\c!caps},
       \c!slantedcaps={\namedsimplefontparameter\v!condensed\c!italiccaps},
          \c!boldcaps={\namedsimplefontparameter\v!condensed\c!caps},
    \c!bolditaliccaps={\namedsimplefontparameter\v!condensed\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontparameter\v!condensed\c!bolditaliccaps}]

\getparameters
  [\????sf\v!light]
  [        \c!regular={lightregular,light},
            \c!italic={lightitalic,lightit,lightoblique,\namedsimplefontparameter\v!light\c!regular},
           \c!slanted={\namedsimplefontparameter\v!light\c!italic},
              \c!bold={bookregular,regular,book,\namedsimplefontparameter\v!light\c!regular},
        \c!bolditalic={bookitalic,bookit,italic,oblique,\namedsimplefontparameter\v!light\c!bold},
       \c!boldslanted={\namedsimplefontparameter\v!light\c!bolditalic},
              \c!caps={smallcapslight,\namedsimplefontparameter\v!light\c!regular},
        \c!italiccaps={\namedsimplefontparameter\v!light\c!caps},
       \c!slantedcaps={\namedsimplefontparameter\v!light\c!italiccaps},
          \c!boldcaps={\namedsimplefontparameter\v!light\c!caps},
    \c!bolditaliccaps={\namedsimplefontparameter\v!light\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontparameter\v!light\c!bolditaliccaps}]

\getparameters
  [\????sf\v!normal]
  [        \c!regular={roman,regular,book,\empty},
            \c!italic={italic,it,oblique,kursiv,bookitalic,bookit,\namedsimplefontparameter\v!normal\c!regular},
           \c!slanted={\namedsimplefontparameter\v!normal\c!italic},
              \c!bold={bold,bd,kraeftig,mediumregular,semibold,demi,\namedsimplefontparameter\v!normal\c!regular},
        \c!bolditalic={bolditalic,boldit,bdit,boldoblique,mediumitalic,semibolditalic,demiitalic,\namedsimplefontparameter\v!normal\c!bold},
       \c!boldslanted={\namedsimplefontparameter\v!normal\c!bolditalic},
              \c!caps={smallcaps,capitals,sc,\namedsimplefontparameter\v!normal\c!regular},
        \c!italiccaps={\namedsimplefontparameter\v!normal\c!caps},
       \c!slantedcaps={\namedsimplefontparameter\v!normal\c!italiccaps},
          \c!boldcaps={scbold,\namedsimplefontparameter\v!normal\c!caps},
    \c!bolditaliccaps={\namedsimplefontparameter\v!normal\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontparameter\v!normal\c!bolditaliccaps}]

\getparameters
  [\????sf\v!medium]
  [        \c!regular={mediumregular,medregular,medium},
            \c!italic={mediumitalic,meditalic,\namedsimplefontparameter\v!medium\c!regular},
           \c!slanted={\namedsimplefontparameter\v!medium\c!italic},
              \c!bold={heavyregular,heavy,\namedsimplefontparameter\v!medium\c!regular},
        \c!bolditalic={heavyitalic,\namedsimplefontparameter\v!medium\c!bold},
       \c!boldslanted={\namedsimplefontparameter\v!medium\c!bolditalic},
              \c!caps={mediumcaps,\namedsimplefontparameter\v!medium\c!regular},
        \c!italiccaps={\namedsimplefontparameter\v!medium\c!caps},
       \c!slantedcaps={\namedsimplefontparameter\v!medium\c!italiccaps},
          \c!boldcaps={\namedsimplefontparameter\v!medium\c!caps},
    \c!bolditaliccaps={\namedsimplefontparameter\v!medium\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontparameter\v!medium\c!bolditaliccaps}]

\getparameters
  [\????sf\v!heavy]
  [        \c!regular={heavyregular,heavy},
            \c!italic={heavyitalic,\namedsimplefontparameter\v!heavy\c!regular},
           \c!slanted={\namedsimplefontparameter\v!heavy\c!italic},
              \c!bold={\namedsimplefontparameter\v!heavy\c!regular},
        \c!bolditalic={\namedsimplefontparameter\v!heavy\c!bold},
       \c!boldslanted={\namedsimplefontparameter\v!heavy\c!bolditalic},
              \c!caps={\namedsimplefontparameter\v!heavy\c!regular},
        \c!italiccaps={\namedsimplefontparameter\v!heavy\c!caps},
       \c!slantedcaps={\namedsimplefontparameter\v!heavy\c!italiccaps},
          \c!boldcaps={\namedsimplefontparameter\v!heavy\c!caps},
    \c!bolditaliccaps={\namedsimplefontparameter\v!heavy\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontparameter\v!heavy\c!bolditaliccaps}]

\startprocesscommacommand[\simplefonts!weight]

    \ctxlua{thirddata.simplefonts.extlist["#1"] = { }}

    {

        \startprocesscommacommand[\simplefonts!alternative]

            \ctxlua{thirddata.simplefonts.extlist["#1"]["##1"] = { }}

            {

                \startprocesscommacommand[\namedsimplefontparameter{#1}{##1}]

                    \ctxlua{table.insert(thirddata.simplefonts.extlist["#1"]["##1"],"####1")}

                \stopprocesscommacommand

            }

        \stopprocesscommacommand

    }

\stopprocesscommacommand

%D Default setup

\enabledirectives[fonts.autoreload]

\setupsimplefonts
  [\c!size=\moduleparameter\v!simplefonts\c!size,
   \c!style=\moduleparameter\v!simplefonts\c!style,
   \c!features=\v!default,
   \c!smallcapsfeatures=\v!smallcaps,
   \c!mode=\v!node,
   \c!force=\v!yes,
   \c!check=\v!no,
   \c!expansion=\v!no,
   \c!protrusion=\v!no]

%D Default fonts

\setmainfont        [Latin Modern Roman]
\setsansfont        [Latin Modern Sans]
\setmonofont        [Latin Modern Mono][\s!features=\s!none]
\setmathfont        [Latin Modern Math]
\sethandwritingfont [Latin Modern Roman] % neither handwritten nor calligraphic are available
\setcalligraphicfont[Latin Modern Roman] % for Latin Modern but I need a default font for them

\!!donesimplefontstrue

\stopmodule

\protect \endinput

[-- Attachment #1.1.4: t-simplefonts.mkvi --]
[-- Type: text/x-matlab, Size: 34025 bytes --]

%D \module
%D   [     file=t-simplefonts,
%D      version=2013.02.03,
%D        title=\CONTEXT\ User Module,
%D     subtitle=Simplefonts,
%D       author=Wolfgang Schuster,
%D         date=\currentdate,
%D    copyright=Wolfgang Schuster,
%D        email=schuster.wolfgang@googlemail.com,
%D      license=GNU General Public License]

%C Copyright (C) 2010  Wolfgang Schuster
%C
%C This program is free software: you can redistribute it and/or modify
%C it under the terms of the GNU General Public License as published by
%C the Free Software Foundation, either version 3 of the License, or
%C (at your option) any later version.
%C
%C This program is distributed in the hope that it will be useful,
%C but WITHOUT ANY WARRANTY; without even the implied warranty of
%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%C GNU General Public License for more details.
%C
%C You should have received a copy of the GNU General Public License
%C along with this program.  If not, see <http://www.gnu.org/licenses/>.

\writestatus{loading}{ConTeXt User Module / Simplefonts}

\unprotect

\startmodule[simplefonts]

%D Constants and variables

\startinterface all
  \setinterfaceconstant {regular}                 {regular}
  \setinterfaceconstant {italic}                  {italic}
  \setinterfaceconstant {slanted}                 {slanted}
  \setinterfaceconstant {bold}                    {bold}
  \setinterfaceconstant {bolditalic}              {bolditalic}
  \setinterfaceconstant {boldslanted}             {boldslanted}
  \setinterfaceconstant {caps}                    {caps}
  \setinterfaceconstant {italiccaps}              {italiccaps}
  \setinterfaceconstant {slantedcaps}             {slantedcaps}
  \setinterfaceconstant {boldcaps}                {boldcaps}
  \setinterfaceconstant {bolditaliccaps}          {bolditaliccaps}
  \setinterfaceconstant {boldslantedcaps}         {boldslantedcaps}
  \setinterfaceconstant {scale}                   {scale}
  \setinterfaceconstant {range}                   {range}
  \setinterfaceconstant {weight}                  {weight}
  \setinterfaceconstant {features}                {features}
  \setinterfaceconstant {regularfont}             {regularfont}
  \setinterfaceconstant {italicfont}              {italicfont}
  \setinterfaceconstant {slantedfont}             {slantedfont}
  \setinterfaceconstant {boldfont}                {boldfont}
  \setinterfaceconstant {bolditalicfont}          {bolditalicfont}
  \setinterfaceconstant {boldslantedfont}         {boldslantedfont}
  \setinterfaceconstant {capsfont}                {capsfont}
  \setinterfaceconstant {italiccapsfont}          {italiccapsfont}
  \setinterfaceconstant {slantedcapsfont}         {slantedcapsfont}
  \setinterfaceconstant {boldcapsfont}            {boldcapsfont}
  \setinterfaceconstant {bolditaliccapsfont}      {bolditaliccapsfont}
  \setinterfaceconstant {boldslantedcapsfont}     {boldslantedcapsfont}
  \setinterfaceconstant {regularfeatures}         {regularfeatures}
  \setinterfaceconstant {italicfeatures}          {italicfeatures}
  \setinterfaceconstant {slantedfeatures}         {slantedfeatures}
  \setinterfaceconstant {boldfeatures}            {boldfeatures}
  \setinterfaceconstant {bolditalicfeatures}      {bolditalicfeatures}
  \setinterfaceconstant {boldslantedfeatures}     {boldslantedfeatures}
  \setinterfaceconstant {smallcapsfeatures}       {smallcapsfeatures}
  \setinterfaceconstant {capsfeatures}            {capsfeatures}
  \setinterfaceconstant {italiccapsfeatures}      {italiccapsfeatures}
  \setinterfaceconstant {slantedcapsfeatures}     {slantedcapsfeatures}
  \setinterfaceconstant {boldcapsfeatures}        {boldcapsfeatures}
  \setinterfaceconstant {bolditaliccapsfeatures}  {bolditaliccapsfeatures}
  \setinterfaceconstant {boldslantedcapsfeatures} {boldslantedcapsfeatures}
  \setinterfaceconstant {typeface}                {typeface}
  \setinterfaceconstant {protrusion}              {protrusion}
  \setinterfaceconstant {contextversion}          {contextversion}
  \setinterfaceconstant {sf}                      {sf}
  \setinterfaceconstant {bc}                      {bc}
  \setinterfaceconstant {mode}                    {mode}
  \setinterfaceconstant {check}                   {check}
\stopinterface

\startinterface all
  \setinterfacevariable {simplefonts}             {simplefonts}
  \setinterfacevariable {simplefont}              {simplefont}
  \setinterfacevariable {style}                   {style}
  \setinterfacevariable {suffix}                  {suffix}
  \setinterfacevariable {serif}                   {serif}
  \setinterfacevariable {sans}                    {sans}
  \setinterfacevariable {mono}                    {mono}
  \setinterfacevariable {math}                    {math}
  \setinterfacevariable {mainfont}                {mainfont}
  \setinterfacevariable {sansfont}                {sansfont}
  \setinterfacevariable {monofont}                {monofont}
  \setinterfacevariable {mathfont}                {mathfont}
  \setinterfacevariable {handwritingfont}         {handwritingfont}
  \setinterfacevariable {calligraphicfont}        {calligraphicfont}
  \setinterfacevariable {cjk}                     {cjk}
  \setinterfacevariable {fallback}                {fallback}
  \setinterfacevariable {condensed}               {condensed}
  \setinterfacevariable {light}                   {light}
  \setinterfacevariable {heavy}                   {heavy}
  \setinterfacevariable {feature}                 {feature}
  \setinterfacevariable {handwriting}             {handwriting}
  \setinterfacevariable {calligraphy}             {calligraphy}
  \setinterfacevariable {fontfamily}              {fontfamily}
  \setinterfacevariable {node}                    {node}
\stopinterface

\startinterface all
  \setinterfaceelement  {set}                     {set}
\stopinterface

%D System constants

\definesystemconstant {Handwriting}
\definesystemconstant {Calligraphy}
\definesystemconstant {Simplefont}

%D Messages

\definemessageconstant {simplefonts}

\startinterface all
  \setinterfacemessage{simplefonts}{title}{simplefonts}
  \setinterfacemessage{simplefonts}{1}    {font '--' not found}
  \setinterfacemessage{simplefonts}{2}    {feature '--' is not defined}
  \setinterfacemessage{simplefonts}{3}    {your context is too old, you need at last version '--'}
  \setinterfacemessage{simplefonts}{4}    {script '--' is not defined}
  \setinterfacemessage{simplefonts}{5}    {language '--' is not defined}
\stopinterface

%D Module setup

\setupmodule
  [ \c!size=12pt,
   \c!style=rm]

%D Lua code

\ctxloadluafile{t-simplefonts}{}

%D Namespace

\installnamespace                              {simplefonts}
\installbasicautosetuphandler \????simplefonts {simplefonts} \????simplefonts

%D Counter

\newcount\c_simplefonts_typeface
\newcount\c_simplefonts_fontfamily

\newcount\c_simplefonts_mainfont
\newcount\c_simplefonts_sansfont
\newcount\c_simplefonts_monofont
\newcount\c_simplefonts_handwritingfont
\newcount\c_simplefonts_calligraphicfont

%D Boolean

\newconditional\c_simplefonts_done

%D Tracing

\def\enablesimplefonts {\settrue\c_simplefonts_done }
\def\disablesimplefonts{\setfalse\c_simplefonts_done}

%D Comma value lists

\let\m_simplefonts_features      \empty
\let\m_simplefonts_localfeatures \empty
\let\m_simplefonts_globalfeatures\empty

\def\m_simplefonts_commands
  {\v!mainfont,\v!sansfont,\v!monofont,\v!mathfont,\v!handwritingfont,\v!calligraphicfont}

\def\m_simplefonts_weight
  {\v!condensed,\v!light,\v!normal,\v!medium,\v!heavy}

\def\m_simplefonts_alternative
  {\c!regular,\c!italic,\c!slanted,\c!bold,\c!bolditalic,\c!boldslanted,\c!caps,
   \c!italiccaps,\c!slantedcaps,\c!boldcaps,\c!bolditaliccaps,\c!boldslantedcaps}

%D Simplefont style

\definefontstyle [\c!sf,\v!simplefont] [\c!sf]

\starttypescript [simplefont] [default] [size]
  \definebodyfont
    [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt]
    [sf] [default]
\stoptypescript

\definebodyfont [default] [sf]
  [tf=Simplefont sa 1,
   bf=SimplefontBold sa 1,
   it=SimplefontItalic sa 1,
   sl=SimplefontSlanted sa 1,
   bi=SimplefontBoldItalic sa 1,
   bs=SimplefontBoldSlanted sa 1,
   sc=SimplefontCaps sa 1]

%D \macros
%D   {setupsimplefonts,presetsimplefonts}
%D
%D Internal helper macros

\def\setupsimplefonts
  {\dosingleempty\dosetupsimplefonts}

\def\dosetupsimplefonts[#1]% first argument is optional
  {\iffirstargument
     \getparameters[\????sf][#1]%
     \simplefonts_features{#1}\v!global
   \fi
   \ifconditional\c_simplefonts_done\simplefonts_bodyfont\fi}

\def\presetsimplefonts[#1]%
  {\getparameters
     [#1]
     [\c!regularfont=,
      \c!italicfont=,
      \c!slantedfont=,
      \c!boldfont=,
      \c!bolditalicfont=,
      \c!boldslantedfont=,
      \c!capsfont=,
      \c!italiccapsfont=,
      \c!slantedcapsfont=,
      \c!boldcapsfont=,
      \c!bolditaliccapsfont=,
      \c!boldslantedcapsfont=,
      \c!features=\@@@@sffeatures,
      \c!regularfeatures=\simplefontsparameter\c!features,
      \c!italicfeatures=\simplefontsparameter\c!features,
      \c!slantedfeatures=\simplefontsparameter\c!features,
      \c!boldfeatures=\simplefontsparameter\c!features,
      \c!bolditalicfeatures=\simplefontsparameter\c!features,
      \c!boldslantedfeatures=\simplefontsparameter\c!features,
      \c!smallcapsfeatures=\@@@@sfsmallcapsfeatures,
      \c!capsfeatures=\simplefontsparameter\c!smallcapsfeatures,
      \c!italiccapsfeatures=\simplefontsparameter\c!smallcapsfeatures,
      \c!slantedcapsfeatures=\simplefontsparameter\c!smallcapsfeatures,
      \c!boldcapsfeatures=\simplefontsparameter\c!smallcapsfeatures,
      \c!bolditaliccapsfeatures=\simplefontsparameter\c!smallcapsfeatures,
      \c!boldslantedcapsfeatures=\simplefontsparameter\c!smallcapsfeatures,
      \c!weight=\v!normal,
      \c!mode=,       % the three keys mode, expansion and protrusion
      \c!expansion=,  % are reset for font command when you select
      \c!protrusion=, % a new font to avoid conflicts or unwanted effects
      \c!scale=1.0]}

\setvalue{\????sf:\v!style :\v!serif      }{rm}
\setvalue{\????sf:\v!style :\v!sans       }{ss}
\setvalue{\????sf:\v!style :\v!mono       }{tt}
\setvalue{\????sf:\v!style :\v!math       }{mm}
\setvalue{\????sf:\v!style :\v!handwriting}{hw}
\setvalue{\????sf:\v!style :\v!calligraphy}{cg}
\setvalue{\????sf:\v!style :\v!simplefont }{sf}

\letvalue{\????sf:\v!suffix:\v!serif      }\s!Serif
\letvalue{\????sf:\v!suffix:\v!sans       }\s!Sans
\letvalue{\????sf:\v!suffix:\v!mono       }\s!Mono
\letvalue{\????sf:\v!suffix:\v!handwriting}\s!Handwriting
\letvalue{\????sf:\v!suffix:\v!calligraphy}\s!Calligraphy
\letvalue{\????sf:\v!suffix:\v!simplefont }\s!Simplefont

\definetypescriptsynonym[latinmodernmath][latin-modern]
\definetypescriptsynonym[asanamath]      [asana]

\def\sf_style #1{\csname\????sf:\v!style :#1\endcsname}
\def\sf_suffix#1{\csname\????sf:\v!suffix:#1\endcsname}

\starttexdefinition simplefonts_typeface #1#2#3

    \definetypeface
        [#1]
        [\sf_style{\namedsimplefontsparameter{#3}\c!style}]
        [\namedsimplefontsparameter{#3}\c!style]
        [#2]
        [\s!default]
        [rscale=\namedsimplefontsparameter{#3}\c!scale]

\stoptexdefinition

\starttexdefinition simplefonts_family #1

    \simplefonts_typeface{#1}{\v!mainfont                                    :\number\c_simplefonts_mainfont        }{\v!mainfont        }
    \simplefonts_typeface{#1}{\v!sansfont                                    :\number\c_simplefonts_sansfont        }{\v!sansfont        }
    \simplefonts_typeface{#1}{\v!monofont                                    :\number\c_simplefonts_monofont        }{\v!monofont        }
    \simplefonts_typeface{#1}{\namedsimplefontsparameter\v!mathfont\c!typeface                                      }{\v!mathfont        }
    \simplefonts_typeface{#1}{\v!handwritingfont                             :\number\c_simplefonts_handwritingfont }{\v!handwritingfont }
    \simplefonts_typeface{#1}{\v!calligraphicfont                            :\number\c_simplefonts_calligraphicfont}{\v!calligraphicfont}

\stoptexdefinition

\starttexdefinition simplefonts_typescript #1#2

    \startexpanded

        \starttypescript[#1][#2]

            \simplefonts_fontsynonym{\sf_suffix{#1}\empty               }{\c!regular        }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!Italic            }{\c!italic         }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!Slanted           }{\c!slanted        }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!Bold              }{\c!bold           }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!BoldItalic        }{\c!bolditalic     }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!BoldSlanted       }{\c!boldslanted    }
    
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!Caps              }{\c!caps           }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!Italic\s!Caps     }{\c!italiccaps     }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!Slanted\s!Caps    }{\c!slantedcaps    }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!Bold\s!Caps       }{\c!boldcaps       }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!BoldItalic\s!Caps }{\c!bolditaliccaps }
            \simplefonts_fontsynonym{\sf_suffix{#1}\s!BoldSlanted\s!Caps}{\c!boldslantedcaps}

        \stoptypescript

    \stopexpanded

\stoptexdefinition

\starttexdefinition simplefonts_scripttypescript #1#2

    \startexpanded

        \starttypescript[#1][#2]

            \simplefonts_fontsynonym{\sf_suffix{#1}}{\c!regular}

        \stoptypescript

    \stopexpanded

\stoptexdefinition

\starttexdefinition simplefonts_fontsynonym #1#2

    \definefontsynonym
        [#1]
        [\simplefontsparameter{#2}]
        [\s!fallbacks=\currentsimplefont#2\s!fallbacks,
          \s!features=\currentsimplefont#2\s!features ]

\stoptexdefinition

\starttexdefinition simplefonts_fontfallback #1#2#3

    \definefontfallback
        [#1#3\s!fallbacks]
        [\namedsimplefontsparameter{#2}{#3}*#2#3\s!features]
        [\namedsimplefontsparameter{#2}\c!range]
        [\s!rscale=\namedsimplefontsparameter{#2}\c!scale,
          \c!force=\namedsimplefontsparameter{#2}\c!force,
          \c!check=\namedsimplefontsparameter{#2}\c!check]

\stoptexdefinition

\starttexdefinition simplefonts_bodyfont

    \global\advance\c_simplefonts_typeface\plusone

    \simplefonts_family{\v!simplefonts:\number\c_simplefonts_typeface}

    \edef\@@@@sfstyle{\@@@@sfstyle}
    \edef\@@@@sfsize {\@@@@sfsize }

    \setupbodyfont
       [\v!simplefonts:\number\c_simplefonts_typeface
        \ifx\@@@@sfstyle\empty\else,\@@@@sfstyle\fi
        \ifx\@@@@sfsize \empty\else,\@@@@sfsize \fi]

\stoptexdefinition

\starttexdefinition simplefonts_fontfeature #1#2

    \let\m_simplefonts_features\empty

    % expansion and protrusion could bet se either global for all styles or local for only one style

    \doifvaluesomething{\????sf\c!mode        }{\appendtocommalist{\c!mode      =\csname\????sf\c!mode      \endcsname   }\m_simplefonts_features}
    \doifvaluesomething{\????sf\c!expansion   }{\appendtocommalist{\c!expansion =\csname\????sf\c!expansion \endcsname   }\m_simplefonts_features}
    \doifvaluesomething{\????sf\c!protrusion  }{\appendtocommalist{\c!protrusion=\csname\????sf\c!protrusion\endcsname   }\m_simplefonts_features}

    \doifvaluesomething{\????sf#1\c!mode      }{\appendtocommalist{\c!mode      =\csname\????sf#1\c!mode      \endcsname }\m_simplefonts_features}
    \doifvaluesomething{\????sf#1\c!expansion }{\appendtocommalist{\c!expansion =\csname\????sf#1\c!expansion \endcsname }\m_simplefonts_features}
    \doifvaluesomething{\????sf#1\c!protrusion}{\appendtocommalist{\c!protrusion=\csname\????sf#1\c!protrusion\endcsname }\m_simplefonts_features}

    \appendtocommalist\m_simplefonts_globalfeatures\m_simplefonts_features
    \appendtocommalist\m_simplefonts_localfeatures \m_simplefonts_features

    \normalexpanded{\definefontfeature[#1#2\s!features][\namedsimplefontsparameter{#1}{#2\s!features}][\m_simplefonts_features]}

\stoptexdefinition

\starttexdefinition simplefonts_features #1#2

    \letvalueempty{m_simplefonts_#2features}

    \startprocessassignmentcommand[#1]

        \ctxlua{thirddata.simplefonts.parameter("##1","##2","m_simplefonts_#2features")}

    \stopprocessassignmentcommand

\stoptexdefinition

\starttexdefinition simplefonts_definetextfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currenttypeface{#2}

    \presetsimplefonts[\????sf\currentsimplefont]

    \getparameters[\????sf\currentsimplefont][#4]

    \simplefonts_features{#4}\v!local % parse assignment list for font features

    \startprocesscommacommand[\m_simplefonts_alternative]

        \simplefonts_fontfeature{#1}{##1}

        \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontsparameter{##1\s!font}","##1","\simplefontsparameter\c!weight")}

    \stopprocesscommacommand

    \ifx\currenttypeface\v!simplefonts

        \ifx\currentsimplefont\v!mainfont
            \global\advance\c_simplefonts_mainfont\plusone
	        \simplefonts_typescript{\simplefontsparameter\c!style}{\v!mainfont:\number\c_simplefonts_mainfont}
        \else\ifx\currentsimplefont\v!sansfont
            \global\advance\c_simplefonts_sansfont\plusone
	        \simplefonts_typescript{\simplefontsparameter\c!style}{\v!sansfont:\number\c_simplefonts_sansfont}
        \else\ifx\currentsimplefont\v!monofont
            \global\advance\c_simplefonts_monofont\plusone
	        \simplefonts_typescript{\simplefontsparameter\c!style}{\v!monofont :\number\c_simplefonts_monofont}
        \fi\fi\fi

        % don't create a typeface and set bodyfont when the module is loaded

        \ifconditional\c_simplefonts_done\simplefonts_bodyfont\fi

    \else

        \simplefonts_typescript{\simplefontsparameter\c!style}{#1}

        \simplefonts_typeface{#2}{#1}{#1}

    \fi

\stoptexdefinition

\starttexdefinition simplefonts_definescriptfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currenttypeface{#2}

    \presetsimplefonts[\????sf\currentsimplefont]

    \getparameters[\????sf\currentsimplefont][#4]

    \simplefonts_features{#4}\v!local % parse assignment list for font features

    \startprocesscommacommand[\c!regular]

        \simplefonts_fontfeature{#1}{##1}

        \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontsparameter{##1\s!font}","##1","\simplefontsparameter\c!weight")}

    \stopprocesscommacommand

    \ifx\currenttypeface\v!simplefonts

        \ifx\currentsimplefont\v!handwritingfont
            \global\advance\c_simplefonts_handwritingfont\plusone
            \simplefonts_scripttypescript{\simplefontsparameter\c!style}{\v!handwritingfont :\number\c_simplefonts_handwritingfont}
        \else\ifx\currentsimplefont\v!calligraphicfont
            \global\advance\c_simplefonts_calligraphicfont\plusone
            \simplefonts_scripttypescript{\simplefontsparameter\c!style}{\v!calligraphicfont:\number\c_simplefonts_calligraphicfont}
        \fi\fi

        % don't create a typeface and set bodyfont when the module is loaded

        \ifconditional\c_simplefonts_done\simplefonts_bodyfont\fi

    \else

        \simplefonts_scripttypescript{\simplefontsparameter\c!style}{#1}

        \simplefonts_typeface{#2}{#1}{#1}

    \fi

\stoptexdefinition

\starttexdefinition simplefonts_definemathfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currenttypeface{#2}

    \presetsimplefonts[\????sf\currentsimplefont]

    \getparameters[\????sf\currentsimplefont][#4]

    % no fonts are searched for the math fonts, all what happens is to normalize
    % the given name and save it in a macro is is later used to load a predefined
    % typescript

    \setvalue{\????sf\currentsimplefont\c!typeface}{\ctxlua{thirddata.simplefonts.normalizefontname("#3")}}

    \ifx\currenttypeface\v!simplefonts

        % don't create a typeface and set bodyfont when the module is loaded

        \ifconditional\c_simplefonts_done\simplefonts_bodyfont\fi

    \else

        \simplefonts_typeface{#2}{\namedsimplefontsparameter\currentsimplefont\c!typeface}{#1}

    \fi

\stoptexdefinition

\starttexdefinition simplefonts_setfallbackfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currentmainfont{#2}

    \presetsimplefonts[\????sf\currentsimplefont]

    \getparameters[\????sf\currentsimplefont][#4]

    \simplefonts_features{#4}\v!local % parse assignment list for font features

    \startprocesscommacommand[\m_simplefonts_alternative]

        \simplefonts_fontfeature{#1}{##1}

        \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontsparameter{##1\s!font}","##1","\simplefontsparameter\c!weight")}

        \simplefonts_fontfallback{#2}{#1}{##1}

    \stopprocesscommacommand

\stoptexdefinition

\starttexdefinition simplefonts_definefallbackfont [#1][#2][#3][#4]

    \edef\currentsimplefont{#1}\edef\currentmainfont{#2}

    % to allow more than one fallback font I save the settings
    % in a token register and set then all fallbacks in one turn
    
    % i should wrap this in a macro which checks if a register
    % is already defined, append the setting and flush all

    \unless\ifcsname\currentmainfont\s!fallbacks\endcsname\expandafter\newtoks\csname\currentmainfont\s!fallbacks\endcsname\fi

    \csname\currentmainfont\s!fallbacks\endcsname\expandafter{\the\expandafter\csname\currentmainfont\s!fallbacks\endcsname\simplefonts_setfallbackfont[#1][#2][#3][#4]}

    \the\expandafter\csname\currentmainfont\s!fallbacks\endcsname

    % the only way to make fallback fonts working with the module
    % is to create a new typeface and enable it as bodyfont

    % don't create a typeface or set the bodyfont when the module code is loaded

    \ifconditional\c_simplefonts_done

        \startprocesscommacommand[\m_simplefonts_commands] % why not \doifinset?

            \ifx\currentcommalistitem\currentmainfont\simplefonts_bodyfont\quitcommalist\fi

        \stopprocesscommacommand

    \fi

\stoptexdefinition

%D \macros
%D   {definefontcommand,definesubfontcommand}

\def\definefontcommand
  {\dotripleempty\dodefinefontcommand}

\def\dodefinefontcommand[#1][#2][#3]%
  {\getparameters[\????sf#1][\c!style=\v!serif,#3]%
   \processaction
     [\namedsimplefontsparameter{#1}\c!style]
     [      \v!serif=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts_definetextfont  [#1][#2]},
             \v!sans=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts_definetextfont  [#1][#2]},
             \v!mono=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts_definetextfont  [#1][#2]},
             \v!math=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts_definemathfont  [#1][#2]},
      \v!handwriting=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts_definescriptfont[#1][#2]},
      \v!calligraphy=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts_definescriptfont[#1][#2]},
          \s!unknown=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts_definetextfont  [#1][#2]}]}

\definefontcommand[\v!mainfont        ][\v!simplefonts][\c!style=\v!serif      ]
\definefontcommand[\v!sansfont        ][\v!simplefonts][\c!style=\v!sans       ]
\definefontcommand[\v!monofont        ][\v!simplefonts][\c!style=\v!mono       ]
\definefontcommand[\v!mathfont        ][\v!simplefonts][\c!style=\v!math       ]
\definefontcommand[\v!handwritingfont ][\v!simplefonts][\c!style=\v!handwriting]
\definefontcommand[\v!calligraphicfont][\v!simplefonts][\c!style=\v!calligraphy]

\def\definesubfontcommand
  {\dotripleempty\dodefinesubfontcommand}

\def\dodefinesubfontcommand[#1][#2][#3]%
  {\getparameters[\????sf#1][\c!range=,#3]%
   \setvalue{\e!set#1}{\doquadrupleempty\simplefonts_definefallbackfont[#1][#2]}}

\definesubfontcommand[\v!cjk\v!mainfont][\v!mainfont][\c!range={0x00400-0x2FA1F}]
\definesubfontcommand[\v!cjk\v!sansfont][\v!sansfont][\c!range={0x00400-0x2FA1F}]
\definesubfontcommand[\v!cjk\v!monofont][\v!monofont][\c!range={0x00400-0x2FA1F}]

\definesubfontcommand[\v!mainfont\v!fallback][\v!mainfont][\c!range=]
\definesubfontcommand[\v!sansfont\v!fallback][\v!sansfont][\c!range=]
\definesubfontcommand[\v!monofont\v!fallback][\v!monofont][\c!range=]

%D \macros
%D   {simplefont,definesimplefont}

\def\simplefont
  {\dodoubleempty\dosimplefont}

\def\dosimplefont[#1][#2]%
  {\getparameters[\????sf\v!default][\c!features=\v!default,\c!alternative=\v!regular,\c!weight=\v!normal,\c!size=,#2]%
   \edef\p_simplefont_size{\namedsimplefontsparameter\v!default\c!size}%
   \ifx\p_simplefont_size\empty\else
     \doifdimenstringelse\p_simplefont_size
       {\edef\simplefontsize{ at \p_simplefont_size}}
       {\edef\simplefontsize{    \p_simplefont_size}}%
   \fi
   \ctxlua{thirddata.simplefonts.selectfont("\v!default","#1","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}%
   \normalexpanded{\definedfont[\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures\p_simplefont_size]}}

\def\definesimplefont
  {\dotripleempty\dodefinesimplefont}

\def\dodefinesimplefont[#1][#2][#3]%
  {\getparameters[\????sf\v!default][\c!features=\v!default,\c!alternative=\v!regular,\c!weight=\v!normal,\c!size=,#3]%
   \edef\simplefontsize{\namedsimplefontsparameter\v!default\c!size}%
   \ifx\simplefontsize\empty\else
     \doifdimenstringelse\simplefontsize
       {\edef\simplefontsize{ at \simplefontsize}}
       {\edef\simplefontsize{    \simplefontsize}}%
   \fi
   \ctxlua{thirddata.simplefonts.selectfont("\v!default","#2","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}%
   \normalexpanded{\definefont[#1][\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures\simplefontsize][#3]}}

%D \macros
%D   {simplefonttypeface,definesimplefonttypeface}

\def\simplefonttypeface
  {\dodoubleempty\dosimplefonttypeface}

\def\dosimplefonttypeface[#1][#2]%
  {\global\advance\c_simplefonts_fontfamily\plusone
   \simplefonts_definetextfont[\v!fontfamily][\v!fontfamily:\number\c_simplefonts_fontfamily][#1][\c!style=\v!simplefont,#2]%
   \switchtobodyfont[\v!fontfamily:\number\c_simplefonts_fontfamily]}

\def\definesimplefonttypeface
  {\dotripleempty\dodefinesimplefonttypeface}

\def\dodefinesimplefonttypeface[#1][#2][#3]%
  {\getparameters[\????sf#1][\c!style=\v!serif,#3]%
   \processaction
     [\namedsimplefontsparameter{#1}\c!style]
     [      \v!serif=>{\simplefonts_definetextfont  [#1][#1][#2][#3]},
             \v!sans=>{\simplefonts_definetextfont  [#1][#1][#2][#3]},
             \v!mono=>{\simplefonts_definetextfont  [#1][#1][#2][#3]},
             \v!math=>{\simplefonts_definemathfont  [#1][#1][#2][#3]},
      \v!handwriting=>{\simplefonts_definescriptfont[#1][#1][#2][#3]},
      \v!calligraphy=>{\simplefonts_definescriptfont[#1][#1][#2][#3]},
          \s!unknown=>{\simplefonts_definetextfont  [#1][#1][#2][#3]}]}

%D Font extensions

\getparameters
  [\????sf\v!condensed]
  [        \c!regular={condensedregular,condregular,condensed},
            \c!italic={condenseditalic,condensedoblique,conditalic,\namedsimplefontsparameter\v!condensed\c!regular},
           \c!slanted={\namedsimplefontsparameter\v!condensed\c!italic},
              \c!bold={condensedbold,condbold,\namedsimplefontsparameter\v!condensed\c!regular},
        \c!bolditalic={condensedbolditalic,condensedboldoblique,condbolditalic,\namedsimplefontsparameter\v!condensed\c!bold},
       \c!boldslanted={\namedsimplefontsparameter\v!condensed\c!bolditalic},
              \c!caps={\namedsimplefontsparameter\v!condensed\c!regular},
        \c!italiccaps={\namedsimplefontsparameter\v!condensed\c!caps},
       \c!slantedcaps={\namedsimplefontsparameter\v!condensed\c!italiccaps},
          \c!boldcaps={\namedsimplefontsparameter\v!condensed\c!caps},
    \c!bolditaliccaps={\namedsimplefontsparameter\v!condensed\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontsparameter\v!condensed\c!bolditaliccaps}]

\getparameters
  [\????sf\v!light]
  [        \c!regular={lightregular,light},
            \c!italic={lightitalic,lightit,lightoblique,\namedsimplefontsparameter\v!light\c!regular},
           \c!slanted={\namedsimplefontsparameter\v!light\c!italic},
              \c!bold={bookregular,regular,book,\namedsimplefontsparameter\v!light\c!regular},
        \c!bolditalic={bookitalic,bookit,italic,oblique,\namedsimplefontsparameter\v!light\c!bold},
       \c!boldslanted={\namedsimplefontsparameter\v!light\c!bolditalic},
              \c!caps={smallcapslight,\namedsimplefontsparameter\v!light\c!regular},
        \c!italiccaps={\namedsimplefontsparameter\v!light\c!caps},
       \c!slantedcaps={\namedsimplefontsparameter\v!light\c!italiccaps},
          \c!boldcaps={\namedsimplefontsparameter\v!light\c!caps},
    \c!bolditaliccaps={\namedsimplefontsparameter\v!light\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontsparameter\v!light\c!bolditaliccaps}]

\getparameters
  [\????sf\v!normal]
  [        \c!regular={roman,regular,book,\empty},
            \c!italic={italic,it,oblique,kursiv,bookitalic,bookit,\namedsimplefontsparameter\v!normal\c!regular},
           \c!slanted={\namedsimplefontsparameter\v!normal\c!italic},
              \c!bold={bold,bd,kraeftig,mediumregular,semibold,demi,\namedsimplefontsparameter\v!normal\c!regular},
        \c!bolditalic={bolditalic,boldit,bdit,boldoblique,mediumitalic,semibolditalic,demiitalic,\namedsimplefontsparameter\v!normal\c!bold},
       \c!boldslanted={\namedsimplefontsparameter\v!normal\c!bolditalic},
              \c!caps={smallcaps,capitals,sc,\namedsimplefontsparameter\v!normal\c!regular},
        \c!italiccaps={\namedsimplefontsparameter\v!normal\c!caps},
       \c!slantedcaps={\namedsimplefontsparameter\v!normal\c!italiccaps},
          \c!boldcaps={scbold,\namedsimplefontsparameter\v!normal\c!caps},
    \c!bolditaliccaps={\namedsimplefontsparameter\v!normal\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontsparameter\v!normal\c!bolditaliccaps}]

\getparameters
  [\????sf\v!medium]
  [        \c!regular={mediumregular,medregular,medium},
            \c!italic={mediumitalic,meditalic,\namedsimplefontsparameter\v!medium\c!regular},
           \c!slanted={\namedsimplefontsparameter\v!medium\c!italic},
              \c!bold={heavyregular,heavy,\namedsimplefontsparameter\v!medium\c!regular},
        \c!bolditalic={heavyitalic,\namedsimplefontsparameter\v!medium\c!bold},
       \c!boldslanted={\namedsimplefontsparameter\v!medium\c!bolditalic},
              \c!caps={mediumcaps,\namedsimplefontsparameter\v!medium\c!regular},
        \c!italiccaps={\namedsimplefontsparameter\v!medium\c!caps},
       \c!slantedcaps={\namedsimplefontsparameter\v!medium\c!italiccaps},
          \c!boldcaps={\namedsimplefontsparameter\v!medium\c!caps},
    \c!bolditaliccaps={\namedsimplefontsparameter\v!medium\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontsparameter\v!medium\c!bolditaliccaps}]

\getparameters
  [\????sf\v!heavy]
  [        \c!regular={heavyregular,heavy},
            \c!italic={heavyitalic,\namedsimplefontsparameter\v!heavy\c!regular},
           \c!slanted={\namedsimplefontsparameter\v!heavy\c!italic},
              \c!bold={\namedsimplefontsparameter\v!heavy\c!regular},
        \c!bolditalic={\namedsimplefontsparameter\v!heavy\c!bold},
       \c!boldslanted={\namedsimplefontsparameter\v!heavy\c!bolditalic},
              \c!caps={\namedsimplefontsparameter\v!heavy\c!regular},
        \c!italiccaps={\namedsimplefontsparameter\v!heavy\c!caps},
       \c!slantedcaps={\namedsimplefontsparameter\v!heavy\c!italiccaps},
          \c!boldcaps={\namedsimplefontsparameter\v!heavy\c!caps},
    \c!bolditaliccaps={\namedsimplefontsparameter\v!heavy\c!boldcaps},
   \c!boldslantedcaps={\namedsimplefontsparameter\v!heavy\c!bolditaliccaps}]

\startprocesscommacommand[\m_simplefonts_weight]

    \ctxlua{thirddata.simplefonts.extlist["#1"] = { }}

    {

        \startprocesscommacommand[\m_simplefonts_alternative]

            \ctxlua{thirddata.simplefonts.extlist["#1"]["##1"] = { }}

            {

                \startprocesscommacommand[\namedsimplefontsparameter{#1}{##1}]

                    \ctxlua{table.insert(thirddata.simplefonts.extlist["#1"]["##1"],"####1")}

                \stopprocesscommacommand

            }

        \stopprocesscommacommand

    }

\stopprocesscommacommand

%D Default setup

\enabledirectives[fonts.autoreload]

\setupsimplefonts
  [\c!size=\moduleparameter\v!simplefonts\c!size,
   \c!style=\moduleparameter\v!simplefonts\c!style,
   \c!features=\v!default,
   \c!smallcapsfeatures=\v!smallcaps,
   \c!mode=\v!node,
   \c!force=\v!yes,
   \c!check=\v!no,
   \c!expansion=\v!no,
   \c!protrusion=\v!no]

%D Default fonts

\setmainfont        [Latin Modern Roman]
\setsansfont        [Latin Modern Sans]
\setmonofont        [Latin Modern Mono][\s!features=\s!none]
\setmathfont        [Latin Modern Math]
\sethandwritingfont [Latin Modern Roman] % neither handwritten nor calligraphic are available
\setcalligraphicfont[Latin Modern Roman] % for Latin Modern but I need a default font for them

\settrue\c_simplefonts_done

\stopmodule

\protect \endinput

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 21:58       ` Kip Warner
@ 2013-03-22 22:58         ` Hans Hagen
  2013-03-22 23:04           ` Kip Warner
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2013-03-22 22:58 UTC (permalink / raw)
  To: Kip Warner; +Cc: mailing list for ConTeXt users, Wolfgang Schuster

On 3/22/2013 10:58 PM, Kip Warner wrote:
> On Fri, 2013-03-22 at 22:51 +0100, Hans Hagen wrote:
>> I have no clue as I use the garden distribution. Last year most
>> mechanisms have been move to the new namespace model and I'm pretty sure
>> that Wolfgang, as he's involved in that, has adapted simplefonts so the
>> question is what version of context/simplefonts do you really run?
>
> I'm actually not sure either. But I've attached some source files
> associated with the simplefonts module which may give an indication.

It looks like something is messed up on the garden ...

http://dl.contextgarden.net/modules/t-simplefonts.zip

has a mkiv file while there should be a mkvi file but the timestamp is 
2013.

so, in your case, get rid of the t-simplefont.mkiv file to start with

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 22:58         ` Hans Hagen
@ 2013-03-22 23:04           ` Kip Warner
  2013-03-22 23:48             ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Kip Warner @ 2013-03-22 23:04 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users, Wolfgang Schuster


[-- Attachment #1.1: Type: text/plain, Size: 1007 bytes --]

On Fri, 2013-03-22 at 23:58 +0100, Hans Hagen wrote:
> It looks like something is messed up on the garden ...
> 
> http://dl.contextgarden.net/modules/t-simplefonts.zip
> 
> has a mkiv file while there should be a mkvi file but the timestamp is 
> 2013.

Hey Hans. Good eye.

> so, in your case, get rid of the t-simplefont.mkiv file to start with

I removed that file, but get the following error:

        ! Undefined control sequence.
        <argument> \????sf 
                           :\v!style :\v!serif 
        \setvalue #1->\expandafter \def \csname #1
                                                  \endcsname 
        l.256 \setvalue{\????sf:\v!style :\v!serif      }
                                                         {rm}
        E
        ? You want to edit
        file /usr/share/texmf/tex/context/third/simplefonts/t-simplefonts.mkvi at line 256

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 23:04           ` Kip Warner
@ 2013-03-22 23:48             ` Hans Hagen
  2013-03-22 23:52               ` Hans Hagen
                                 ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Hans Hagen @ 2013-03-22 23:48 UTC (permalink / raw)
  To: Kip Warner; +Cc: mailing list for ConTeXt users, Wolfgang Schuster

On 3/23/2013 12:04 AM, Kip Warner wrote:
> On Fri, 2013-03-22 at 23:58 +0100, Hans Hagen wrote:
>> It looks like something is messed up on the garden ...
>>
>> http://dl.contextgarden.net/modules/t-simplefonts.zip
>>
>> has a mkiv file while there should be a mkvi file but the timestamp is
>> 2013.
>
> Hey Hans. Good eye.
>
>> so, in your case, get rid of the t-simplefont.mkiv file to start with
>
> I removed that file, but get the following error:
>
>          ! Undefined control sequence.
>          <argument> \????sf
>                             :\v!style :\v!serif
>          \setvalue #1->\expandafter \def \csname #1
>                                                    \endcsname
>          l.256 \setvalue{\????sf:\v!style :\v!serif      }
>                                                           {rm}
>          E
>          ? You want to edit
>          file /usr/share/texmf/tex/context/third/simplefonts/t-simplefonts.mkvi at line 256

hm, only wolfgang can say what is wrong ... it looks like that module is 
a half finished transition towards a new state

i can try to fix it but it's probably better is wolfgang does that .. he 
could as well have a good file on his system

in the meantime, what you can try is to delete the mkvi file and use the 
older mkiv file (as that one seems to work)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 23:48             ` Hans Hagen
@ 2013-03-22 23:52               ` Hans Hagen
  2013-03-22 23:53                 ` Kip Warner
  2013-03-23  6:21               ` Wolfgang Schuster
  2013-03-23 22:10               ` Kip Warner
  2 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2013-03-22 23:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Kip Warner, Wolfgang Schuster

On 3/23/2013 12:48 AM, Hans Hagen wrote:
> On 3/23/2013 12:04 AM, Kip Warner wrote:
>> On Fri, 2013-03-22 at 23:58 +0100, Hans Hagen wrote:
>>> It looks like something is messed up on the garden ...
>>>
>>> http://dl.contextgarden.net/modules/t-simplefonts.zip
>>>
>>> has a mkiv file while there should be a mkvi file but the timestamp is
>>> 2013.
>>
>> Hey Hans. Good eye.
>>
>>> so, in your case, get rid of the t-simplefont.mkiv file to start with
>>
>> I removed that file, but get the following error:
>>
>>          ! Undefined control sequence.
>>          <argument> \????sf
>>                             :\v!style :\v!serif
>>          \setvalue #1->\expandafter \def \csname #1
>>                                                    \endcsname
>>          l.256 \setvalue{\????sf:\v!style :\v!serif      }
>>                                                           {rm}
>>          E
>>          ? You want to edit
>>          file
>> /usr/share/texmf/tex/context/third/simplefonts/t-simplefonts.mkvi at
>> line 256
>
> hm, only wolfgang can say what is wrong ... it looks like that module is
> a half finished transition towards a new state
>
> i can try to fix it but it's probably better is wolfgang does that .. he
> could as well have a good file on his system
>
> in the meantime, what you can try is to delete the mkvi file and use the
> older mkiv file (as that one seems to work)

btw, we need to figure out how the mkvi work in progress file ended up 
on your machine

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 23:52               ` Hans Hagen
@ 2013-03-22 23:53                 ` Kip Warner
  0 siblings, 0 replies; 13+ messages in thread
From: Kip Warner @ 2013-03-22 23:53 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users, Reviczky Adam


[-- Attachment #1.1: Type: text/plain, Size: 1863 bytes --]

On Sat, 2013-03-23 at 00:52 +0100, Hans Hagen wrote:
> On 3/23/2013 12:48 AM, Hans Hagen wrote:
> > On 3/23/2013 12:04 AM, Kip Warner wrote:
> >> On Fri, 2013-03-22 at 23:58 +0100, Hans Hagen wrote:
> >>> It looks like something is messed up on the garden ...
> >>>
> >>> http://dl.contextgarden.net/modules/t-simplefonts.zip
> >>>
> >>> has a mkiv file while there should be a mkvi file but the timestamp is
> >>> 2013.
> >>
> >> Hey Hans. Good eye.
> >>
> >>> so, in your case, get rid of the t-simplefont.mkiv file to start with
> >>
> >> I removed that file, but get the following error:
> >>
> >>          ! Undefined control sequence.
> >>          <argument> \????sf
> >>                             :\v!style :\v!serif
> >>          \setvalue #1->\expandafter \def \csname #1
> >>                                                    \endcsname
> >>          l.256 \setvalue{\????sf:\v!style :\v!serif      }
> >>                                                           {rm}
> >>          E
> >>          ? You want to edit
> >>          file
> >> /usr/share/texmf/tex/context/third/simplefonts/t-simplefonts.mkvi at
> >> line 256
> >
> > hm, only wolfgang can say what is wrong ... it looks like that module is
> > a half finished transition towards a new state
> >
> > i can try to fix it but it's probably better is wolfgang does that .. he
> > could as well have a good file on his system
> >
> > in the meantime, what you can try is to delete the mkvi file and use the
> > older mkiv file (as that one seems to work)

I'll give that a try. Thanks Hans.

> btw, we need to figure out how the mkvi work in progress file ended up 
> on your machine
> 
> Hans

I've cc'd the packager who might now.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 23:48             ` Hans Hagen
  2013-03-22 23:52               ` Hans Hagen
@ 2013-03-23  6:21               ` Wolfgang Schuster
  2013-03-23 22:10               ` Kip Warner
  2 siblings, 0 replies; 13+ messages in thread
From: Wolfgang Schuster @ 2013-03-23  6:21 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Kip Warner, mailing list for ConTeXt users


Am 23.03.2013 um 00:48 schrieb Hans Hagen <pragma@wxs.nl>:

> On 3/23/2013 12:04 AM, Kip Warner wrote:
>> On Fri, 2013-03-22 at 23:58 +0100, Hans Hagen wrote:
>>> It looks like something is messed up on the garden ...
>>> 
>>> http://dl.contextgarden.net/modules/t-simplefonts.zip
>>> 
>>> has a mkiv file while there should be a mkvi file but the timestamp is
>>> 2013.
>> 
>> Hey Hans. Good eye.
>> 
>>> so, in your case, get rid of the t-simplefont.mkiv file to start with
>> 
>> I removed that file, but get the following error:
>> 
>>         ! Undefined control sequence.
>>         <argument> \????sf
>>                            :\v!style :\v!serif
>>         \setvalue #1->\expandafter \def \csname #1
>>                                                   \endcsname
>>         l.256 \setvalue{\????sf:\v!style :\v!serif      }
>>                                                          {rm}
>>         E
>>         ? You want to edit
>>         file /usr/share/texmf/tex/context/third/simplefonts/t-simplefonts.mkvi at line 256
> 
> hm, only wolfgang can say what is wrong ... it looks like that module is a half finished transition towards a new state

I stopped with the conversion from MkIV to MkVI of the module midway because
the whole code is a mess and just changing macro names and using the command
handler doesn’t help to improve. it.

> i can try to fix it but it's probably better is wolfgang does that .. he could as well have a good file on his system

I have a rewritten version of the code on my system but it still lacks a few features.

It was written from scratch and is cleaner, supports optical sizes and uses the spec
information to find fonts but gives not always the same results because of wrong
information is fonts (e.g. the width is stored as medium instead of normal or bold).

> in the meantime, what you can try is to delete the mkvi file and use the older mkiv file (as that one seems to work)

The MkVI file was never part of the package on the garden, I have the file only on
my system and you can find it in the public repository on bitbucket (online source hoster).

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: 2013.03.21 broken nightly?
  2013-03-22 23:48             ` Hans Hagen
  2013-03-22 23:52               ` Hans Hagen
  2013-03-23  6:21               ` Wolfgang Schuster
@ 2013-03-23 22:10               ` Kip Warner
  2013-07-14  7:59                 ` 2013.07.12 " Kip Warner
  2 siblings, 1 reply; 13+ messages in thread
From: Kip Warner @ 2013-03-23 22:10 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users, Wolfgang Schuster


[-- Attachment #1.1: Type: text/plain, Size: 507 bytes --]

On Sat, 2013-03-23 at 00:48 +0100, Hans Hagen wrote:
> in the meantime, what you can try is to delete the mkvi file and use the 
> older mkiv file (as that one seems to work)

Thanks Hans. I gave it a try but it bails on further errors. I think the
safest thing to do at this point is to just wait until it's resolved.
I'm not in any rush and I can always roll back the deb I have installed.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* 2013.07.12 broken nightly?
  2013-03-23 22:10               ` Kip Warner
@ 2013-07-14  7:59                 ` Kip Warner
  0 siblings, 0 replies; 13+ messages in thread
From: Kip Warner @ 2013-07-14  7:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen, Wolfgang Schuster


[-- Attachment #1.1: Type: text/plain, Size: 1242 bytes --]

Hey list,

I've observed what I suspect is a broken nightly (2013.07.12) while
attempting to typeset my book.

        ! LuaTeX
        error /usr/share/texmf/tex/context/base/strc-ref.lua:2027:
        attempt to index a nil value
        stack traceback:
        /usr/share/texmf/tex/context/base/strc-ref.lua:2027: in function
        'realpageofpage'
        /usr/share/texmf/tex/context/base/lpdf-ano.lua:473: in function
        'handler'
        /usr/share/texmf/tex/context/base/lpdf-ano.lua:414: in function
        'action'
        /usr/share/texmf/tex/context/base/lpdf-ano.lua:193: in function
        'pdfaction'
        /usr/share/texmf/tex/context/base/lpdf-ano.lua:220: in function
        'prerollreference'
        /usr/share/texmf/tex/context/base/node-ref.lua:390: in function
        'setreference'
        /usr/share/texmf/tex/context/base/node-ref.lua:542: in function
        'injectreference'
        [string "\directlua "]:1: in main chunk.
        \ctxcommand #1^^@-\directlua {commands.#1}

Respectfully,

PS Please copy me if you remember, as I am not currently a subscriber.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-07-14  7:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-22 20:00 2013.03.21 broken nightly? Kip Warner
2013-03-22 20:56 ` Hans Hagen
2013-03-22 21:35   ` Kip Warner
2013-03-22 21:51     ` Hans Hagen
2013-03-22 21:58       ` Kip Warner
2013-03-22 22:58         ` Hans Hagen
2013-03-22 23:04           ` Kip Warner
2013-03-22 23:48             ` Hans Hagen
2013-03-22 23:52               ` Hans Hagen
2013-03-22 23:53                 ` Kip Warner
2013-03-23  6:21               ` Wolfgang Schuster
2013-03-23 22:10               ` Kip Warner
2013-07-14  7:59                 ` 2013.07.12 " Kip Warner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).