diff options
author | Karl Berry <karl@freefriends.org> | 2011-02-26 23:47:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-02-26 23:47:28 +0000 |
commit | f07534a834462ff702e6d3a52dbd795f4f7262ad (patch) | |
tree | 80f1ba95ba5652c9a76c4a2e7851395649a5c6f1 /Master/texmf-dist/tex | |
parent | ddb39646bb545ff15c6a16a71e32ad697cddf11a (diff) |
fontspec (26feb11)
git-svn-id: svn://tug.org/texlive/trunk@21527 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fontspec/fontspec.lua | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fontspec/fontspec.sty | 106 |
3 files changed, 75 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty index 6f92f41bdb0..4d0c28169ff 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2010 Will Robertson and Khaled Hosny +%% (C) 2004--2011 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec-patches} - [2010/11/17 v2.1e Advanced font selection for XeLaTeX/LuaLaTeX] + [2011/02/26 v2.1f Advanced font selection for XeLaTeX/LuaLaTeX] \ExplSyntaxOn @@ -102,7 +102,7 @@ }{} } %% -%% Copyright 2004--2010 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2011 Will Robertson <wspr81@gmail.com> %% Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index 801f9e4de2d..a6b5528391a 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua @@ -8,7 +8,7 @@ -- -- _________________________________________ -- The fontspec package for XeLaTeX/LuaLaTeX --- (C) 2004--2010 Will Robertson and Khaled Hosny +-- (C) 2004--2011 Will Robertson and Khaled Hosny -- -- License information appended. -- @@ -134,7 +134,7 @@ function fontspec.mathfontdimen(fnt, str) end end -- --- Copyright 2004--2010 Will Robertson <wspr81@gmail.com> +-- Copyright 2004--2011 Will Robertson <wspr81@gmail.com> -- Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org> -- -- Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index ebac6a7c599..9586ccfcf51 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty @@ -8,28 +8,32 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2010 Will Robertson and Khaled Hosny +%% (C) 2004--2011 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec} - [2010/11/17 v2.1e Advanced font selection for XeLaTeX/LuaLaTeX] + [2011/02/26 v2.1f Advanced font selection for XeLaTeX/LuaLaTeX] \RequirePackage{expl3,xparse} \input binhex.tex % before expl syntax! \ExplSyntaxOn -\msg_new:nnn {fontspec} {not-pdftex} +\msg_new:nnn {fontspec} {cannot-use-pdftex} { - Requires~ XeTeX~ or~ LuaTeX~ to~ function! + The~ fontspec~ package~ requires~ either~ XeTeX~ or~ LuaTeX~ to~ function. + \\\\ + You~ must~ change~ your~ typesetting~ engine~ to,~ + e.g.,~ "xelatex"~ or~ "lualatex"\\ + instead~ of~ plain~ "latex"~ or~ "pdflatex". } \xetex_if_engine:F { \luatex_if_engine:TF { \RequirePackage{luaotfload} \RequireLuaModule{fontspec} }{ - \msg_fatal:nn {fontspec} {not-pdftex} + \msg_fatal:nn {fontspec} {cannot-use-pdftex} } } \xetex_if_engine:TF @@ -99,6 +103,15 @@ Size~ information~ must~ be~ supplied.\\ For~ example,~ SizeFeatures={Size={8-12},...}. } +\msg_new:nnnn {fontspec} {font-not-found} +{ + The~ font~ "#1"~ cannot~ be~ found. +} +{ + A~font~might~not~be~found~for~many~reasons.\\ + Check~the~spelling,~where~the~font~is~installed~etc.~etc.\\\\ + When~in~doubt,~ask~someone~for~help! +} \msg_new:nnnn {fontspec} {rename-feature-not-exist} { The~ feature~ #1~ doesn't~ appear~ to~ be~ defined. @@ -469,7 +482,7 @@ } \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt} \bool_if:NTF \l_fontspec_atsui_bool { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: @@ -482,7 +495,7 @@ } \prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: \bool_if:NTF \l_fontspec_icu_bool \prg_return_true: \prg_return_false: }{ @@ -491,7 +504,7 @@ } \prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: \bool_if:NTF \l_fontspec_icu_bool { \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} @@ -508,7 +521,7 @@ } \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: \bool_if:NTF \l_fontspec_icu_bool { \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} @@ -523,7 +536,7 @@ } \prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: \bool_if:NTF \l_fontspec_icu_bool { \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: @@ -536,7 +549,7 @@ } \prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: \bool_if:NTF \l_fontspec_icu_bool { \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} @@ -551,7 +564,7 @@ } \prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: \bool_if:NTF \l_fontspec_icu_bool { \tl_set:Nn \l_fontspec_script_tl {#1} @@ -566,7 +579,7 @@ } \prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: \bool_if:NTF \l_fontspec_icu_bool { \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} @@ -580,7 +593,7 @@ } \prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} { \fontspec_if_fontspec_font:TF { - \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: \bool_if:NTF \l_fontspec_icu_bool { \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} @@ -598,12 +611,30 @@ } \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_fontwrap:n #1 } { "#1" } { {#1} } \cs_set:Npn \fontspec_fontwrap:n #1 { "#1" } -\cs_set_eq:NN \font_set_eq:NN \tex_let:D -\cs_new:Npn \font_set:Nnn #1#2#3 { - \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop: +\cs_if_free:NT \font_set_eq:NN { + \cs_set_eq:NN \font_set_eq:NN \tex_let:D + \cs_set:Npn \font_set:Nnn #1#2#3 { + \font #1 = #2 ~at~ #3\scan_stop: + } + \cs_set:Npn \font_gset:Nnn #1#2#3 { + \global \font #1 = #2 ~at~ #3 \scan_stop: + } + \xetex_or_luatex:nnn {\cs_set:Npn \font_suppress_not_found_error:} + {\suppressfontnotfounderror=1} + {\luatexsuppressfontnotfounderror=1} + \prg_set_conditional:Nnn \font_if_null:N {p,TF,T,F} { + \ifx #1 \nullfont + \prg_return_true: + \else + \prg_return_false: + \fi + } +} +\cs_new:Nn \fontspec_font_set:Nnn { + \font_set:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} } -\cs_new:Npn \font_gset:Nnn #1#2#3 { - \global \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop: +\cs_new:Nn \fontspec_font_gset:Nnn { + \font_gset:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} } \prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} { \etex_iffontchar:D #1 #2 \scan_stop: @@ -614,6 +645,7 @@ } \cs_set:Npn \fontspec_select:nn #1#2 { \group_begin: + \font_suppress_not_found_error: \fontspec_init: \tl_set:Nx \l_fontspec_fontname_tl {#2} \luatex_if_engine:T { @@ -622,6 +654,11 @@ \tl_set_eq:NN \l_fontspec_fontid_tl \l_fontspec_fontname_tl \tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl \fontspec_preparse_features:nn {#1}{#2} + \fontspec_font_set:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} + \font_if_null:NT \zf@basefont { \fontspec_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} } + \fontspec_set_font_type: + \fontspec_font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} + \zf@basefont % this is necessary for LuaLaTeX to check the scripts properly \fontspec_set_scriptlang: \fontspec_get_features:n {} \bool_set_false:N \l_fontspec_firsttime_bool @@ -646,10 +683,6 @@ \tl_set_eq:NN \l_fontspec_fontname_tl \l_fontspec_fontname_up_tl \fontspec_setkeys:xx {preparse} {\XKV@rm} \clist_set_eq:NN \l_fontspec_fontfeat_clist \XKV@rm - \font_set:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} - \fontspec_set_font_type: - \font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\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} { @@ -744,7 +777,7 @@ \cs_new:Npn \fontspec_set_bold: { \bool_if:NF \l_fontspec_nobf_bool { \tl_if_empty:NTF \l_fontspec_fontname_bf_tl { - \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/B} + \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/B} \bfdefault \updefault \l_fontspec_fontfeat_bf_clist }{ \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl @@ -755,7 +788,7 @@ \cs_new:Npn \fontspec_set_italic: { \bool_if:NF \l_fontspec_noit_bool { \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} } + { \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} } { \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl } \mddefault \itdefault \l_fontspec_fontfeat_it_clist } @@ -774,14 +807,14 @@ { \tl_if_empty:NTF \l_fontspec_fontname_it_tl { - \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} + \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} } { - \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} + \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} } } { - \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} + \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} } } { @@ -793,7 +826,7 @@ \cs_new:Npn \fontspec_set_bold_slanted: { \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl { \tl_if_empty:NF \l_fontspec_fontname_sl_tl { - \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B} + \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B} \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist } }{ @@ -831,9 +864,9 @@ { \bool_set_true:N \l_fontspec_icu_bool } -\cs_new:Nn \fontspec_make_font_shapes:nnnnn { - \font_set:Nnn \l_tmpa_font {\fontspec_fullname:n {#1}} {\f@size pt} - \font_set:Nnn \l_tmpb_font {\fontspec_fullname:n {#1#2}} {\f@size pt} +\cs_new:Nn \fontspec_make_auto_font_shapes:nnnnn { + \fontspec_font_set:Nnn \l_tmpa_font {\fontspec_fullname:n {#1}} {\f@size pt} + \fontspec_font_set:Nnn \l_tmpb_font {\fontspec_fullname:n {#1#2}} {\f@size pt} \str_if_eq:xxTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } { \fontspec_info:nx {no-font-shape} {#1#2} } { @@ -843,7 +876,8 @@ \cs_new:Nn \fontspec_make_font_shapes:nnnn { \group_begin: \tl_set:Nx \l_fontspec_fontname_tl {#1} - \font_set:Nnn \zf@basefont {\fontspec_fullname:n {#1}} {\f@size pt} + \fontspec_font_set:Nnn \zf@basefont {\fontspec_fullname:n {#1}} {\f@size pt} + \font_if_null:NT \zf@basefont { \fontspec_error:nx {font-not-found} {#1} } \fontspec_declare_shape:nnnn {}{#2}{#3}{#4} \tl_if_empty:NTF \l_fontspec_fontname_sc_tl { \bool_if:NF \l_fontspec_nosc_bool { @@ -1016,7 +1050,6 @@ { \cs_set_eq:NN \fontspec_make_smallcaps:T \fontspec_make_ot_smallcaps:T } -\cs_set_eq:NN \sclist_new:N \tl_new:N \cs_set_eq:NN \sclist_clear:N \tl_clear:N \cs_new:Npn \sclist_gput_right:Nn #1#2 { \tl_gput_right:Nn #1 {#2;} @@ -1024,7 +1057,7 @@ \cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} \cs_new:Nn \fontspec_update_featstr:n { \bool_if:NF \l_fontspec_firsttime_bool { - \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1;} + \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} } } \cs_new:Npn \fontspec_make_feature:nnn #1#2#3 { @@ -1626,6 +1659,7 @@ \fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} \fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} \fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} +\fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} \fontspec_define_font_feature:n{Numbers} \fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} \fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} @@ -2210,7 +2244,7 @@ {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} } %% -%% Copyright 2004--2010 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2011 Will Robertson <wspr81@gmail.com> %% Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, |