summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fontspec
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-07-11 22:45:47 +0000
committerKarl Berry <karl@freefriends.org>2010-07-11 22:45:47 +0000
commit06225999a570c8450530342ebf5f7e72a2e25846 (patch)
tree85b43561c8a6af45c02be769c441d17e27b1f71e /Master/texmf-dist/tex/latex/fontspec
parent6167f82118ec565f0cc686d68fc7bece5e8dbb9b (diff)
fontspec 2.0a (11jul10)
git-svn-id: svn://tug.org/texlive/trunk@19384 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.sty3
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.cfg1
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.lua39
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.sty90
4 files changed, 42 insertions, 91 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
index 9a228421de2..73bda2464b5 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
@@ -14,7 +14,8 @@
%%
%%
\ProvidesPackage{fontspec-patches}
- [2010/06/08 v2.0 Advanced font selection for XeLaTeX/LuaLaTeX]
+ [2010/07/11 v2.0a Advanced font selection for XeLaTeX/LuaLaTeX]
+
\ExplSyntaxOn
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
index 7ecb2df2c4d..bae05d1c630 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
@@ -1,6 +1,7 @@
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% FOR BACKWARDS COMPATIBILITY WITH PREVIOUS VERSIONS %%%
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
index b777424cfeb..8303421e1c0 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
@@ -15,6 +15,7 @@
--
+
fontspec = { }
fontspec.module = {
@@ -100,22 +101,11 @@ local function check_feature(id, feature, language, script)
end
-local function font_id(str)
- local id
- if tex.luatexversion >= 47 then
- id = font.id(str)
- else
- id = token.create(str)[2]
- end
- return id
-end
-
-
local function tempswatrue() fontspec.sprint([[\@tempswatrue]]) end
local function tempswafalse() fontspec.sprint([[\@tempswafalse]]) end
function fontspec.check_ot_script(fnt, script)
- if check_script(font_id(fnt), script) then
+ if check_script(font.id(fnt), script) then
tempswatrue()
else
tempswafalse()
@@ -123,7 +113,7 @@ function fontspec.check_ot_script(fnt, script)
end
function fontspec.check_ot_lang(fnt, lang, script)
- if check_language(font_id(fnt), lang, script) then
+ if check_language(font.id(fnt), lang, script) then
tempswatrue()
else
tempswafalse()
@@ -137,34 +127,13 @@ function fontspec.check_ot_feat(fnt, feat, lang, script)
return
end
end
- if check_feature(font_id(fnt), feat, lang, script) then
+ if check_feature(font.id(fnt), feat, lang, script) then
tempswatrue()
else
tempswafalse()
end
end
-function fontspec.charglyph(char)
- if char then
- local id, c
- if utf.len(char) > 1 then
- c = utf.byte(utf.char(char:gsub('"', '0x')))
- else
- c = utf.byte(char)
- end
-
- id = font.current()
-
- if font.fonts[id]["characters"][c] then
- return font.fonts[id]["characters"][c].index
- else
- return 0
- end
- else
- return 0
- end
-end
-
--
-- Copyright 2004--2010 Will Robertson <wspr81@gmail.com>
-- Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org>
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
index afb20ff702c..bed70f621fb 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
@@ -14,7 +14,8 @@
%%
%%
\ProvidesPackage{fontspec}
- [2010/06/08 v2.0 Advanced font selection for XeLaTeX/LuaLaTeX]
+ [2010/07/11 v2.0a Advanced font selection for XeLaTeX/LuaLaTeX]
+
\RequirePackage{expl3,xparse}
@@ -65,6 +66,13 @@
\cs_set:Npn \use:x #1 { \edef\@tempa{#1}\@tempa }
\cs_set:Npn \use_v:nnnnn #1#2#3#4#5 {#5}
\cs_set:Npn \use_iv:nnnnn #1#2#3#4#5 {#4}
+\prg_new_conditional:Nnn \fontspec_glyph_if_exist:Nn {p,TF,T,F} {
+ \etex_iffontchar:D #1 #2 \scan_stop:
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+}
\cs_new:Npn \fontspec_setkeys:xx #1#2
{
\use:x { \exp_not:N \setkeys*[zf]{#1}{#2} }
@@ -96,7 +104,7 @@
}
\msg_new:nnn {fontspec} {no-glyph}
{
- '\zf@fontname'~ doesn't~ appear~ to~ have~ the~ glyph~ corresponding~ to~ '#1'.
+ '\zf@fontname'~ does~ not~ contain~ glyph~ #1.
}
\msg_new:nnnn {fontspec} {unknown-options}
{
@@ -611,10 +619,8 @@
\fontspec_check_script:nTF {latn}
{
\tl_set:Nn \l_fontspec_script_name_tl {Latin}
- \tl_set:Nn \l_fontspec_script_tl {latn}
- \tl_if_empty:NT \l_fontspec_lang_tl {
+ \tl_if_empty:NT \l_fontspec_lang_name_tl {
\tl_set:Nn \l_fontspec_lang_name_tl {Default}
- \tl_set:Nn \l_fontspec_lang_tl {DFLT}
}
\fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl}
\fontspec_setkeys:xxx {feat} {Lang} {\l_fontspec_lang_name_tl}
@@ -624,9 +630,8 @@
}
}
{
- \tl_if_empty:NT \l_fontspec_lang_tl {
+ \tl_if_empty:NT \l_fontspec_lang_name_tl {
\tl_set:Nn \l_fontspec_lang_name_tl {Default}
- \tl_set:Nn \l_fontspec_lang_tl {DFLT}
}
\fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl}
\fontspec_setkeys:xxx {feat} {Lang} {\l_fontspec_lang_name_tl}
@@ -1302,53 +1307,26 @@
}
\define@key[zf]{options}{HyphenChar}{
\zf@update@family{+hyphenchar:#1}
- \edef\@tempa{#1}
- \edef\@tempb{None}
- \ifx\@tempa\@tempb
- \xetex_or_luatex:nnn { \g@addto@macro\zf@adjust }
- { \hyphenchar\font-1\relax }
- { \luatexprehyphenchar=-1\relax }
- \else
- \zf@check@one@char#1\zf@@
- \ifx\@tempb\@empty
- \xetex_or_luatex:nn {
- {\zf@basefont\expandafter\ifnum\expandafter\XeTeXcharglyph
- \expandafter`#1 > \z@
- \g@addto@macro\zf@adjust{%
- {\expandafter\hyphenchar\expandafter
- \font\expandafter`#1}}%
- \else
- \fontspec_error:nx {no-glyph}{#1}
- \fi}%
- }{
- \ifnum\directlua{
- fontspec.sprint(fontspec.charglyph('#1', 'zf@basefont'))
- } > \z@
- \g@addto@macro\zf@adjust{\luatexprehyphenchar=`#1\relax}
- \else
- \fontspec_error:nx {no-glyph}{#1}
- \fi
- }
- \else
- \xetex_or_luatex:nn {
- {\zf@basefont\ifnum\XeTeXcharglyph#1 > \z@
- \g@addto@macro\zf@adjust{\hyphenchar\font#1\relax}%
- \else
- \fontspec_error:nx {no-glyph}{#1}
- \fi}%
- }{
- \ifnum\directlua{
- fontspec.sprint(fontspec.charglyph('#1', 'zf@basefont'))
- } > \z@
- \g@addto@macro\zf@adjust{\luatexprehyphenchar=#1\relax}
- \else
- \fontspec_error:nx {no-glyph}{#1}
- \fi
- }
- \fi
- \fi
+ \tl_if_eq:nnTF {#1} {None}
+ {
+ \tl_put_right:Nn \zf@adjust { \hyphenchar \font = \c_minus_one }
+ }
+ {
+ \tl_if_single:nTF {#1}
+ { \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} }
+ { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} }
+ \fontspec_glyph_if_exist:NnTF \zf@basefont {\l_fontspec_hyphenchar_tl}
+ {
+ \xetex_or_luatex:nnn { \tl_put_right:Nn \zf@adjust }
+ { \hyphenchar \font = \l_fontspec_hyphenchar_tl \scan_stop: }
+ {
+ \hyphenchar \font = \c_zero
+ \luatexprehyphenchar = \l_fontspec_hyphenchar_tl \scan_stop:
+ }
+ }
+ { \fontspec_error:nx {no-glyph}{#1} }
+ }
}
-\def\zf@check@one@char#1#2\zf@@{\def\@tempb{#2}}
\define@key[zf]{options}{Color}{
\zf@update@family{+col:#1}
\cs_if_exist:cTF {\token_to_str:N\color@#1}
@@ -1509,7 +1487,6 @@
\zf@define@feature@option{Numbers}{NoSlashedZero}{14}{4}{-zero}
\luatex_if_engine:T {
\zf@define@feature@option{Numbers}{Arabic}{}{}{+anum}
- \zf@define@feature@option{Numbers}{Farsi} {}{}{+anum}
}
\zf@define@font@feature {Contextuals}
\zf@define@feature@option{Contextuals}{Swash} {} {} {+cswh}
@@ -1719,7 +1696,10 @@
\newfontlanguage{Spanish}{ESP}\newfontlanguage{Estonian}{ETI}
\newfontlanguage{Basque}{EUQ}\newfontlanguage{Evenki}{EVK}
\newfontlanguage{Even}{EVN}\newfontlanguage{Ewe}{EWE}
-\newfontlanguage{French~Antillean}{FAN}\newfontlanguage{Farsi}{FAR}
+\newfontlanguage{French~Antillean}{FAN}
+\newfontlanguage{Farsi}{FAR}
+\newfontlanguage{Parsi}{FAR}
+\newfontlanguage{Persian}{FAR}
\newfontlanguage{Finnish}{FIN}\newfontlanguage{Fijian}{FJI}
\newfontlanguage{Flemish}{FLE}\newfontlanguage{Forest~Nenets}{FNE}
\newfontlanguage{Fon}{FON}\newfontlanguage{Faroese}{FOS}