diff options
-rw-r--r-- | Master/texmf-dist/doc/context/third/simplefonts/README | 58 | ||||
-rw-r--r-- | Master/texmf-dist/doc/context/third/simplefonts/simplefonts.pdf | bin | 12262 -> 67868 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/context/third/simplefonts/doc/simplefonts.tex | 57 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua | 351 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.tex | 1878 |
5 files changed, 1042 insertions, 1302 deletions
diff --git a/Master/texmf-dist/doc/context/third/simplefonts/README b/Master/texmf-dist/doc/context/third/simplefonts/README index 98e8fa1dbd5..d7af4543a4b 100644 --- a/Master/texmf-dist/doc/context/third/simplefonts/README +++ b/Master/texmf-dist/doc/context/third/simplefonts/README @@ -1,50 +1,36 @@ -Mit dem 'simplefonts' Modul ist es möglich Schriften in der gleichen -Weise wie mit dem 'fontspec' Paket für LaTeX einzustellen. Den Benutzern -stehen dafür die folgenden Befehle zu Verfügung. +Modulename : t-simplefonts +Author : Wolfgang Schuster +License : Public Domain +Description +----------- -Die globalen Schriften werden mit den 3 Befehlen +The 'simplefonts' module provides a interface to use fonts in ConTeXt MkIV +in similar way as you can do with the 'fontspec' package for XeLaTeX. - \setmainfont[..,..=..,..]{...} - \setsansfont[..,..=..,..]{...} - \setmonofont[..,..=..,..]{...} +Usage +----- -eingestellt. +The module is loaded in the document with: + \usemodule[simplefonts] -Neue Familien können mit dem Befehl +The global fonts can be set with the following three commands: - \newfontfamiliy\name[..,..=..,..]{...} + \setmainfont[...][..,..=..,..] + \setsansfont[...][..,..=..,..] + \setmonofont[...][..,..=..,..] -erstellt werden, der auch die enstpechenden Style für Kursiv und Fett -erstellt und \definetypeface in ConTeXt entspricht. +A single typeface can bet set with the command: + \definefontfamily[...][...][..,..=..,..] -Mit dem letzten Befehl +With the command - \newfontface\name[..,..=..,..]{...} + \definesimplefont[...][..,..=..,..] -wird nur eine einzige Schrift ohne zusätzliche Schnitte erstellt, was dem -\definefont Befehl in ConTeXt entspricht. +you can define a single font for the use in header or other style elements and the last commmand + \simplefont[...][..,..=..,..] -Wenn eine Schrift keinen normalen Kursiven oder fetten Schnitt enthält kann -bei den einzelnen Befehlen festgelegt werden, welche andere Schrift benutzt -werden soll, die Parameter dafür sind - - - UprightFont - - ItalicFont - - BoldFont - - BoldItalicFont - - SmallCapsFont - -Dabei kann als Argument entweder ein vollständiger Name für eine Ersatzschrift -angegeben werden, mit einem '*' im Argument wird dagegen eine Schrift gewählt -die mit dem gleichen Namen der normale Schrift gewählt. - - -Zusätzliche Parameter für die Optionen: - - - Scale - - features (ConTeXt) - - fallbacks/range (ConTeXt) +is for inline use and acts like \definedfont. diff --git a/Master/texmf-dist/doc/context/third/simplefonts/simplefonts.pdf b/Master/texmf-dist/doc/context/third/simplefonts/simplefonts.pdf Binary files differindex 35dd3cfbcea..8bcb996910c 100644 --- a/Master/texmf-dist/doc/context/third/simplefonts/simplefonts.pdf +++ b/Master/texmf-dist/doc/context/third/simplefonts/simplefonts.pdf diff --git a/Master/texmf-dist/source/context/third/simplefonts/doc/simplefonts.tex b/Master/texmf-dist/source/context/third/simplefonts/doc/simplefonts.tex index 63e535a8747..27f588f22a6 100644 --- a/Master/texmf-dist/source/context/third/simplefonts/doc/simplefonts.tex +++ b/Master/texmf-dist/source/context/third/simplefonts/doc/simplefonts.tex @@ -1,37 +1,46 @@ \usemodule[simplefonts][size=11pt] -\setmainfont[Luxi Serif] -\setmonofont[Luxi Mono] +\setmainfont[DejaVu Serif] +\setsansfont[DejaVu Sans] +\setmonofont[DejaVu Sans Mono] \starttext -\starttyping -\definefontcommand[<command>][<typeface>][..,..=..,..] -\stoptyping - -\starttyping -\definesubfontcommand[<command>][<fontgroup>][..,..=..,..] -\stoptyping +\title{The {\em simplefonts} module} -\starttyping -\definefontfamily[<command>[<font>][..,..=..,..] -\stoptyping +Writing typescripts for \ConTeXt\ can be a tedious job, … \starttyping \simplefont[<font>][..,..=..,..] \stoptyping -\starttyping -\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 ] -\stoptyping - -\starttyping -\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}] -\stoptyping +\startlines +{\simplefont[TeX Gyre Pagella]TeX Gyre Pagella} +{\simplefont[TeX Gyre Termes]TeX Gyre Termes} +{\simplefont[TeX Gyre Heros]TeX Gyre Heros} +{\simplefont[TeX Gyre Bonum]TeX Gyre Bonum} +{\simplefont[TeX Gyre Schola]TeX Gyre Schola} +{\simplefont[TeX Gyre Adventor]TeX Gyre Adventor} +{\simplefont[TeX Gyre Cursor]TeX Gyre Cursor} +{\simplefont[TeX Gyre Chorus]TeX Gyre Chorus} +\stoplines + +\startluacode + +local styles = { "regular", "italic", "bold", "bolditalic" } + +tex.sprint(tex.ctxcatcodes,"\\starttabulate[|l|b{\\nohyphens}p|]") +tex.sprint(tex.ctxcatcodes,"\\NC \\bf style \\NC\\bf extension \\NC\\NR") +for _, style in global.ipairs(styles) do + tex.sprint(tex.ctxcatcodes,"\\NC " .. style .. "\\NC ") + for _, extension in global.ipairs(thirddata.simplefonts.extlist["normal"][style]) do + tex.sprint(tex.ctxcatcodes,extension .. " ") + global.print(extension) + end + tex.sprint(tex.ctxcatcodes," \\NC\\NR") +end +tex.sprint(tex.ctxcatcodes,"\\stoptabulate") + +\stopluacode \stoptext diff --git a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua new file mode 100644 index 00000000000..d920fe4242d --- /dev/null +++ b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua @@ -0,0 +1,351 @@ +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 = "Public Domain" +} + +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.parameters = simplefonts.parameters or { } +simplefonts.features = simplefonts.features 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" , + } , + } , +} + +--~ for k,v in next, global.fonts.otf.tables.features do +--~ v = lower(gsub(gsub(gsub(v,"#",""),"-","")," ","")) +--~ simplefonts.features[v] = lower(gsub(k," ","")) +--~ end + +simplefonts.features = { + ['accessallalternates'] = 'aalt', + ['abovebaseforms'] = 'abvf', + ['abovebasemarkpositioning'] = 'abvm', + ['abovebasesubstitutions'] = 'abvs', + ['alternativefractions'] = 'afrc', + ['akhands'] = 'akhn', + ['belowbaseforms' ] = 'blwf', + ['belowbasemarkpositioning'] = 'blwm', + ['belowbasesubstitutions'] = 'blws', + ['petitecapitalsfromcapitals'] = 'c2pc', + ['smallcapitalsfromcapitals'] = 'c2sc', + ['contextualalternates'] = 'calt', + ['casesensitiveforms'] = 'case', + ['glyphcompositiondecomposition'] = 'ccmp', + ['conjunctforms'] = 'cjct', + ['contextualligatures'] = 'clig', + ['capitalspacing'] = 'cpsp', + ['contextualswash'] = 'cswh', + ['cursivepositioning'] = 'curs', + ['defaultprocessing'] = 'dflt', + ['distances'] = 'dist', + ['discretionaryligatures'] = 'dlig', + ['denominators'] = 'dnom', + ['dotlessforms'] = 'dtls', + ['expertforms'] = 'expt', + ['finalglyphalternates'] = 'falt', + ['terminalforms2'] = 'fin2', + ['terminalforms3'] = 'fin3', + ['terminalforms'] = 'fina', + ['flattenedaccentsovercapitals'] = 'flac', + ['fractions'] = 'frac', + ['fullwidth'] = 'fwid', + ['halfforms'] = 'half', + ['halantforms'] = 'haln', + ['alternatehalfwidth'] = 'halt', + ['historicalforms'] = 'hist', + ['horizontalkanaalternates'] = 'hkna', + ['historicalligatures'] = 'hlig', + ['hangul'] = 'hngl', + ['hojokanjiforms'] = 'hojo', + ['halfwidth'] = 'hwid', + ['initialforms'] = 'init', + ['isolatedforms'] = 'isol', + ['italics'] = 'ital', + ['justificationalternatives'] = 'jalt', + ['jis2004forms'] = 'jp04', + ['jis78forms'] = 'jp78', + ['jis83forms'] = 'jp83', + ['jis90forms'] = 'jp90', + ['kerning'] = 'kern', + ['leftbounds'] = 'lfbd', + ['standardligatures'] = 'liga', + ['leadingjamoforms'] = 'ljmo', + ['liningfigures'] = 'lnum', + ['localizedforms'] = 'locl', + ['markpositioning'] = 'mark', + ['medialforms2'] = 'med2', + ['medialforms'] = 'medi', + ['mathematicalgreek'] = 'mgrk', + ['marktomarkpositioning'] = 'mkmk', + ['markpositioningviasubstitution'] = 'mset', + ['alternateannotationforms'] = 'nalt', + ['nlckanjiforms'] = 'nlck', + ['nuktaforms'] = 'nukt', + ['numerators'] = 'numr', + ['oldstylefigures'] = 'onum', + ['opticalbounds'] = 'opbd', + ['ordinals'] = 'ordn', + ['ornaments'] = 'ornm', + ['proportionalalternatewidth'] = 'palt', + ['petitecapitals'] = 'pcap', + ['proportionalfigures'] = 'pnum', + ['prebaseforms'] = 'pref', + ['prebasesubstitutions'] = 'pres', + ['postbaseforms'] = 'pstf', + ['postbasesubstitutions'] = 'psts', + ['proportionalwidths'] = 'pwid', + ['quarterwidths'] = 'qwid', + ['randomize'] = 'rand', + ['rakarforms'] = 'rkrf', + ['requiredligatures'] = 'rlig', + ['rephform'] = 'rphf', + ['rightbounds'] = 'rtbd', + ['righttoleftalternates'] = 'rtla', + ['rubynotationforms'] = 'ruby', + ['stylisticalternates'] = 'salt', + ['scientificinferiors'] = 'sinf', + ['opticalsize'] = 'size', + ['smallcapitals'] = 'smcp', + ['simplifiedforms'] = 'smpl', + ['stylisticset1'] = 'ss01', + ['stylisticset2'] = 'ss02', + ['stylisticset3'] = 'ss03', + ['stylisticset4'] = 'ss04', + ['stylisticset5'] = 'ss05', + ['stylisticset6'] = 'ss06', + ['stylisticset7'] = 'ss07', + ['stylisticset8'] = 'ss08', + ['stylisticset9'] = 'ss09', + ['stylisticset10'] = 'ss10', + ['stylisticset11'] = 'ss11', + ['stylisticset12'] = 'ss12', + ['stylisticset13'] = 'ss13', + ['stylisticset14'] = 'ss14', + ['stylisticset15'] = 'ss15', + ['stylisticset16'] = 'ss16', + ['stylisticset17'] = 'ss17', + ['stylisticset18'] = 'ss18', + ['stylisticset19'] = 'ss19', + ['stylisticset20'] = 'ss20', + ['scriptstyle'] = 'ssty', + ['subscript'] = 'subs', + ['superscript'] = 'sups', + ['swash'] = 'swsh', + ['titling'] = 'titl', + ['trailingjamoforms'] = 'tjmo', + ['traditionalnameforms'] = 'tnam', + ['tabularfigures'] = 'tnum', + ['traditionalforms'] = 'trad', + ['thirdeidths'] = 'twid', + ['unicase'] = 'unic', + ['alternateverticalmetrics'] = 'valt', + ['vattuvariants'] = 'vatu', + ['verticalwriting'] = 'vert', + ['alternateverticalhalfmetrics'] = 'vhal', + ['voweljamoforms'] = 'vjmo', + ['verticalkanaalternates'] = 'vkna', + ['verticalkerning'] = 'vkrn', + ['proportionalalternateverticalmetrics'] = 'vpal', + ['verticalrotation'] = 'vrt2', + ['slashedzero'] = 'zero', + -- context only features + ['traditionaltexreplacements'] = 'trep', + ['traditionaltexligatures'] = 'tlig', +} + +function simplefonts.selectfont(font,name,extension,style,weight) + local fontname = {} + local name = lower(gsub(gsub(name," ",""),"-","")) + if extension ~= "" then + ext = find(extension,"*") + if ext ~= nil then + fontname = gsub(extension,"*",name) + else + fontname = extension + end + fontname = "name:" .. lower(gsub(fontname," ","")) + else + if 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 + --~ texsprint(prtcatcodes,format("\\showmessage\\m!simplefonts{1}{%s}",fontname)) + fontname = "DefaultFont" -- no font is found + end + end + end + end + --~ print(fontname) + if fontname == "DefaultFont" then + texsprint(prtcatcodes,format("\\showmessage\\m!simplefonts{1}{%s}",name)) + end + texsprint(prtcatcodes,format("\\setvalue{\\????sf %s%s}{%s}",font,style,fontname)) +end + +function simplefonts.normalizefontname(name) + local fontname = lower(gsub(gsub(name," ",""),"-","")) -- remove spaces and hyphens from the user specified name + texsprint(ctxcatcodes,fontname) +end + +function simplefonts.parameter(key,value,list) + local features = simplefonts.features[key] + local parameters = simplefonts.parameters[key] + if features then + texsprint(format("\\addvalue{%s}{%s=%s}",list,features,value)) + --~ print(features .. "=" .. value) + else + if not parameters then + texsprint(prtcatcodes,format("\\showmessage\\m!simplefonts{2}{%s}",key)) + end + end +end diff --git a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.tex b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.tex index 31a779f5f02..3f9ecc026fe 100644 --- a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.tex +++ b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.tex @@ -1,70 +1,100 @@ %D \module -%D [ file=t-simplefonts, -%D version=2009.06.13, -%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=Public Domain] - -\writestatus{loading}{Context User Module / Simplefonts} +%D [ file=t-simplefonts, +%D version=2009.08.01, +%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=Public Domain] + +\writestatus{loading}{ConTeXt User Module / Simplefonts} \unprotect %D Constants and variables \startinterface all - \setinterfaceconstant {regular} {regular} - \setinterfaceconstant {italic} {italic} - \setinterfaceconstant {bold} {bold} - \setinterfaceconstant {bolditalic} {bolditalic} - \setinterfaceconstant {caps} {caps} - \setinterfaceconstant {italiccaps} {italiccaps} - \setinterfaceconstant {boldcaps} {boldcaps} - \setinterfaceconstant {bolditaliccaps} {bolditaliccaps} - \setinterfaceconstant {scale} {scale} - \setinterfaceconstant {range} {range} - \setinterfaceconstant {weight} {weight} - \setinterfaceconstant {features} {features} - \setinterfaceconstant {regularfeatures} {regularfeatures} - \setinterfaceconstant {italicfeatures} {italicfeatures} - \setinterfaceconstant {boldfeatures} {boldfeatures} - \setinterfaceconstant {bolditalicfeatures} {bolditalicfeatures} - \setinterfaceconstant {smallcapsfeatures} {smallcapsfeatures} - \setinterfaceconstant {capsfeatures} {capsfeatures} - \setinterfaceconstant {italiccapsfeatures} {italiccapsfeatures} - \setinterfaceconstant {boldcapsfeatures} {boldcapsfeatures} - \setinterfaceconstant {bolditaliccapsfeatures} {bolditaliccapsfeatures} + \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 {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 {sf} {sf} \stopinterface \startinterface all - \setinterfacevariable {simplefonts} {simplefonts} - \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 {caps} {caps} - \setinterfacevariable {italiccaps} {italiccaps} - \setinterfacevariable {boldcaps} {boldcaps} - \setinterfacevariable {bolditaliccaps} {bolditaliccaps} - \setinterfacevariable {cjk} {cjk} - \setinterfacevariable {fallback} {fallback} + \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 {every} {every} + \setinterfacevariable {feature} {feature} + \setinterfacevariable {handwriting} {handwriting} + \setinterfacevariable {fontfamily} {fontfamily} \stopinterface \startinterface all - \setinterfaceelement {set} {set} + \setinterfaceelement {set} {set} \stopinterface +%D System constants + +\definesystemconstant {Handwriting} +\definesystemconstant {Calligraphic} +\definesystemconstant {Simplefont} + +%D Lua code + +\ctxloadluafile{t-simplefonts}{} + +%D Module code + \startmodule[\v!simplefonts] \setupmodule - [ \c!size=\!!twelvepoint, + [\c!size=\!!twelvepoint, \c!style=\c!rm] %D Messages @@ -74,1297 +104,661 @@ \startinterface all \setinterfacemessage{simplefonts}{title}{simplefonts} \setinterfacemessage{simplefonts}{1} {font -- not found} + \setinterfacemessage{simplefonts}{2} {feature -- is not defined} \stopinterface %D Namespace \def\????sf{@@@@sf} -\def\s!Upright{} +%D Counter + +\newcounter\simplefonts!typeface +\newcounter\simplefonts!fontfamily + +%D Boolean + +\newif\if!!donesimplefonts + +%D Tracing + +\let\enablesimplefonts \!!donesimplefontstrue +\let\disablesimplefonts\!!donesimplefontsfalse + +%D Comma value lists -\def\sfparameter#1{\csname\????sf\@@sf@@#1\endcsname} +\letempty\simplefont!features +\letempty\simplefont!localfeatures +\letempty\simplefont!globalfeatures -\newif\ifdonesimplefonts +\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} + +\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} + +\def\simplefonts!parameters + {\c!regular,\c!italic,\c!slanted,\c!bold,\c!bolditalic,\c!boldslanted,\c!caps, + \c!italiccaps,\c!slantedcaps,\c!boldcaps,\c!bolditaliccaps,\c!boldslantedcaps, + \c!features,\c!regularfeatures,\c!italicfeatures,\c!slantedfeatures,\c!size,\c!style, + \c!boldfeatures,\c!bolditalicfeatures,\c!boldslantedfeatures,\c!smallcapsfeatures, + \c!capsfeatures,\c!italiccapsfeatures,\c!slantedcapsfeatures,\c!boldcapsfeatures, + \c!bolditaliccapsfeatures,\c!boldslantedcapsfeatures,\c!weight,\c!scale,\c!range} + +%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 Internal helper macros + +\def\simplefontparameter #1{\csname\????sf\currentsimplefont#1\endcsname} +\def\namedsimplefontparameter#1#2{\csname\????sf #1#2\endcsname} \def\setupsimplefonts - {\dosingleargument\dosetupsimplefonts} + {\dosingleempty\dosetupsimplefonts} + +\def\dosetupsimplefonts[#1]% first argument is optional + {\iffirstargument + \getparameters[\????sf][#1]% + \simplefonts@features{#1}\v!global + \fi + \if!!donesimplefonts + \doglobal\increment\simplefonts!typeface + \simplefonts@family {\v!simplefonts:\simplefonts!typeface}% + \simplefonts@bodyfont{\v!simplefonts:\simplefonts!typeface}% + \fi} + +\def\presetsimplefonts[#1]% + {\getparameters + [#1] + [\c!regular=, + \c!italic=, + \c!slanted=, + \c!bold=, + \c!bolditalic=, + \c!boldslanted=, + \c!caps=, + \c!italiccaps=, + \c!slantedcaps=, + \c!boldcaps=, + \c!bolditaliccaps=, + \c!boldslantedcaps=, + \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!scale=1.0]} + +\letvalue{\????sf:\v!style :\v!serif }\c!rm +\letvalue{\????sf:\v!style :\v!sans }\c!ss +\letvalue{\????sf:\v!style :\v!mono }\c!tt +\letvalue{\????sf:\v!style :\v!math }\c!mm +\letvalue{\????sf:\v!style :\v!handwriting }\c!hw +\letvalue{\????sf:\v!style :\v!calligraphic}\c!cg +\letvalue{\????sf:\v!style :\v!simplefont }\c!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!calligraphic}\s!Calligraphic +\letvalue{\????sf:\v!suffix:\v!simplefont }\s!Simplefont -\def\dosetupsimplefonts[#1]% - {\getparameters[\????sf][#1]% - \ifdonesimplefonts\sf@setupbodyfont\fi} +\setvalue{\????sf:\v!math:latinmodernmath}{modern} + +\def\sf@style #1{\csname\????sf:\v!style :#1\endcsname} +\def\sf@suffix#1{\csname\????sf:\v!suffix:#1\endcsname} +\def\sf@math #1{\csname\????sf:\v!math :#1\endcsname} + +\starttexdefinition simplefonts@typeface #1#2#3 -\def\sf@stylelist - {\v!regular,\v!italic,\v!bold,\v!bolditalic,\v!caps,\v!italiccaps,\v!boldcaps,\v!bolditaliccaps} + \definetypeface + [#1] + [\sf@style{\namedsimplefontparameter{#3}\c!style}] + [\namedsimplefontparameter{#3}\c!style] + [#2] + [\s!default] + [rscale=\namedsimplefontparameter{#3}\c!scale] -\setvalue{\????sf:\c!family:\v!serif}{\c!rm } -\setvalue{\????sf:\c!family:\v!sans }{\c!ss } -\setvalue{\????sf:\c!family:\v!mono }{\c!tt } -\setvalue{\????sf:\c!family:\v!math }{\c!mm } +\stoptexdefinition -\setvalue{\????sf:\c!style :\v!serif}{\s!Serif} -\setvalue{\????sf:\c!style :\v!sans }{\s!Sans } -\setvalue{\????sf:\c!style :\v!mono }{\s!Mono } +\starttexdefinition simplefonts@family #1 -\def\sf@family#1{\csname\????sf:\c!family:#1\endcsname} -\def\sf@style #1{\csname\????sf:\c!style :#1\endcsname} + \simplefonts@typeface{#1}{\v!mainfont }{\v!mainfont } + \simplefonts@typeface{#1}{\v!sansfont }{\v!sansfont } + \simplefonts@typeface{#1}{\v!monofont }{\v!monofont } + \simplefonts@typeface{#1}{\namedsimplefontparameter\v!mathfont\c!typeface}{\v!mathfont } + \simplefonts@typeface{#1}{\v!handwritingfont }{\v!handwritingfont } + \simplefonts@typeface{#1}{\v!calligraphicfont }{\v!calligraphicfont} -% #1: typefacename #2: style #3: typescriptname +\stoptexdefinition -\starttexdefinition sf@typescript #1#2 +\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 } - \sf@definefontsynonym{\sf@style{#1}\s!Upright }{\v!regular } - \sf@definefontsynonym{\sf@style{#1}\s!Italic }{\v!italic } - \sf@definefontsynonym{\sf@style{#1}\s!Bold }{\v!bold } - \sf@definefontsynonym{\sf@style{#1}\s!BoldItalic }{\v!bolditalic } - - \sf@definefontsynonym{\sf@style{#1}\s!Caps }{\v!caps } - \sf@definefontsynonym{\sf@style{#1}\s!Italic\s!Caps }{\v!italiccaps } - \sf@definefontsynonym{\sf@style{#1}\s!Bold\s!Caps }{\v!boldcaps } - \sf@definefontsynonym{\sf@style{#1}\s!BoldItalic\s!Caps}{\v!bolditaliccaps} - + \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 sf@definefontsynonym #1#2 +\starttexdefinition simplefonts@fontsynonym #1#2 \@NX\definefontsynonym [#1] - [\sfparameter{#2}] - [\s!fallbacks=\????sf\@@sf@@#2\s!fallbacks, - \s!features=\sfparameter{#2\s!features}] + [\simplefontparameter{#2}] + [\s!fallbacks=\currentsimplefont#2\s!fallbacks, + \s!features=\currentsimplefont#2\s!features ] \stoptexdefinition -\starttexdefinition sf@definetypeface #1#2#3 +\starttexdefinition simplefonts@fontfallback #1#2#3 - \expanded{\definetypeface[#1][\sf@family{#2}][#2][#3][\v!default][\s!rscale=\sfparameter\c!scale]} + \definefontfallback + [#1#3\s!fallbacks] + [\namedsimplefontparameter{#2}{#3}*#2#3\s!features] + [\namedsimplefontparameter{#2}\c!range] + [\s!rscale=\namedsimplefontparameter{#2}\c!scale] \stoptexdefinition -\setvalue{\????sf:\v!value:\v!serif}{\v!mainfont} -\setvalue{\????sf:\v!value:\v!sans }{\v!sansfont} -\setvalue{\????sf:\v!value:\v!mono }{\v!monofont} -\setvalue{\????sf:\v!value:\v!math }{\v!mathfont} +\starttexdefinition simplefonts@bodyfont #1 -\setvalue{\????sf:\v!type :\v!serif}{\v!mainfont} -\setvalue{\????sf:\v!type :\v!sans }{\v!sansfont} -\setvalue{\????sf:\v!type :\v!mono }{\v!monofont} -\setvalue{\????sf:\v!type :\v!math }{\getvalue{\????sf\v!mathfont}} + \setupbodyfont[#1,\@@@@sfstyle,\@@@@sfsize] -\newcounter\sf!fontfamily +\stoptexdefinition -\def\sf@definefontfamily - {\doglobal\increment\sf!fontfamily - \processcommalist[\v!serif,\v!sans,\v!mono,\v!math]\sf@dodefinefontfamily} +\starttexdefinition simplefonts@fontfeature #1#2 -\starttexdefinition sf@dodefinefontfamily #1 + \letempty\simplefont!features - \startexpanded + % expansion and protrusion could bet se either global for all styles or local for only one style - \@NX\definetypeface - [\v!simplefonts:\sf!fontfamily] - [\sf@family{#1}] - [#1] - [\getvalue{\????sf:\v!type:#1}] - [\v!default] - [\s!rscale=\getvalue{\????sf\getvalue{\????sf:\v!value:#1}\c!scale}] + \doifdefined{\????sf\c!expansion }{\appendtocommalist{\c!expansion =\namedsimplefontparameter{#1}\c!expansion }\simplefont!features} + \doifdefined{\????sf\c!protrusion }{\appendtocommalist{\c!protrusion=\namedsimplefontparameter{#1}\c!protrusion}\simplefont!features} - \stopexpanded + \doifdefined{\????sf#1\c!expansion }{\appendtocommalist{\c!expansion =\namedsimplefontparameter{#1}\c!expansion }\simplefont!features} + \doifdefined{\????sf#1\c!protrusion}{\appendtocommalist{\c!protrusion=\namedsimplefontparameter{#1}\c!protrusion}\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 -\def\sf@setupbodyfont - {\setupbodyfont[\v!simplefonts:\sf!fontfamily,\@@@@sfstyle,\@@@@sfsize]} +\long\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist + {\long\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% + \processassignmentlist[#1]\currentassignmentlistcommand} -\def\sf@definetextfont[#1][#2][#3][#4]% - {\edef\@@sf@@{#1}% - \getparameters - [\????sf#1] - [\c!regular=, - \c!italic=, - \c!bold=, - \c!bolditalic=, - \c!caps=, - \c!italiccaps=, - \c!boldcaps=, - \c!bolditaliccaps=, - \c!features=\v!default, - \c!regularfeatures=\sfparameter\c!features, - \c!italicfeatures=\sfparameter\c!features, - \c!boldfeatures=\sfparameter\c!features, - \c!bolditalicfeatures=\sfparameter\c!features, - \c!smallcapsfeatures=\v!smallcaps, - \c!capsfeatures=\sfparameter\c!smallcapsfeatures, - \c!italiccapsfeatures=\sfparameter\c!smallcapsfeatures, - \c!boldcapsfeatures=\sfparameter\c!smallcapsfeatures, - \c!bolditaliccapsfeatures=\sfparameter\c!smallcapsfeatures, - \c!weight=\v!normal, - \c!scale=1.0, - #4]% - \def\sf@dodefinetextfont##1{\modulecode{simplefonts.selectfont("#1","#3","\sfparameter{##1}","##1","\sfparameter\c!weight")}}% - \processcommacommand[\sf@stylelist]\sf@dodefinetextfont - \sf@typescript{\sfparameter\c!style}{#1}% - \doifelse{#2}\v!simplefonts - {\ifdonesimplefonts\sf@definefontfamily\sf@setupbodyfont\fi} - {\sf@definetypeface{#2}{\sfparameter\c!style}{#1}}} - -\def\sf@definemathfont[#1][#2][#3][#4]% - {\edef\@@sf@@{#1}% - \getparameters[\????sf#1][\c!scale=1.0,#4]% - %\sf@definetypeface{#2}{\sfparameter\c!style}{\sf@mathtypeface{#3}}% - \setvalue{\????sf\v!mathfont}{\sf@mathtypeface{#3}}% - \doifelse{#2}\v!simplefonts - {\ifdonesimplefonts\sf@definefontfamily\sf@setupbodyfont\fi} - {\sf@definetypeface{#2}{\sfparameter\c!style}{\sf@mathtypeface{#3}}}} - -\def\sf@mathtypeface#1% - {\executeifdefined{\????sf:\v!math:\modulecode{simplefonts.normalizefontname("#1")}}{\modulecode{simplefonts.normalizefontname("#1")}}} - -\setvalue{\????sf:\v!math:latinmodern}{modern} -\setvalue{\????sf:\v!math:latinmodernmath}{modern} -\setvalue{\????sf:\v!math:lmmath}{modern} +\long\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand + {\long\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% + \normalexpanded{\noexpand\processassignmentlist[#1]}\currentassignmentlistcommand} -\def\sf@definefallbackfont[#1][#2][#3][#4]% - {\edef\@@sf@@{#1} - \getparameters - [\????sf#1] - [\c!regular=, - \c!italic=, - \c!bold=, - \c!bolditalic=, - \c!caps=, - \c!italiccaps=, - \c!boldcaps=, - \c!bolditaliccaps=, - \c!features=\v!default, - \c!regularfeatures=\sfparameter\c!features, - \c!italicfeatures=\sfparameter\c!features, - \c!boldfeatures=\sfparameter\c!features, - \c!bolditalicfeatures=\sfparameter\c!features, - \c!smallcapsfeatures=\v!smallcaps, - \c!capsfeatures=\sfparameter\c!smallcapsfeatures, - \c!italiccapsfeatures=\sfparameter\c!smallcapsfeatures, - \c!boldcapsfeatures=\sfparameter\c!smallcapsfeatures, - \c!bolditaliccapsfeatures=\sfparameter\c!smallcapsfeatures, - \c!weight=\v!normal, - \c!scale=1.0, - #4]% - \def\sf@dodefinefallbackfont##1{\expanded{\sf@definefontfallback{#2}{##1}{#1}{#3}}}% - \processcommacommand[\sf@stylelist]\sf@dodefinefallbackfont - \doifinset{#2}{\v!mainfont,\v!sansfont,\v!monofont}{\sf@definefontfamily\sf@setupbodyfont}} +\starttexdefinition simplefonts@features #1#2 -\starttexdefinition sf@definefontfallback #1#2#3#4 + \letvalueempty{simplefont!#2features} - \modulecode{simplefonts.selectfont("#3","#4","\csname\????sf#3#2\endcsname","#2","\sfparameter\c!weight")} + \startprocessassignmentcommand[#1] - \definefontfallback - [\????sf#1#2\s!fallbacks] - [\csname\????sf#3#2\endcsname*\sfparameter{#2\s!features}] - [\sfparameter\c!range] - [\s!rscale=\sfparameter\c!scale] + \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] + + \iffourthargument + + \getparameters[\????sf\currentsimplefont][#4] + + \simplefonts@features{#4}\v!local % parse assignment list for font features + + \fi + + \startprocesscommacommand[\simplefonts!alternative] + + \simplefonts@fontfeature{#1}{##1} + + \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter\currentcommalistitem","##1","\simplefontparameter\c!weight")} + + \stopprocesscommacommand + + \simplefonts@typescript{\simplefontparameter\c!style}{#1} + + \ifx\currenttypeface\v!simplefonts + + % don't create a typeface and set bodyfont when the module is loaded + + \if!!donesimplefonts + + \doglobal\increment\simplefonts!typeface + + \simplefonts@family {\v!simplefonts:\simplefonts!typeface} + \simplefonts@bodyfont{\v!simplefonts:\simplefonts!typeface} + + \fi + + \else + + \simplefonts@typeface{#2}{#1}{#1} + + \fi + +\stoptexdefinition + +\starttexdefinition simplefonts@definescriptfont [#1][#2][#3][#4] + + \edef\currentsimplefont{#1}\edef\currenttypeface{#2} + + \presetsimplefonts[\????sf\currentsimplefont] + + \iffourthargument + + \getparameters[\????sf\currentsimplefont][#4] + + \simplefonts@features{#4}\v!local % parse assignment list for font features + + \fi + + \startprocesscommacommand[\c!regular] + + \simplefonts@fontfeature{#1}{##1} + + \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter\currentcommalistitem","##1","\simplefontparameter\c!weight")} + + \stopprocesscommacommand + + \simplefonts@scripttypescript{\simplefontparameter\c!style}{#1} + + \ifx\currenttypeface\v!simplefonts + + % don't create a typeface and set bodyfont when the module is loaded + + \if!!donesimplefonts + + \doglobal\increment\simplefonts!typeface + + \simplefonts@family {\v!simplefonts:\simplefonts!typeface} + \simplefonts@bodyfont{\v!simplefonts:\simplefonts!typeface} + + \fi + + \else + + \simplefonts@typeface{#2}{#1}{#1} + + \fi + +\stoptexdefinition + +\starttexdefinition simplefonts@definemathfont [#1][#2][#3][#4] + + \edef\currentsimplefont{#1}\edef\currenttypeface{#2} + + \presetsimplefonts[\????sf\currentsimplefont] + + \iffourthargument + + \getparameters[\????sf\currentsimplefont][#4] + + \fi + + % 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}{\executeifdefined{\????sf:\v!math:\ctxlua{thirddata.simplefonts.normalizefontname("#3")}}{\ctxlua{thirddata.simplefonts.normalizefontname("#3")}}} + + \ifx\currenttypeface\v!simplefonts + + % don't create a typeface and set bodyfont when the module is loaded + + \if!!donesimplefonts + + \doglobal\increment\simplefonts!typeface + + \simplefonts@family {\v!simplefonts:\simplefonts!typeface} + \simplefonts@bodyfont{\v!simplefonts:\simplefonts!typeface} + + \fi + + \else + + \simplefonts@typeface{#2}{#1}{#1} + + \fi + +\stoptexdefinition + +\starttexdefinition simplefonts@setfallbackfont [#1][#2][#3][#4] + + \edef\currentsimplefont{#1}\edef\currentmainfont{#2} + + \presetsimplefonts[\????sf\currentsimplefont] + + \iffourthargument + + \getparameters[\????sf\currentsimplefont][#4] + + \simplefonts@features{#4}\v!local % parse assignment list for font features + + \fi + + \startprocesscommacommand[\simplefonts!alternative] + + \simplefonts@fontfeature{#1}{##1} + + \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter\currentcommalistitem","##1","\simplefontparameter\c!weight")} + + \simplefonts@fontfallback{#2}{#1}{##1} + + \stopprocesscommacommand \stoptexdefinition -%D \starttyping -%D \definefontcommand[<command>][<typeface>][..,..=..,..] -%D \stoptyping +\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 + + \doglobal\increment\simplefonts!typeface + + \simplefonts@family {\v!simplefonts:\simplefonts!typeface} + \simplefonts@bodyfont{\v!simplefonts:\simplefonts!typeface} + + \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]% - \doifelsevalue{\????sf#1\c!style}\v!math - {\setvalue{\e!set#1}{\doquadrupleempty\sf@definemathfont[#1][#2]}} - {\setvalue{\e!set#1}{\doquadrupleempty\sf@definetextfont[#1][#2]}}} - -%D \starttyping -%D \definesubfontcommand[<command>][<fontgroup>][..,..=..,..] -%D \stoptyping + \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!math=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definemathfont [#1][#2]}, + \v!handwriting=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definescriptfont[#1][#2]}, + \v!calligraphic=>\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!calligraphic] \def\definesubfontcommand {\dotripleempty\dodefinesubfontcommand} \def\dodefinesubfontcommand[#1][#2][#3]% {\getparameters[\????sf#1][\c!range=,#3]% - \setvalue{\e!set#1}{\doquadrupleempty\sf@definefallbackfont[#1][#2]}} - -%D \starttyping -%D \definefontfamily[<command>][<font>][..,..=..,..] -%D \stoptyping + \setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definefallbackfont[#1][#2]}} -\def\definefontfamily - {\dotripleempty\dodefinefontfamly} +\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}] -\def\dodefinefontfamly[#1][#2][#3]% - {\getparameters[\????sf#1][\c!style=\v!serif]% - \sf@definetextfont[#1][#1][#2][#3]} +\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 \starttyping -%D \simplefont[<font>][..,..=..,..] -%D \stoptyping +%D \macros +%D {simplefont,definesimplefont} \def\simplefont {\dodoubleempty\dosimplefont} \def\dosimplefont[#1][#2]% - {\getparameters[\????sf\s!default][\c!features=\v!default,#2]% - \modulecode{simplefonts.selectfont("\s!default","#1","","\v!regular","\v!normal")}% + {\getparameters[\????sf\v!default][\c!features=\v!default,\c!alternative=\v!regular,\c!weight=\v!normal,#2]% + \ctxlua{thirddata.simplefonts.selectfont("\v!default","#1","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}% \definedfont[\@@@@sfdefaultregular*\@@@@sfdefaultfeatures]} -%D \starttyping -%D \definesimplefont[<command>][<font>][..,..=..,..] -%D \stoptyping - \def\definesimplefont {\dotripleempty\dodefinesimplefont} \def\dodefinesimplefont[#1][#2][#3]% - {\getparameters[\????sf\s!default][\c!features=\v!default,#3]% - \modulecode{simplefonts.selectfont("\s!default","#2","","\v!regular","\v!normal")}% + {\getparameters[\????sf\v!default][\c!features=\v!default,\c!alternative=\v!regular,\c!weight=\v!normal,#3]% + \ctxlua{thirddata.simplefonts.selectfont("\v!default","#2","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}% \definefont[#1][\@@@@sfdefaultregular*\@@@@sfdefaultfeatures][#3]} -%D Default commands +%D \macros +%D {simplefontfamily,definesimplefontfamily} + +\def\simplefontfamily + {\dodoubleempty\dosimplefontfamily} + +\def\dosimplefontfamily[#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\definesimplefontfamily + {\dotripleempty\dodefinesimplefontfamily} + +\def\dodefinesimplefontfamily[#1][#2][#3]% + {\simplefonts@definetextfont[#1][#1][#2][\c!style=\v!serif,#3]} + +%D Font extensions -% \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 ] +\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}] -\def\setmainfont{\dodoubleempty\dosetmainfont} -\def\setsansfont{\dodoubleempty\dosetsansfont} -\def\setmonofont{\dodoubleempty\dosetmonofont} -\def\setmathfont{\dodoubleempty\dosetmathfont} +\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}] -\def\dosetmainfont[#1][#2]{\sf@definetextfont[\v!mainfont][\v!simplefonts][#1][\c!style=\v!serif,#2]} -\def\dosetsansfont[#1][#2]{\sf@definetextfont[\v!sansfont][\v!simplefonts][#1][\c!style=\v!sans ,#2]} -\def\dosetmonofont[#1][#2]{\sf@definetextfont[\v!monofont][\v!simplefonts][#1][\c!style=\v!mono ,#2]} -\def\dosetmathfont[#1][#2]{\sf@definemathfont[\v!mathfont][\v!simplefonts][#1][\c!style=\v!math ,#2]} +\getparameters + [\????sf\v!normal] + [ \c!regular={regular,roman,normal,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}] -% \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}] +\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}] -\def\setcjkmainfont{\dodoubleempty\dosetcjkmainfont} -\def\setcjksansfont{\dodoubleempty\dosetcjksansfont} -\def\setcjkmonofont{\dodoubleempty\dosetcjkmonofont} +\startprocesscommacommand[\simplefonts!weight] -\def\dosetcjkmainfont[#1][#2]{\sf@definefallbackfont[\v!cjk\v!mainfont][\v!mainfont][#1][\c!range={0x00400-0x2FA1F},#2]} -\def\dosetcjksansfont[#1][#2]{\sf@definefallbackfont[\v!cjk\v!sansfont][\v!sansfont][#1][\c!range={0x00400-0x2FA1F},#2]} -\def\dosetcjkmonofont[#1][#2]{\sf@definefallbackfont[\v!cjk\v!monofont][\v!monofont][#1][\c!range={0x00400-0x2FA1F},#2]} + \ctxlua{thirddata.simplefonts.extlist["#1"] = { }} -\def\setmainfontfallback{\dodoubleempty\dosetmainfontfallback} -\def\setsansfontfallback{\dodoubleempty\dosetsansfontfallback} -\def\setmonofontfallback{\dodoubleempty\dosetmonofontfallback} + { -\def\dosetmainfontfallback[#1][#2]{\sf@definefallbackfont[\v!mainfont\v!fallback][\v!mainfont][#1][\c!range=,#2]} -\def\dosetsansfontfallback[#1][#2]{\sf@definefallbackfont[\v!sansfont\v!fallback][\v!sansfont][#1][\c!range=,#2]} -\def\dosetmonofontfallback[#1][#2]{\sf@definefallbackfont[\v!monofont\v!fallback][\v!monofont][#1][\c!range=,#2]} + \startprocesscommacommand[\simplefonts!alternative] -%D Lua code + \ctxlua{thirddata.simplefonts.extlist["#1"]["##1"] = { }} + + { -\startmodulecode - -simplefonts = simplefonts or { } - -simplefonts.fontlist = { - ["aller"] = - { - ["light"] = - { - regular = "allerlight" , - italic = "allerlightitalic" , - bold = "allerlight" , - bolditalic = "allerlight" , - } , - ["normal"] = - { - regular = "aller" , - italic = "alleritalic" , - bold = "allerbold" , - bolditalic = "allerbolditalic" , - } , - ["display"] = - { - regular = "allerdisplay" , - italic = "allerdisplay" , - bold = "allerdisplay" , - bolditalic = "allerdisplay" , - } , - } , - ["anivers"] = - { - ["normal"] = - { - regular = "aniversregular" , - italic = "aniversregular" , - bold = "aniversregular" , - bolditalic = "aniversregular" , - } , - } , - ["axel"] = - { - ["normal"] = - { - regular = "axel" , - italic = "axel" , - bold = "axelbold" , - bolditalic = "axelbold" , - caps = "axelsc" , - italiccaps = "axelsc" , - boldcaps = "axelscbold" , - bolditaliccaps = "axelscbold" , - } , - } , - ["calibri"] = - { - ["normal"] = - { - regular = "calibri" , - italic = "calibriitalic" , - bold = "calibribold" , - bolditalic = "calibribolditalic" , - } , - } , - ["cambria"] = - { - ["normal"] = - { - regular = "cambria" , - italic = "cambriaitalic" , - bold = "cambriabold" , - bolditalic = "cambriabolditalic" , - } , - } , - ["candara"] = - { - ["normal"] = - { - regular = "candara" , - italic = "candaraitalic" , - bold = "candarabold" , - bolditalic = "candarabolditalic" , - } , - } , - ["charteritcpro"] = - { - ["normal"] = - { - regular = "charteritcproregular" , - italic = "charteritcproitalic" , - bold = "charteritcprobold" , - bolditalic = "charteritcprobolditalic" , - } , - ["bold"] = - { - regular = "charteritcprobold" , - italic = "charteritcprobolditalic" , - bold = "charteritcproblack" , - bolditalic = "charteritcproblackitalic" , - } , - } , - ["cmubright"] = - { - ["normal"] = - { - regular = "cmubrightroman" , - italic = "cmubrightoblique" , - bold = "cmubrightbold" , - bolditalic = "cmubrightboldoblique" , - } , - } , - ["cmuconcrete"] = - { - ["normal"] = - { - regular = "cmuconcreteroman" , - italic = "cmuconcreteitalic" , - bold = "cmuconcretebold" , - bolditalic = "cmuconcretebolditalic" , - } , - } , - ["cmusans"] = - { - ["normal"] = - { - regular = "cmusansserif" , - italic = "cmusansserifoblique" , - bold = "cmusansserifbold" , - bolditalic = "cmusansserifboldoblique" , - } , - } , - ["cmuserif"] = - { - ["normal"] = - { - regular = "cmuserifroman" , - italic = "cmuserifitalic" , - slanted = "cmuserifromanslanted" , - bold = "cmuserifbold" , - bolditalic = "cmuserifbolditalic" , - boldslanted = "cmuserifboldslanted" , - } , - } , - ["cmutypewriter"] = - { - ["light"] = - { - regular = "cmutypewriterlight" , - italic = "cmutypewriterlightoblique" , - bold = "cmutypewriterregular" , - bolditalic = "cmutypewriteroblique" , - } , - ["normal"] = - { - regular = "cmutypewriterregular" , - italic = "cmutypewriteritalic" , - slanted = "cmutypewriteroblique" , - bold = "cmutypewriterbold" , - bolditalic = "cmutypewriterbolditalic" , - } , - } , - ["consolas"] = - { - ["normal"] = - { - regular = "consolas" , - italic = "consolasitalic" , - bold = "consolasbold" , - bolditalic = "consolasbolditalic" , - } , - } , - ["constantia"] = - { - ["normal"] = - { - regular = "constantia" , - italic = "constantiaitalic" , - bold = "constantiabold" , - bolditalic = "constantiabolditalic" , - } , - } , - ["corbel"] = - { - ["normal"] = - { - regular = "corbel" , - italic = "corbelitalic" , - bold = "corbelbold" , - bolditalic = "corbelbolditalic" , - } , - } , - ["dejavusans"] = - { - ["condensed"] = - { - regular = "dejavusanscondensed" , - italic = "dejavusanscondensedoblique" , - bold = "dejavusanscondensedbold" , - bolditalic = "dejavusanscondensedboldoblique" , - } , - ["normal"] = - { - regular = "dejavusans" , - italic = "dejavusansoblique" , - bold = "dejavusansbold" , - bolditalic = "dejavusansboldoblique" , - } , - } , - ["dejavusansmono"] = - { - ["normal"] = - { - regular = "dejavusansmono" , - italic = "dejavusansmonooblique" , - bold = "dejavusansmonobold" , - bolditalic = "dejavusansmonoboldoblique" , - } , - } , - ["dejavuserif"] = - { - ["condensed"] = - { - regular = "dejavuserifcondensed" , - italic = "dejavuserifcondenseditalic" , - bold = "dejavuserifcondensedbold" , - bolditalic = "dejavuserifcondensedbolditalic" , - } , - ["normal"] = - { - regular = "dejavuserif" , - italic = "dejavuserifitalic" , - bold = "dejavuserifbold" , - bolditalic = "dejavuserifbolditalic" , - } , - } , - ["delicious"] = - { - ["normal"] = - { - regular = "deliciousroman" , - italic = "deliciousitalic" , - bold = "deliciousbold" , - bolditalic = "deliciousbolditalic" , - caps = "delicioussmallcaps" , - } , - ["heavy"] = - { - regular = "deliciousheavy" , - italic = "deliciousheavy" , - bold = "deliciousheavy" , - bolditalic = "deliciousheavy" , - } , - } , - ["diavlo"] = - { - ["light"] = - { - regular = "diavlolightregular" , - italic = "diavlolightregular" , - bold = "diavlobookregular" , - bolditalic = "diavlobookregular" , - } , - ["normal"] = - { - regular = "diavlobookregular" , - italic = "diavlobookregular" , - bold = "diavloboldregular" , - bolditalic = "diavloboldregular" , - } , - ["medium"] = - { - regular = "diavlomediumregular" , - italic = "diavlomediumregular" , - bold = "diavloblackregular" , - bolditalic = "diavloblackregular" , - } , - } , - ["droidmono"] = - { - ["normal"] = - { - regular = "droidsansmono" , - italic = "droidsansmono" , - bold = "droidsansmono" , - bolditalic = "droidsansmono" , - } , - } , - ["droidsans"] = - { - ["normal"] = - { - regular = "droidsans" , - italic = "droidsans" , - bold = "droidsansbold" , - bolditalic = "droidsansbold" , - } , - } , - ["droidserif"] = - { - ["normal"] = - { - regular = "droidserif" , - italic = "droidserifitalic" , - bold = "droidserifbold" , - bolditalic = "droidserifbolditalic" , - } , - } , - ["fertigo"] = - { - ["normal"] = - { - regular = "fertigoproregular" , - italic = "fertigoproregular" , - bold = "fertigoproregular" , - bolditalic = "fertigoproregular" , - } , - } , - ["fontin"] = - { - ["normal"] = - { - regular = "fontinregular" , - italic = "fontinitalic" , - bold = "fontinbold" , - bolditalic = "fontinsmallcaps" , - } , - } , - ["fontinsans"] = - { - ["normal"] = - { - regular = "fontinsansregular" , - italic = "fontinsansitalic" , - bold = "fontinsansbold" , - bolditalic = "fontinsansbolditalic" , - caps = "fontinsanssmallcaps" , - } , - } , - ["hiraginokakugothicpro"] = - { - ["normal"] = - { - regular = "hirakakuprow3" , - italic = "hirakakuprow3" , - bold = "hirakakuprow6" , - bolditalic = "hirakakuprow6" , - } , - } , - ["hiraginokakugothicpron"] = - { - ["normal"] = - { - regular = "hirakakupronw3" , - italic = "hirakakupronw3" , - bold = "hirakakupronw6" , - bolditalic = "hirakakupronw6" , - } , - } , - ["hiraginokakugothicstd"] = - { - ["normal"] = - { - regular = "hirakakustdw8" , - italic = "hirakakustdw8" , - bold = "hirakakustdw8" , - bolditalic = "hirakakustdw8" , - } , - } , - ["hiraginokakugothicstdn"] = - { - ["normal"] = - { - regular = "hirakakustdnw8" , - italic = "hirakakustdnw8" , - bold = "hirakakustdnw8" , - bolditalic = "hirakakustdnw8" , - } , - } , - ["hiraginomarugothicpro"] = - { - ["normal"] = - { - regular = "hiramaruprow4" , - italic = "hiramaruprow4" , - bold = "hiramaruprow4" , - bolditalic = "hiramaruprow4" , - } , - } , - ["hiraginomarugothicpron"] = - { - ["normal"] = - { - regular = "hiramarupronw4" , - italic = "hiramarupronw4" , - bold = "hiramarupronw4" , - bolditalic = "hiramarupronw4" , - } , - } , - ["hiraginominchopro"] = - { - ["normal"] = - { - regular = "hiraminprow3" , - italic = "hiraminprow3" , - bold = "hiraminprow6" , - bolditalic = "hiraminprow6" , - } , - } , - ["hiraginominchopron"] = - { - ["normal"] = - { - regular = "hiraminpronw3" , - italic = "hiraminpronw3" , - bold = "hiraminpronw6" , - bolditalic = "hiraminpronw6" , - } , - } , - ["lucidabright"] = - { - ["normal"] = - { - regular = "lucidabright" , - italic = "lucidabrightitalic" , - bold = "lucidabrightdemi" , - bolditalic = "lucidabrightdemiitalic" , - caps = "lucidabrightsmallcaps" , - } , - } , - ["lucidacalligraphy"] = - { - ["normal"] = - { - regular = "lucidacalligraphyitalic" , - } , - } , - ["lucidahandwriting"] = - { - ["normal"] = - { - regular = "lucidahandwritingitalic" , - } , - } , - ["lucidasans"] = - { - ["normal"] = - { - regular = "lucidasans" , - italic = "lucidasansitalic" , - bold = "lucidasansdemi" , - bolditalic = "lucidasansdemiitalic" , - } , - } , - ["lucidatypewriter"] = - { - ["normal"] = - { - regular = "lucidatypewriter" , - italic = "lucidatypewriteroblique" , - bold = "lucidatypewriterbold" , - bolditalic = "lucidatypewriterboldoblique" , - } , - } , - ["lucidasanstypewriter"] = - { - ["normal"] = - { - regular = "lucidasanstypewriter" , - italic = "lucidasanstypewriteroblique" , - bold = "lucidasanstypewriterbold" , - bolditalic = "lucidasanstypewriterboldoblique" , - } , - } , - ["iwona"] = - { - ["light"] = - { - regular = "iwonalightregular" , - italic = "iwonalightitalic" , - bold = "iwonamediumregular" , - bolditalic = "iwonamediumitalic" , - } , - ["normal"] = - { - regular = "iwonaregular" , - italic = "iwonaitalic" , - bold = "iwonabold" , - bolditalic = "iwonabolditalic" , - } , - ["medium"] = - { - regular = "iwonamediumregular" , - italic = "iwonamediumitalic" , - bold = "iwonaheavyregular" , - bolditalic = "iwonaheavyitalic" , - } , - ["heavy"] = - { - regular = "iwonaheavyregular" , - italic = "iwonaheavyitalic" , - bold = "iwonaheavyregular" , - bolditalic = "iwonaheavyitalic" , - } , - } , - ["junicode"] = - { - ["normal"] = - { - regular = "junicoderegular" , - italic = "junicodeitalic" , - bold = "junicodebold" , - bolditalic = "junicodebolditalic" , - } , - } , - ["justus"] = - { - ["normal"] = - { - regular = "justusoldstyle" , - italic = "justusitalicoldstyle" , - bold = "justusoldstyle" , - bolditalic = "justusoldstyle" , - caps = "justusversalitas" , - } , - } , - ["kurier"] = - { - ["light"] = - { - regular = "kurierlightregular" , - italic = "kurierlightitalic" , - bold = "kuriermediumregular" , - bolditalic = "kuriermediumitalic" , - } , - ["normal"] = - { - regular = "kurierregular" , - italic = "kurieritalic" , - bold = "kurierbold" , - bolditalic = "kurierbolditalic" , - } , - ["medium"] = - { - regular = "kuriermediumregular" , - italic = "kuriermediumitalic" , - bold = "kurierheavyregular" , - bolditalic = "kurierheavyitalic" , - } , - } , - ["latinmodernmono"] = - { - ["normal"] = - { - regular = "lmmono10regular" , - bold = "lmmonolt10bold" , - italic = "lmmono10italic" , - oblique = "lmmono10italic" , - bolditalic = "lmmonolt10boldoblique" , - boldoblique = "lmmonolt10boldoblique" , - caps = "lmmonocaps10regular" , - obliquecaps = "lmmonocaps10oblique" , - } , - } , - ["latinmodernroman"] = - { - ["normal"] = - { - regular = "lmroman10regular" , - bold = "lmroman10bold" , - italic = "lmroman10italic" , - oblique = "lmromanslant10regular" , - bolditalic = "lmroman10bolditalic" , - boldoblique = "lmromanslant10bold" , - caps = "lmromancaps10regular" , - obliquecaps = "lmromancaps10oblique" , - } , - } , - ["latinmodernsans"] = - { - ["normal"] = - { - regular = "lmsans10regular" , - bold = "lmsans10bold" , - italic = "lmsans10oblique" , - oblique = "lmsans10oblique" , - bolditalic = "lmsans10boldoblique" , - boldoblique = "lmsans10boldoblique" , - } , - } , - ["liberationmono"] = - { - ["normal"] = - { - regular = "liberationmono" , - italic = "liberationmonoitalic" , - bold = "liberationmonobold" , - bolditalic = "liberationmonobolditalic" , - } , - } , - ["liberationsans"] = - { - ["normal"] = - { - regular = "liberationsans" , - italic = "liberationsansitalic" , - bold = "liberationsansbold" , - bolditalic = "liberationsansbolditalic" , - } , - } , - ["liberationserif"] = - { - ["normal"] = - { - regular = "liberationserif" , - italic = "liberationserifitalic" , - bold = "liberationserifbold" , - bolditalic = "liberationserifbolditalic" , - } , - } , - ["linuxbiolinum"] = - { - ["normal"] = - { - regular = "linuxbiolinumo" , - italic = "linuxbiolinumo" , - bold = "linuxbiolinumobold" , - bolditalic = "linuxbiolinumobold" , - } , - } , - ["linuxlibertine"] = - { - ["normal"] = - { - regular = "linuxlibertineo" , - italic = "linuxlibertineoitalic" , - bold = "linuxlibertineobold" , - bolditalic = "linuxlibertineobolditalic" , - smallcaps = "linuxlibertineocapitals" , - } , - } , - ["luximono"] = - { - ["normal"] = - { - regular = "luximonoregular" , - italic = "luximonooblique" , - bold = "luximonobold" , - bolditalic = "luximonoboldoblique" , - } , - } , - ["luxisans"] = - { - ["normal"] = - { - regular = "luxisansregular" , - italic = "luxisansoblique" , - bold = "luxisansbold" , - bolditalic = "luxisansboldoblique" , - } , - } , - ["luxiserif"] = - { - ["normal"] = - { - regular = "luxiserifregular" , - italic = "luxiserifoblique" , - bold = "luxiserifbold" , - bolditalic = "luxiserifboldoblique" , - } , - } , - ["miso"] = - { - ["light"] = - { - regular = "misolight" , - italic = "misolight" , - bold = "misolight" , - bolditalic = "misolight" , - } , - ["normal"] = - { - regular = "miso" , - italic = "miso" , - bold = "miso" , - bolditalic = "miso" , - } , - ["bold"] = - { - regular = "misobold" , - italic = "misobold" , - bold = "misobold" , - bolditalic = "misobold" , - } , - } , - ["pigiarniq"] = - { - ["light"] = - { - regular = "pigiarniqlight" , - italic = "pigiarniqlight" , - bold = "pigiarniqlight" , - bolditalic = "pigiarniqlight" , - } , - ["normal"] = - { - regular = "pigiarniq" , - italic = "pigiarniqitalic" , - bold = "pigiarniqbold" , - bolditalic = "pigiarniqbold" , - } , - ["heavy"] = - { - regular = "pigiarniqheavy" , - italic = "pigiarniqheavy" , - bold = "pigiarniqheavy" , - bolditalic = "pigiarniqheavy" , - } , - } , - ["sabon"] = - { - ["normal"] = - { - regular = "sabonltstdroman" , - italic = "sabonltstditalic" , - bold = "sabonltstdbold" , - bolditalic = "sabonltstdbolditalic" , - } , - } , - ["tallys"] = - { - ["normal"] = - { - regular = "tallys" , - italic = "tallys" , - bold = "tallys" , - bolditalic = "tallys" , - } , - } , - ["texgyreadventor"] = - { - ["normal"] = - { - regular = "texgyreadventorregular" , - italic = "texgyreadventoritalic" , - bold = "texgyreadventorbold" , - bolditalic = "texgyreadventorbolditalic" , - } , - } , - ["texgyrebonum"] = - { - ["normal"] = - { - regular = "texgyrebonumregular" , - italic = "texgyrebonumitalic" , - bold = "texgyrebonumbold" , - bolditalic = "texgyrebonumbolditalic" , - } , - } , - ["texgyrechorus"] = - { - ["medium"] = - { - regular = "texgyrechorusmediumitalic" , - italic = "texgyrechorusmediumitalic" , - bold = "texgyrechorusmediumitalic" , - bolditalic = "texgyrechorusmediumitalic" , - } , - } , - ["texgyrecursor"] = - { - ["normal"] = - { - regular = "texgyrecursorregular" , - italic = "texgyrecursoritalic" , - bold = "texgyrecursorbold" , - bolditalic = "texgyrecursorbolditalic" , - } , - } , - ["texgyreheros"] = - { - ["condensed"] = - { - regular = "texgyreheroscondensedregular" , - italic = "texgyreheroscondenseditalic" , - bold = "texgyreheroscondensedbold" , - bolditalic = "texgyreheroscondensedbolditalic" , - } , - ["normal"] = - { - regular = "texgyreherosregular" , - italic = "texgyreherositalic" , - bold = "texgyreherosbold" , - bolditalic = "texgyreherosbolditalic" , - } , - } , - ["texgyrepagella"] = - { - ["normal"] = - { - regular = "texgyrepagellaregular" , - italic = "texgyrepagellaitalic" , - bold = "texgyrepagellabold" , - bolditalic = "texgyrepagellabolditalic" , - } , - } , - ["texgyreschola"] = - { - ["normal"] = - { - regular = "texgyrescholaregular" , - italic = "texgyrescholaitalic" , - bold = "texgyrescholabold" , - bolditalic = "texgyrescholabolditalic" , - } , - } , - ["texgyretermes"] = - { - ["normal"] = - { - regular = "texgyretermesregular" , - italic = "texgyretermesitalic" , - bold = "texgyretermesbold" , - bolditalic = "texgyretermesbolditalic" , - } , - } , - ["tuffy"] = - { - ["normal"] = - { - regular = "tuffyregular" , - italic = "tuffyitalic" , - bold = "tuffybold" , - bolditalic = "tuffybolditalic" , - } , - } , - ["uqammaq"] = - { - ["light"] = - { - regular = "uqammaqlight" , - italic = "uqammaqlight" , - bold = "uqammaqlight" , - bolditalic = "uqammaqlight" , - } , - ["normal"] = - { - regular = "uqammaq" , - italic = "uqammaq" , - bold = "uqammaqbold" , - bolditalic = "uqammaqbold" , - } , - ["heavy"] = - { - regular = "uqammaqheavy" , - italic = "uqammaqheavy" , - bold = "uqammaqheavy" , - bolditalic = "uqammaqheavy" , - } , - } , -} - -simplefonts.extlist = { - ["condensed"] = - { - regular = { "condensedregular" , "condregular" , "condensed" } , - italic = { "condenseditalic" , "condensedoblique" , "conditalic" , "condensedregular" , "condregular" , "condensed" } , - bold = { "condensedbold" , "condbold" , "condensedregular" , "condregular" , "condensed" } , - bolditalic = { "condensedbolditalic" , "condensedboldoblique" , "condbolditalic" , "condensedbold" , "condbold" , "condensedregular" , "condregular" , "condensed" } , - caps = { "condensedregular" , "condregular" , "condensed" } , - } , - ["light"] = - { - regular = { "lightregular" , "light" } , - italic = { "lightitalic" , "lightoblique" , "lightregular" , "light" } , - bold = { "bookregular" , "regular" , "book" , "lightregular" , "light" } , - bolditalic = { "bookitalic" , "book" , "italic" , "oblique" , "bookregular" , "regular" , "book" , "lightregular" , "light" } , - caps = { "smallcapslight" , "lightregular" , "light" } , - } , - ["normal"] = - { - regular = { "regular" , "roman" , "normal" , "book" , "" } , - italic = { "italic" , "it" , "oblique" , "kursiv" , "bookitalic" , "regular" , "roman" , "normal" , "book" , "" } , - bold = { "bold" , "bd" , "kraeftig" , "mediumregular" , "semibold" , "demi" , "regular" , "roman" , "normal" , "book" , "" } , - bolditalic = { "bolditalic" , "boldit" , "bdit" , "boldoblique" , "mediumitalic" , "semibolditalic" , "demiitalic" , "bold" , "bd" , "kraeftig" , "mediumregular" , "semibold" , "demi" , "regular" , "roman" , "normal" , "book" , "" } , - caps = { "smallcaps" , "capitals" , "sc" , "regular" , "roman" , "normal" , "book" , "" } , - italiccaps = { "smallcaps" , "capitals" , "sc" , "regular" , "roman" , "normal" , "book" , "" } , - boldcaps = { "smallcaps" , "capitals" , "sc" , "regular" , "roman" , "normal" , "book" , "" } , - bolditaliccaps = { "smallcaps" , "capitals" , "sc" , "regular" , "roman" , "normal" , "book" , "" } , - } , - ["medium"] = - { - regular = { "mediumregular" , "medregular" , "medium" } , - italic = { "mediumitalic" , "meditalic" , "mediumregular" , "medregular" , "medium" } , - bold = { "heavyregular" , "heavy" , "mediumregular" , "medregular" , "medium" } , - bolditalic = { "heavyitalic" , "heavyregular" , "heavy" , "mediumregular" , "medregular" , "medium" } , - caps = { "mediumcaps" , "mediumregular" , "medregular" , "medium" } , - } , -} - -simplefonts.synonyms = { - { "lmregular", "latinmodernregular", } , - { "lmsans", "latinmodernsans", } , - { "lmmono", "latinmodernmono", } , - { "lmtypewriter", "latinmodernmono", } , - { "latinmoderntypewriter", "latinmodernmono", } , - { "itccharter", "charteritcpro", } , - { "biolinum", "linuxbiolinum", } , - { "libertine", "linuxlibertine", } , - { "avantgarde", "texgyreadventor", } , - { "adventor", "texgyreadventor", } , - { "bookman", "texgyrebonum", } , - { "bonum", "texgyrebonum", } , - { "chancery", "texgyrechorus", } , - { "chorus", "texgyrechorus", } , - { "courier", "texgyrecursor", } , - { "cursor", "texgyrecursor", } , - { "helvetica", "texgyreheros", } , - { "heros", "texgyreheros", } , - { "palatino", "texgyrepagella", } , - { "pagella", "texgyrepagella", } , - { "schoolbook", "texgyreschola", } , - { "schola", "texgyreschola", } , - { "times", "texgyretermes", } , - { "termes", "texgyretermes", } , -} - -function simplefonts.selectfont(font,name,extension,style,weight) - local fontname = {} - local name = string.lower(string.gsub(name," ","")) - if extension ~= "" then - ext = string.find(extension,"*") - if ext ~= nil then - fontname = string.gsub(extension,"*",name) - else - fontname = extension - end - fontname = "name:" .. string.lower(string.gsub(fontname," ","")) - else - for _, v in global.ipairs(simplefonts.synonyms) do - if name == v[1] then - name = v[2] - break - end - end - if simplefonts.fontlist[name] ~= nil then - if simplefonts.fontlist[name][weight] ~= nil then - if simplefonts.fontlist[name][weight][style] ~= nil then - fontname = simplefonts.fontlist[name][weight][style] - else - fontname = simplefonts.fontlist[name][weight]["regular"] - end - elseif simplefonts.fontlist[name]["normal"] ~= nil then - if simplefonts.fontlist[name]["normal"][style] ~= nil 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 global.ipairs(simplefonts.extlist[weight][style]) do - fontname = name .. v - if global.fonts.names.exists(fontname) then - fontname = "name:" .. fontname - break - else - fontname = "DefaultFont" -- no font is found - end - end - end - end - -- global.print(fontname) - tex.sprint(tex.prtcatcodes,string.format("\\setvalue{\\????sf %s%s}{%s}",font,style,fontname)) -end - -function simplefonts.normalizefontname(name) - -- tex.sprint(string.lower(string.gsub(name," ",""))) - local fontname = string.lower(name) - fontname = string.gsub(fontname," ","") - fontname = string.gsub(fontname,"-","") - tex.sprint(fontname) -end - -\stopmodulecode + \startprocesscommacommand[\namedsimplefontparameter{#1}{##1}] + + \ctxlua{table.insert(thirddata.simplefonts.extlist["#1"]["##1"],"####1")} + + \stopprocesscommacommand + + } + + \stopprocesscommacommand + + } + +\stopprocesscommacommand + +%D Make a table entry for each known parameter of the module to check +%D for them when the feature list is processed, could have be done also +%D with TeX code but then I have to save each of them in a macro to make +%D to make the overhead small. + +\startprocesscommacommand[\simplefonts!parameters] + + \ctxlua{thirddata.simplefonts.parameters["#1"] = {}} + +\stopprocesscommacommand + +%D Default setup \setupsimplefonts - [ \c!size=\moduleparameter\v!simplefonts\c!size, - \c!style=\moduleparameter\v!simplefonts\c!style] + [\c!size=\moduleparameter\v!simplefonts\c!size, + \c!style=\moduleparameter\v!simplefonts\c!style, + \c!features=\v!default, + \c!smallcapsfeatures=\v!smallcaps] + +%D Default fonts -\setmainfont[Latin Modern Roman] -\setsansfont[Latin Modern Sans] -\setmonofont[Latin Modern Mono] -\setmathfont[Latin Modern Math] +\setmainfont [Latin Modern Roman] +\setsansfont [Latin Modern Sans] +\setmonofont [Latin Modern Mono] +\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 +\!!donesimplefontstrue \stopmodule |