summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-sel.mkvi
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/font-sel.mkvi')
-rw-r--r--tex/context/base/mkiv/font-sel.mkvi47
1 files changed, 31 insertions, 16 deletions
diff --git a/tex/context/base/mkiv/font-sel.mkvi b/tex/context/base/mkiv/font-sel.mkvi
index 4e74f6864..a78742928 100644
--- a/tex/context/base/mkiv/font-sel.mkvi
+++ b/tex/context/base/mkiv/font-sel.mkvi
@@ -1,6 +1,6 @@
%D \module
%D [ file=font-sel,
-%D version=2016.05.16,
+%D version=2016.08.28,
%D title=\CONTEXT\ User Module,
%D subtitle=Selectfont,
%D author=Wolfgang Schuster,
@@ -10,15 +10,17 @@
\writestatus{loading}{ConTeXt User Module / Selectfont}
-\registerctxluafile{font-sel}{1.000}
+\registerctxluafile{font-sel}{1.001}
\unprotect
\installcorenamespace {selectfont}
\installsimplecommandhandler \??selectfont {selectfont}
-\unexpanded\def\selectfont_register[#settings]%
+\unexpanded\def\selectfont_register[#style][#settings]%
{\begingroup
+ \edef\currentselectfont{\expandnamespacevalue\??fontshortstyle{#style}\s!rm}%
+ \checkselectfontparent
\setupcurrentselectfont[#settings]%
\edef\p_selectfont_preset{\selectfontparameter\c!preset}%
\ifx\p_selectfont_preset\empty \else
@@ -37,17 +39,17 @@
designsize {\selectfontparameter\s!designsize}%
rscale {\selectfontparameter\s!rscale}%
goodies {\selectfontparameter\c!goodies}%
- extras {\selectfontparameter\c!extras}%
+ extras {\selectfontparameter\c!extras}%
features {\selectfontparameter\c!features}%
- preset {\selectfontparameter\c!preset}%
+ preset {\selectfontparameter\c!preset}%
range {\selectfontparameter\c!range}% fallback only
offset {\selectfontparameter\c!offset}% fallback only
check {\selectfontparameter\c!check}% fallback only
force {\selectfontparameter\c!force}% fallback only
}
- userdata {%
- \luaexpanded{#settings}%
- }}%
+ userdata {%
+ \luaexpanded{#settings}%
+ }}%
\endgroup}
%D \macros
@@ -174,7 +176,7 @@
%D The \tex{definefontfamily} creates like \tex{definetypeface} a collection of font
%D with different styles which can be later called with the \tex{setupbodyfont} command.
%D
-%D The command takes three mendatory commands which are (a) the name of the fontclass,
+%D The command takes three mandatory commands which are (a) the name of the fontclass,
%D (b) the styles of the font and (c) the name of the font.
%D
%D \starttyping
@@ -233,7 +235,7 @@
%D \stoptext
%D \stoptyping
%D
-%D Another feature of the module is the \type{opticalsize} key which allows one to enable
+%D Another feature of the module is the \type{designsize} key which allows one to enable
%D optical sizes when they are a feature of the requested font.
%D
%D \starttyping
@@ -257,8 +259,8 @@
\def\selectfont_family_define[#typeface][#style][#family][#settings]%
{\doifelseassignment{#settings}
- {\selectfont_register[\c!label={#typeface},\c!style={#style},\c!name={#family},#settings]}
- {\selectfont_register[\c!label={#typeface},\c!style={#style},\c!name={#family},\c!preset={#settings}]}%
+ {\selectfont_register[#style][\c!label={#typeface},\c!style={#style},\c!name={#family},#settings]}
+ {\selectfont_register[#style][\c!label={#typeface},\c!style={#style},\c!name={#family},\c!preset={#settings}]}%
\clf_definefontfamily\selectfont_index\relax}
\unexpanded\def\definefallbackfamily
@@ -266,13 +268,26 @@
\def\selectfont_fallback_define[#typeface][#style][#family][#settings]%
{\doifelseassignment{#settings}
- {\selectfont_register[\c!label={#typeface},\c!style={#style},\c!name={#family},#settings]}
- {\selectfont_register[\c!label={#typeface},\c!style={#style},\c!name={#family},\c!preset={#settings}]}%
+ {\selectfont_register[#style][\c!label={#typeface},\c!style={#style},\c!name={#family},#settings]}
+ {\selectfont_register[#style][\c!label={#typeface},\c!style={#style},\c!name={#family},\c!preset={#settings}]}%
\clf_definefallbackfamily\selectfont_index\relax}
+\unexpanded\def\setupfontfamily
+ {\dodoubleargument\selectfont_family_setup}
+
+\def\selectfont_family_setup[#style][#settings]%
+ {\ifsecondargument
+ \edef\currentselectfont{\expandnamespacevalue\??fontshortstyle{#style}\s!rm}%
+ \setupcurrentselectfont[#settings]%
+ \else
+ \let\currentselectfont\empty
+ \setupcurrentselectfont[#style]%
+ \fi}
+
\setupselectfont
[ \c!features=\s!default,
\s!designsize=\s!default,
- \s!rscale=1]
+ \s!rscale=\selectfontparameter\c!scale,
+ \c!scale=1]
-\protect \ No newline at end of file
+\protect