wkhtmltopdf isn't using a fixed-width font for CSS font-family:monospace. Nor is it using one for <PRE> <CODE> or <TT> elements. Add in some Courier fonts for it to use - note that Courier 10 Pitch is installed on Ubuntu by default. Note these fonts need to be installed on the system that generates the pdf documentation. Previously the htmldoc stylesheet was kept in place and the SWIG stylesheet was prepended to it inline in SWIGDocumentation.html. Now the SWIG stylesheet has been amended with most of the htmldoc stylesheet changes and completely replaced after htmldoc is run.
30 lines
589 B
Python
30 lines
589 B
Python
#!/usr/bin/python
|
|
|
|
# Replace the inline htmldoc stylesheet with the SWIG stylesheet
|
|
|
|
import sys
|
|
import string
|
|
|
|
filename = sys.argv[1]
|
|
|
|
data = open(filename).read()
|
|
open(filename+".bak","w").write(data)
|
|
|
|
swigstyle = "\n" + open("style.css").read()
|
|
|
|
lines = data.splitlines()
|
|
result = [ ]
|
|
skip = False
|
|
for s in lines:
|
|
if not skip:
|
|
result.append(s)
|
|
if s == "<STYLE TYPE=\"text/css\"><!--":
|
|
result.append(swigstyle)
|
|
skip = True
|
|
elif s == "--></STYLE>":
|
|
result.append(s)
|
|
skip = False
|
|
|
|
data = "\n".join(result)
|
|
|
|
open(filename,"w").write(data)
|