summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-11-08 15:58:58 +1100
committerChris Johns <chrisj@rtems.org>2016-11-08 15:58:58 +1100
commit2fdbc9826f31ba7c890a7b9e4fcfebcb2a4bad8b (patch)
tree403771e96e664d5ce41c1ffaf05788b543c3da92
parent53bb72e99669750ecbd7a418047711a21e32ac40 (diff)
downloadrtems-docs-2fdbc9826f31ba7c890a7b9e4fcfebcb2a4bad8b.tar.bz2
waf: Use the good fonts if installed.
-rw-r--r--common/latex.py28
-rw-r--r--common/latex/rtemsextrafonts-null.sty1
-rw-r--r--common/latex/rtemsextrafonts.sty11
-rw-r--r--common/rtemsstyle.sty13
-rw-r--r--common/waf.py18
5 files changed, 49 insertions, 22 deletions
diff --git a/common/latex.py b/common/latex.py
index 2cc3101..b3ca60c 100644
--- a/common/latex.py
+++ b/common/latex.py
@@ -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'
diff --git a/common/latex/rtemsextrafonts-null.sty b/common/latex/rtemsextrafonts-null.sty
new file mode 100644
index 0000000..350431f
--- /dev/null
+++ b/common/latex/rtemsextrafonts-null.sty
@@ -0,0 +1 @@
+% Empty
diff --git a/common/latex/rtemsextrafonts.sty b/common/latex/rtemsextrafonts.sty
new file mode 100644
index 0000000..eb7ef47
--- /dev/null
+++ b/common/latex/rtemsextrafonts.sty
@@ -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
diff --git a/common/rtemsstyle.sty b/common/rtemsstyle.sty
index 441c454..5bf5c26 100644
--- a/common/rtemsstyle.sty
+++ b/common/rtemsstyle.sty
@@ -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}
diff --git a/common/waf.py b/common/waf.py
index 0086be0..c1d3f81 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -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"]: