diff options
author | Karl Berry <karl@freefriends.org> | 2009-11-23 00:11:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-11-23 00:11:19 +0000 |
commit | 6106e23b15a73668b37291685fe60ae3a64e58db (patch) | |
tree | bacf5cd589bb318f3e14307c87ec60c21587ac21 /Master/texmf-dist | |
parent | 47a83019686478b45f6a6c95dc3734ed8c90b7fb (diff) |
context-simplefonts update (22nov09)
git-svn-id: svn://tug.org/texlive/trunk@16133 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/context/third/simplefonts/README | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/context/third/simplefonts/simplefonts.pdf | bin | 49696 -> 88492 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/context/third/simplefonts/doc/simplefonts.tex | 46 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua | 7 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.tex | 100 |
5 files changed, 121 insertions, 38 deletions
diff --git a/Master/texmf-dist/doc/context/third/simplefonts/README b/Master/texmf-dist/doc/context/third/simplefonts/README index d7af4543a4b..ea2a6e17a2e 100644 --- a/Master/texmf-dist/doc/context/third/simplefonts/README +++ b/Master/texmf-dist/doc/context/third/simplefonts/README @@ -23,7 +23,11 @@ The global fonts can be set with the following three commands: A single typeface can bet set with the command: - \definefontfamily[...][...][..,..=..,..] + \definesimplefonttypeface[...][...][..,..=..,..] + +For each a complete typeface switch like \switchtobodyfont but you can use + + \simplefonttypeface[...][..,..=..,..] With the command 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 f929a0dbff7..3a2881fd1a4 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 cbc5e27e14c..1c56ae76d83 100644 --- a/Master/texmf-dist/source/context/third/simplefonts/doc/simplefonts.tex +++ b/Master/texmf-dist/source/context/third/simplefonts/doc/simplefonts.tex @@ -1,4 +1,4 @@ -\usemodule[simplefonts]%[size=11pt] +\usemodule[simplefonts][size=10pt] \setmainfont[DejaVu Serif] \setsansfont[DejaVu Sans] @@ -6,6 +6,8 @@ \starttext +\startbodymatter + \title{The {\em simplefonts} module} Writing typescripts for \ConTeXt\ can be a tedious job, … @@ -25,22 +27,40 @@ Writing typescripts for \ConTeXt\ can be a tedious job, … {\simplefont[TeX Gyre Chorus]TeX Gyre Chorus} \stoplines +\stopbodymatter + +\startappendices + +\section[sec:features]{Features} + \startluacode +tex.sprint("\\starttabulate[|l|p|p|]") +for k, v in next, fonts.otf.tables.features do + tex.sprint(string.format("\\NC %s\\NC %s\\NC %s\\NC\\NR",k,string.gsub(v,"#","\\letterhash"),string.lower(string.gsub(v,"[^a-zA-Z0-9]","")))) +end +tex.sprint("\\stoptabulate") +\stopluacode + +\section[sec:scripts]{Scripts} -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") +\startluacode +tex.sprint("\\starttabulate[|l|p|p|]") +for k, v in next, fonts.otf.tables.scripts do + tex.sprint(string.format("\\NC %s\\NC %s\\NC %s\\NC\\NR",k,string.gsub(v,"#","\\letterhash"),string.lower(string.gsub(v,"[^a-zA-Z0-9]","")))) end -tex.sprint(tex.ctxcatcodes,"\\stoptabulate") +tex.sprint("\\stoptabulate") +\stopluacode + +\section[sec:languages]{Languages} +\startluacode +tex.sprint("\\starttabulate[|l|p|p|]") +for k, v in next, fonts.otf.tables.languages do + tex.sprint(string.format("\\NC %s\\NC %s\\NC %s\\NC\\NR",k,string.gsub(v,"#","\\letterhash"),string.lower(string.gsub(v,"[^a-zA-Z0-9]","")))) +end +tex.sprint("\\stoptabulate") \stopluacode +\stopappendices + \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 index 362e60916aa..129c14854ce 100644 --- a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua +++ b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua @@ -146,6 +146,7 @@ simplefonts.fontlist = { 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,"*") @@ -156,7 +157,11 @@ function simplefonts.selectfont(font,name,extension,style,weight) end fontname = "name:" .. lower(gsub(fontname,"[^a-zA-Z0-9]","")) else - if simplefonts.fontlist[name] then + 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] 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 ee983ab3855..21679b89246 100644 --- a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.tex +++ b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.tex @@ -1,6 +1,6 @@ %D \module %D [ file=t-simplefonts, -%D version=2009.10.06, +%D version=2009.11.21, %D title=\CONTEXT\ User Module, %D subtitle=Simplefonts, %D author=Wolfgang Schuster, @@ -86,7 +86,7 @@ \setinterfacevariable {fallback} {fallback} \setinterfacevariable {condensed} {condensed} \setinterfacevariable {light} {light} - \setinterfacevariable {every} {every} + \setinterfacevariable {heavy} {heavy} \setinterfacevariable {feature} {feature} \setinterfacevariable {handwriting} {handwriting} \setinterfacevariable {calligraphy} {calligraphy} @@ -112,7 +112,7 @@ \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 use you need at last version '--'} + \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 @@ -157,10 +157,6 @@ \newif\if!!donesimplefonts -%D Token list - -\newtoks\everysetupsimplefonts - %D Tracing \let\enablesimplefonts \!!donesimplefontstrue @@ -176,7 +172,7 @@ {\v!mainfont,\v!sansfont,\v!monofont,\v!mathfont,\v!handwritingfont,\v!calligraphicfont} \def\simplefonts!weight - {\v!condensed,\v!light,\v!normal,\v!medium} + {\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, @@ -281,6 +277,9 @@ \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]} \letvalue{\????sf:\v!style :\v!serif }\c!rm @@ -302,7 +301,6 @@ \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 @@ -403,13 +401,13 @@ % expansion and protrusion could bet se either global for all styles or local for only one style - \doifdefined{\????sf\c!mode }{\appendtocommalist{\c!mode =\csname\????sf\c!mode \endcsname }\simplefont!features} - \doifdefined{\????sf\c!expansion }{\appendtocommalist{\c!expansion =\csname\????sf\c!expansion \endcsname }\simplefont!features} - \doifdefined{\????sf\c!protrusion }{\appendtocommalist{\c!protrusion=\csname\????sf\c!protrusion\endcsname }\simplefont!features} + \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} - \doifdefined{\????sf#1\c!mode }{\appendtocommalist{\c!expansion =\namedsimplefontparameter{#1}\c!mode }\simplefont!features} - \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} + \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 @@ -629,20 +627,59 @@ \def\dosimplefont[#1][#2]% {\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[\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures]} + \ctxlua{fonts.define.command_1("\luaescapestring{#1}")}% taken from font-ini.mkiv + \ifcase\scaledfontmode\relax + % none + \scaledfontsize-1000\scaledpoint + \or + % at + \scaledfontsize\somefontsize + \or + % sa + \scaledfontsize\localabsolutefontsize\relax + \scaledfontsize\currentfontbodysize\scaledfontsize + \or + % mo + \scaledfontsize\setmappedfontsize\localabsolutefontsize + \scaledfontsize\currentfontbodysize\scaledfontsize + \or + % scaled + \scaledfontsize-\somefontsize\scaledpoint + \fi + \scaledfontsize\localrelativefontsize\scaledfontsize + \ctxlua{thirddata.simplefonts.selectfont("\v!default","\truefontname\somefontname","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}% + \definedfont[\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures\space at \number\scaledfontsize sp]} \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,#3]% - \ctxlua{thirddata.simplefonts.selectfont("\v!default","#2","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}% - \definefont[#1][\@@@@sfdefaultregular*\@@@@sfdefaultfeatures][#3]} + \ctxlua{fonts.define.command_1("\luaescapestring{#2}")}% taken from font-ini.mkiv + \ifcase\scaledfontmode\relax + % none + \scaledfontsize-1000\scaledpoint + \or + % at + \scaledfontsize\somefontsize + \or + % sa + \scaledfontsize\localabsolutefontsize\relax + \scaledfontsize\currentfontbodysize\scaledfontsize + \or + % mo + \scaledfontsize\setmappedfontsize\localabsolutefontsize + \scaledfontsize\currentfontbodysize\scaledfontsize + \or + % scaled + \scaledfontsize-\somefontsize\scaledpoint + \fi + \scaledfontsize\localrelativefontsize\scaledfontsize + \ctxlua{thirddata.simplefonts.selectfont("\v!default","\truefontname\somefontname","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}% + \definefont[#1][\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures\space at \number\scaledfontsize sp][#3]} %D \macros -%D {simplefonttypeface,definesimplefonttypeface, -%D simplefontfamily,definesimplefontfamily} +%D {simplefonttypeface,definesimplefonttypeface} \def\simplefonttypeface {\dodoubleempty\dosimplefonttypeface} @@ -676,7 +713,7 @@ \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!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}, @@ -730,6 +767,21 @@ \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"] = { }} @@ -774,7 +826,9 @@ \c!style=\moduleparameter\v!simplefonts\c!style, \c!features=\v!default, \c!smallcapsfeatures=\v!smallcaps, - \c!mode=\v!node] + \c!mode=\v!node, + \c!expansion=\v!no, + \c!protrusion=\v!no] %D Default fonts |