waf: Use the good fonts if installed.

This commit is contained in:
Chris Johns 2016-11-08 15:58:58 +11:00
parent 53bb72e996
commit 2fdbc9826f
5 changed files with 49 additions and 22 deletions

View File

@ -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'

View File

@ -0,0 +1 @@
% Empty

View 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

View File

@ -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}

View File

@ -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"]: