mirror of
https://git.rtems.org/rtems-docs/
synced 2025-07-22 05:47:16 +08:00
waf: Use the good fonts if installed.
This commit is contained in:
parent
53bb72e996
commit
2fdbc9826f
@ -39,11 +39,13 @@ package_tests = {
|
||||
'hypcap' : ['\\usepackage{hyperref}',
|
||||
'\\usepackage{hypcap}'],
|
||||
'hyperref' : ['\\usepackage{hyperref}'],
|
||||
'inconsolata' : ['\\usepackage{inconsolata}'],
|
||||
'ifplatform' : ['\\usepackage{ifplatform}'],
|
||||
'ifthen' : ['\\usepackage{ifthen}'],
|
||||
'inputenc' : ['\\usepackage{inputenc}'],
|
||||
'keyval' : ['\\usepackage{keyval}'],
|
||||
'kvoptions' : ['\\usepackage{kvoptions}'],
|
||||
'lato' : ['\\usepackage{lato}'],
|
||||
'lineno' : ['\\usepackage{lineno}'],
|
||||
'longtable' : ['\\usepackage{longtable}'],
|
||||
'makeidx' : ['\\usepackage{makeidx}'],
|
||||
@ -60,6 +62,8 @@ package_tests = {
|
||||
'xcolor' : ['\\usepackage{xcolor}'],
|
||||
'xstring' : ['\\usepackage{xstring}'],
|
||||
}
|
||||
package_optional = ['inconsolata',
|
||||
'lato']
|
||||
|
||||
#
|
||||
# Add per host support. If there is a version clash for the same texlive
|
||||
@ -124,11 +128,12 @@ def configure_tests(conf):
|
||||
|
||||
tests = sorted(package_tests.keys())
|
||||
local_packs = local_packages()
|
||||
excludes = package_optional
|
||||
if local_packs is not None:
|
||||
excludes = [p[:p.rfind('.')] for p in local_packs]
|
||||
for e in excludes:
|
||||
if e in tests:
|
||||
tests.remove(e)
|
||||
excludes += [p[:p.rfind('.')] for p in local_packs]
|
||||
for e in excludes:
|
||||
if e in tests:
|
||||
tests.remove(e)
|
||||
|
||||
fails = 0
|
||||
r = conf.find_program("pygmentize", mandatory = False)
|
||||
@ -145,3 +150,18 @@ def configure_tests(conf):
|
||||
fails += 1
|
||||
if fails > 0:
|
||||
conf.fatal('There are %d Tex package failures. Please fix.' % (fails))
|
||||
|
||||
fails = 0
|
||||
for t in package_optional:
|
||||
r = conf.test(build_fun = build_latex_test,
|
||||
msg = "Checking for Tex package '%s'" % (t),
|
||||
tex_test = t,
|
||||
okmsg = 'ok',
|
||||
errmsg = 'degraded fonts',
|
||||
mandatory = False)
|
||||
if r is None:
|
||||
fails += 1
|
||||
if fails == 0:
|
||||
conf.env.RTEMSEXTRAFONTS = 'rtemsextrafonts.sty'
|
||||
else:
|
||||
conf.env.RTEMSEXTRAFONTS = 'rtemsextrafonts-null.sty'
|
||||
|
1
common/latex/rtemsextrafonts-null.sty
Normal file
1
common/latex/rtemsextrafonts-null.sty
Normal file
@ -0,0 +1 @@
|
||||
% Empty
|
11
common/latex/rtemsextrafonts.sty
Normal file
11
common/latex/rtemsextrafonts.sty
Normal file
@ -0,0 +1,11 @@
|
||||
% Not widely used.
|
||||
\usepackage[defaultsans]{lato}
|
||||
\usepackage{inconsolata}
|
||||
|
||||
% fix single quotes, for inconsolata. (does not work)
|
||||
%%\usepackage{textcomp}
|
||||
%%\begingroup
|
||||
%% \catcode`'=\active
|
||||
%% \g@addto@macro\@noligs{\let'\textsinglequote}
|
||||
%% \endgroup
|
||||
%%\endinput
|
@ -137,15 +137,4 @@ gobble=0,
|
||||
|
||||
% fonts
|
||||
\usepackage{charter}
|
||||
% remove, not widely supported on some Linux hosts.
|
||||
%%\usepackage[defaultsans]{lato}
|
||||
% remove, not widely supported on some Linux hosts.
|
||||
%%\usepackage{inconsolata}
|
||||
|
||||
% fix single quotes, for inconsolata. (does not work)
|
||||
%%\usepackage{textcomp}
|
||||
%%\begingroup
|
||||
%% \catcode`'=\active
|
||||
%% \g@addto@macro\@noligs{\let'\textsinglequote}
|
||||
%% \endgroup
|
||||
%%\endinput
|
||||
\usepackage{rtemsextrafonts}
|
||||
|
@ -89,21 +89,27 @@ def build_dir_setup(ctx, buildtype):
|
||||
return build_dir, output_node, output_dir, doctrees
|
||||
|
||||
def pdf_resources(ctx, buildtype):
|
||||
packages_base = ctx.path.parent.find_dir('common/latex')
|
||||
if packages_base is None:
|
||||
ctx.fatal('Latex package directory not found')
|
||||
base = packages_base.path_from(ctx.path)
|
||||
fnode = ctx.path.get_bld().make_node(buildtype)
|
||||
fnode.mkdir()
|
||||
local_packages = latex.local_packages()
|
||||
if local_packages is not None:
|
||||
packages_base = ctx.path.parent.find_dir('common/latex')
|
||||
if packages_base is None:
|
||||
ctx.fatal('Latex package directory not found')
|
||||
base = packages_base.path_from(ctx.path)
|
||||
srcs = [os.path.join(base, p) for p in local_packages]
|
||||
fnode = ctx.path.get_bld().make_node(buildtype)
|
||||
fnode.mkdir()
|
||||
ctx(
|
||||
features = "subst",
|
||||
is_copy = True,
|
||||
source = srcs,
|
||||
target = [fnode.make_node(p) for p in local_packages]
|
||||
)
|
||||
ctx(
|
||||
features = "subst",
|
||||
is_copy = True,
|
||||
source = os.path.join(base, ctx.env.RTEMSEXTRAFONTS),
|
||||
target = fnode.make_node('rtemsextrafonts.sty')
|
||||
)
|
||||
|
||||
def html_resources(ctx, buildtype):
|
||||
for dir_name in ["_static", "_templates"]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user