summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fontspec
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-18 22:36:31 +0000
committerKarl Berry <karl@freefriends.org>2010-09-18 22:36:31 +0000
commit732f3ec949d484fffd271e5341aad609013aeeca (patch)
treea9b5ecaaeff1cd19f3c35114e2ffa56e97e447b6 /Master/texmf-dist/tex/latex/fontspec
parentb450abde949b2a7193ba4062666fb892253d26dd (diff)
fontspec (18sep10)
git-svn-id: svn://tug.org/texlive/trunk@19796 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontspec')
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty8
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.cfg4
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.lua1
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.sty146
4 files changed, 114 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
index 0b3bac075ee..67e9a2675ba 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
@@ -14,15 +14,17 @@
%%
%%
\ProvidesPackage{fontspec-patches}
- [2010/08/01 v2.0c Advanced font selection for XeLaTeX/LuaLaTeX]
-
+ [2010/09/19 v2.1 Advanced font selection for XeLaTeX/LuaLaTeX]
\ExplSyntaxOn
\RequirePackage{fixltx2e}[2006/03/24]
\DeclareRobustCommand \em {
\@nomath\em
- \tl_if_eq:xxTF \f@shape \itdefault \eminnershape \emshape
+ \tl_if_eq:xxTF \f@shape \itdefault \eminnershape
+ {
+ \tl_if_eq:xxTF \f@shape \sldefault \eminnershape \emshape
+ }
}
\DeclareTextFontCommand{\emph}{\em}
\let\emshape\itshape
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
index bae05d1c630..95111cba254 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
@@ -1,8 +1,10 @@
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% FOR BACKWARDS COMPATIBILITY WITH PREVIOUS VERSIONS %%%
+\aliasfontfeatureoption{Ligatures}{Historic}{Historical}
+\let\newfontinstance\newfontfamily
+
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
index 8303421e1c0..34904eb5030 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
@@ -15,7 +15,6 @@
--
-
fontspec = { }
fontspec.module = {
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
index a0c8c5684db..2820cfd99a2 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
@@ -14,8 +14,7 @@
%%
%%
\ProvidesPackage{fontspec}
- [2010/08/01 v2.0c Advanced font selection for XeLaTeX/LuaLaTeX]
-
+ [2010/09/19 v2.1 Advanced font selection for XeLaTeX/LuaLaTeX]
\RequirePackage{expl3,xparse}
@@ -225,6 +224,24 @@
{
Font~ \zf@fontname\space does~ not~ contain~ any~ OpenType~ `Script'~ information.
}
+\msg_new:nnn {fontspec} {opa-twice}
+{
+ Opacity~ set~ twice,~ in~ both~ Colour~ and~ Opacity.\\
+ Using~ specification~ "Opacity=#1".
+}
+\msg_new:nnn {fontspec} {opa-twice-col}
+{
+ Opacity~ set~ twice,~ in~ both~ Opacity~ and~ Colour.\\
+ Using~ an~ opacity~ specification~ in~ hex~ of~ "#1/FF".
+}
+\msg_new:nnn {fontspec} {bad-colour}
+{
+ Bad~ colour~ declaration~ "#1".~
+ Colour~ must~ be~ one~ of:\\
+ *~ a~ named~ xcolor~ colour\\
+ *~ a~ six-digit~ hex~ colour~ RRGGBB\\
+ *~ an~ eight-digit~ hex~ colour~ RRGGBBTT~ with~ opacity
+}
\DeclareOption{cm-default}{
\fontspec_warning:n {cm-default-obsolete}
}
@@ -257,7 +274,18 @@
\tl_set_eq:NN \cyrillicencoding \zf@enc
\tl_set_eq:NN \latinencoding \zf@enc
}
+\xetex_or_luatex:nn
+{
+ \RequirePackage{xunicode}
+}
+{
+ \cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile
+ \cs_set:Npn \XeTeXpicfile {}
+ \RequirePackage{xunicode}
+ \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp:
+}
\DeclareDocumentCommand \fontspec { O{} m } {
+ \fontencoding {\zf@enc}
\fontspec_set_family:Nnn \f@family {#1}{#2}
\selectfont
\ignorespaces
@@ -298,6 +326,7 @@
\fontspec_select:nn{#2}{#3}
\use:x {
\exp_not:N \DeclareRobustCommand \exp_not:N #1 {
+ \exp_not:N \fontencoding {\zf@enc}
\exp_not:N \fontfamily {\zf@family} \exp_not:N \selectfont
}
}
@@ -403,7 +432,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\use:c{zf@family@fontdef\f@family}"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt}
\ifzf@atsui
\fontspec_make_AAT_feature_string:nn{#1}{#2}
\ifx\@tempa\@empty
@@ -420,7 +449,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\prg_return_true:
@@ -433,7 +462,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\int_set:Nn \c@zf@script
@@ -452,7 +481,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\fontspec_iv_str_to_num:n{#1} \c@zf@script = \l_fontspec_strnum_int \relax
@@ -467,7 +496,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false:
@@ -480,7 +509,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl}
@@ -496,7 +525,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_set:Nn \l_fontspec_script_tl {#1}
@@ -511,7 +540,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_if_eq:nvTF {#1} {g_fontspec_script_(\zf@family)_tl}
@@ -525,7 +554,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_if_eq:nvTF {#1} {g_fontspec_lang_(\zf@family)_tl}
@@ -542,6 +571,14 @@
\fontspec_select:nn {#2}{#3}
\tl_set_eq:NN #1 \zf@family
}
+\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_fontwrap:n #1 } { "#1" } { {#1} }
+\cs_set:Npn \fontspec_fontwrap:n #1 { "#1" }
+\cs_new:Npn \font_set:Nnn #1#2#3 {
+ \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop:
+}
+\cs_new:Npn \font_gset:Nnn #1#2#3 {
+ \global \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop:
+}
\cs_set:Npn \fontspec_select:nn #1#2 {
\begingroup
\fontspec_init:
@@ -573,9 +610,9 @@
\let\zf@fontname\zf@up
\fontspec_setkeys:xx {preparse} {\XKV@rm}
\let\zf@font@feat\XKV@rm
- \font\zf@basefont="\fontspec_fullname:n {\zf@up}"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt}
\fontspec_set_font_type:
- \global\font\zf@basefont="\fontspec_fullname:n {\zf@up}"~at~\f@size pt
+ \font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt}
\zf@basefont % this is necessary for LuaLaTeX to check the scripts properly
}
\prg_new_conditional:Nnn \fontspec_if_detect_external:n {T}
@@ -595,21 +632,20 @@
}
%% Now we have a unique (in fact, too unique!) string that contains
\prg_new_conditional:Nnn \fontspec_save_family:n {T} {
- \unless\ifcsname zf@UID@\zf@family@long\endcsname
- \ifcsname c@zf@famc@#1\endcsname
- \expandafter\global\expandafter\advance
- \csname c@zf@famc@#1\endcsname\@ne
- \else
- \expandafter\global\expandafter\newcount
- \csname c@zf@famc@#1\endcsname
- \fi
+ \cs_if_exist:cF {g_fontspec_UID_\zf@family@long}
+ {
+ \cs_if_exist:cTF {g_fontspec_family_#1_int} {
+ \int_gincr:c {g_fontspec_family_#1_int}
+ }{
+ \int_new:c {g_fontspec_family_#1_int}
+ }
\edef\@tempa{#1~}
- \cs_gset:cpx{zf@UID@\zf@family@long}{
+ \tl_gset:cx {g_fontspec_UID_\zf@family@long} {
\expandafter\zap@space\@tempa\@empty
- (\expandafter\the\csname c@zf@famc@#1\endcsname)
+ ( \int_use:c {g_fontspec_family_#1_int} )
}
- \fi
- \xdef\zf@family{\@nameuse{zf@UID@\zf@family@long}}
+ }
+ \tl_gset:Nv \zf@family {g_fontspec_UID_\zf@family@long}
\cs_if_exist:cTF {zf@family@fontname\zf@family}
\prg_return_false: \prg_return_true:
}
@@ -747,10 +783,10 @@
\begingroup
\edef\@tempa{#1}
\unless\ifx\@tempa\@empty
- \font\@tempfonta="\fontspec_fullname:n {#1}"~at~\f@size pt
+ \font_set:Nnn \@tempfonta {\fontspec_fullname:n {#1}} {\f@size pt}
\edef\@tempa{\fontname\@tempfonta}
\fi
- \font\@tempfontb="\fontspec_fullname:n {#1#2}"~at~\f@size pt
+ \font_set:Nnn \@tempfontb {\fontspec_fullname:n {#1#2}} {\f@size pt}
\edef\@tempb{\fontname\@tempfontb}
\ifx\@tempa\@tempb
\fontspec_info:nx {no-font-shape} {#1#2}
@@ -779,9 +815,11 @@
{
\fontspec_get_features:n{#4}
\tl_set:Nx \l_fontspec_nfss_tl {
- <-> \l_fontspec_scale_tl "
- \fontspec_fullname:n {\zf@fontname} :
- \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 "
+ <-> \l_fontspec_scale_tl
+ \fontspec_fontwrap:n {
+ \fontspec_fullname:n {\zf@fontname} :
+ \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1
+ }
}
}
{
@@ -794,8 +832,10 @@
\fontspec_get_features:n{#4,\XKV@rm}
\tl_put_right:Nx \l_fontspec_nfss_tl {
<\l_fontspec_size_tl> \l_fontspec_scale_tl
- " \fontspec_fullname:n { \l_fontspec_sizedfont_tl }
- : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 "
+ \fontspec_fontwrap:n {
+ \fontspec_fullname:n { \l_fontspec_sizedfont_tl }
+ : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1
+ }
}
}
}
@@ -841,14 +881,14 @@
\cs_set:Npn \fontspec_get_features:n #1 {
\let\l_fontspec_rawfeatures_sclist \@empty
\tl_clear:N \l_fontspec_scale_tl
+ \tl_set_eq:NN \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl
\let\zf@adjust \@empty
\fontspec_setkeys:xx {options} {#1}
\tl_if_empty:NF \XKV@rm {
\fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm }
}
- \cs_if_exist:NT \l_fontspec_hexcol_tl {
- \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl}
- }
+ \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl}
}
\tl_clear:N \zf@bf
\tl_clear:N \zf@it
@@ -870,7 +910,8 @@
\tl_clear:N \l_fontspec_lang_name_tl
\tl_clear:N \l_fontspec_lang_tl
\clist_clear:N \l_fontspec_sizefeat_clist
-\tl_set:Nn \l_fontspec_opacity_tl {FF}
+\tl_new:Nn \g_fontspec_hexcol_tl {000000}
+\tl_new:Nn \g_fontspec_opacity_tl {FF~}
\newcommand*\fontspec_init:{
\zf@icufalse
\zf@firsttimetrue
@@ -1334,17 +1375,42 @@
\convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl
}
{
- \tl_set:Nn \l_fontspec_hexcol_tl {#1}
+ \intexpr_compare:nTF { \tl_elt_count:n {#1} == 6 }
+ { \tl_set:Nn \l_fontspec_hexcol_tl {#1} }
+ {
+ \intexpr_compare:nTF { \tl_elt_count:n {#1} == 8 }
+ { \fontspec_parse_colour:viii #1 }
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {bad-colour} {#1}
+ \fi
+ }
+ }
}
}
+\cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8 {
+ \tl_set:Nn \l_fontspec_hexcol_tl {#1#2#3#4#5#6}
+ \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {opa-twice-col} {#7#8}
+ \fi
+ }
+ \tl_set:Nn \l_fontspec_opacity_tl {#7#8}
+}
\keyval@alias@key[zf]{options}{Color}{Colour}
\newcounter{fontspec_tmp_int}
\define@key[zf]{options}{Opacity}{
\zf@update@family{+opac:#1}
\setcounter {fontspec_tmp_int} { 255*\real{#1} }
- \tl_set:Nx \l_fontspec_opacity_tl {
- \nhex2 { \value{fontspec_tmp_int} }
- }
+ \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {opa-twice} {#1}
+ \fi
+ }
+ \tl_set:Nx \l_fontspec_opacity_tl
+ { \nhex2 { \value{fontspec_tmp_int} } }
}
\xetex_or_luatex:nnn {
\define@key[zf]{options}{Mapping}