sgt/halibut
11 years agoRevamp of the Halibut error handling mechanism. master git-svn
simon [Wed, 29 Aug 2012 18:13:11 +0000 (18:13 +0000)]
Revamp of the Halibut error handling mechanism.

I'm not quite sure why I ever thought it was a good idea to have a
central variadic error() function taking an integer error code
followed by some list of arguments that depend on that code. It now
seems obvious to me that it's a much more sensible idea to have a
separate function per error, so that we can check at compile time that
the arguments to each error call are of the right number and type! So
I've done that instead.

A side effect is that the errors are no longer formatted into a
fixed-size buffer before going to stderr, so I can remove all the
%.200s precautions in the format strings.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9639 cda61777-01e9-0310-a592-d414129be87e

11 years agoPatch from Maciej Adamczyk to set standard output to binary mode in
simon [Sun, 3 Jun 2012 20:51:47 +0000 (20:51 +0000)]
Patch from Maciej Adamczyk to set standard output to binary mode in
the standalone deflate utility modes, so you can redirect output to a
file and end up with correct data in that file.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9552 cda61777-01e9-0310-a592-d414129be87e

11 years agoMake the Deflate decoder correctly handle the special case of a
simon [Fri, 1 Jun 2012 19:37:14 +0000 (19:37 +0000)]
Make the Deflate decoder correctly handle the special case of a
dynamic block in which the backward-distances Huffman table contains
no entries at all. (In this situation it's impossible to use the
distance table, and therefore the block must contain nothing but
Huffman-coded literals.)

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9550 cda61777-01e9-0310-a592-d414129be87e

11 years agoOS X Lion's compiler spotted two missing casts, where we use %hu and
simon [Sun, 6 May 2012 11:33:05 +0000 (11:33 +0000)]
OS X Lion's compiler spotted two missing casts, where we use %hu and
pass something that isn't necessarily an unsigned short.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9493 cda61777-01e9-0310-a592-d414129be87e

11 years agoNow that you can specify negative indents in Halibut text mode, it's
simon [Fri, 4 May 2012 17:37:24 +0000 (17:37 +0000)]
Now that you can specify negative indents in Halibut text mode, it's
possible to specify an indent which is _overall_ negative, i.e.
intended to be off the left-hand side of the text file. There's no
nice way to handle this, but printing O(2^32) spaces in a while (n--)
loop is particularly bad. Fix the loop to read while (n-- > 0), so
that at least it doesn't get _that_ badly confused.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9491 cda61777-01e9-0310-a592-d414129be87e

11 years agoApply r6972 from my other copy of deflate.c: don't lose the BFINAL bit
simon [Thu, 3 May 2012 17:57:31 +0000 (17:57 +0000)]
Apply r6972 from my other copy of deflate.c: don't lose the BFINAL bit
on an uncompressed block.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9482 cda61777-01e9-0310-a592-d414129be87e

11 years agoRemove a bunch of unused variables spotted by Ubuntu 12.04's gcc.
simon [Thu, 3 May 2012 17:43:21 +0000 (17:43 +0000)]
Remove a bunch of unused variables spotted by Ubuntu 12.04's gcc.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9478 cda61777-01e9-0310-a592-d414129be87e

11 years agoAhem. Don't invert the length _twice_.
simon [Thu, 3 May 2012 17:40:08 +0000 (17:40 +0000)]
Ahem. Don't invert the length _twice_.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9476 cda61777-01e9-0310-a592-d414129be87e

11 years agoAdd an error check for correct formatting in Deflate uncompressed
simon [Thu, 3 May 2012 17:38:08 +0000 (17:38 +0000)]
Add an error check for correct formatting in Deflate uncompressed
block headers. (Ubuntu 12.04's gcc spotted that nlen was unused, which
it shouldn't have been.)

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9475 cda61777-01e9-0310-a592-d414129be87e

11 years agoBug in utoi(), which made it ignore a leading minus sign when
simon [Thu, 3 May 2012 17:34:51 +0000 (17:34 +0000)]
Bug in utoi(), which made it ignore a leading minus sign when
converting a number! Oops. Now you can do things like

\cfg{text-list-indent}{-2}
\cfg{text-listitem-indent}{2}

to get your bullets placed in the left margin rather than indenting
the paragraphs of your list.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9474 cda61777-01e9-0310-a592-d414129be87e

12 years agoAllow macro definitions to be terminated by tok_eof as well as
simon [Fri, 24 Feb 2012 18:43:54 +0000 (18:43 +0000)]
Allow macro definitions to be terminated by tok_eof as well as
tok_eop, to prevent Halibut tight-looping when a definition is the
last thing in a file.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9419 cda61777-01e9-0310-a592-d414129be87e

12 years agoFirst attempt at an Emacs mode that syntax-highlights Halibut markup.
simon [Tue, 9 Aug 2011 18:34:25 +0000 (18:34 +0000)]
First attempt at an Emacs mode that syntax-highlights Halibut markup.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9259 cda61777-01e9-0310-a592-d414129be87e

14 years agoA user recently reported that Halibut's font-file handling doesn't
simon [Sat, 27 Feb 2010 23:42:39 +0000 (23:42 +0000)]
A user recently reported that Halibut's font-file handling doesn't
work on Windows, because input files are never opened in binary
mode. Introduce a small piece of compensatory mechanism, which opens
files initially in binary mode and then reopens them as text if
they're determined not to match any binary file type. I hope.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8889 cda61777-01e9-0310-a592-d414129be87e

14 years agoClarify the section about backend-generic config options to make it
simon [Thu, 14 Jan 2010 19:01:36 +0000 (19:01 +0000)]
Clarify the section about backend-generic config options to make it
look less as if they're the _only_ config options.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8842 cda61777-01e9-0310-a592-d414129be87e

14 years agoEscape &<> when they appear in href text.
simon [Tue, 10 Nov 2009 19:03:11 +0000 (19:03 +0000)]
Escape &<> when they appear in href text.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8743 cda61777-01e9-0310-a592-d414129be87e

14 years agoAllow a hastily selected subset of the output formats to also accept
simon [Sat, 24 Oct 2009 09:33:21 +0000 (09:33 +0000)]
Allow a hastily selected subset of the output formats to also accept
"-" as a special file name meaning standard output. I've restricted
it to just those output formats which can predictably output only
one file, just for the sake of not having to faff too much with the
others.

Probably what I should have done for all of this would have been to
write a set of wrappers around fopen, fclose and everything in
between, and use them everywhere. Those wrappers would uniformly
detect "-" and convert it into stdin or stdout as appropriate, would
avoid fclosing those files for real when told to close them, and
would also be able to handle reading a little bit of data from the
start of a file and then pushing it all back even if the file were
not seekable (which would allow input.c to lose the ugly special
case whereby it can't currently read font files from standard
input).

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8729 cda61777-01e9-0310-a592-d414129be87e

14 years agoEnable Halibut to read a .but file from standard input, by supplying
simon [Sat, 24 Oct 2009 09:08:26 +0000 (09:08 +0000)]
Enable Halibut to read a .but file from standard input, by supplying
the special filename '-'.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8728 cda61777-01e9-0310-a592-d414129be87e

14 years agoRevise r8309 to use \- rather than - when trying to emit a literal U+002D;
jacob [Sun, 6 Sep 2009 13:37:27 +0000 (13:37 +0000)]
Revise r8309 to use \- rather than - when trying to emit a literal U+002D;
apparently this is preferred (it's what pod2man uses); cf Debian #496063,
#159872.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8641 cda61777-01e9-0310-a592-d414129be87e

14 years agoMore portable attempt to get a literal U+0027 than r8321, pinched from pod2man
jacob [Sun, 6 Sep 2009 12:59:33 +0000 (12:59 +0000)]
More portable attempt to get a literal U+0027 than r8321, pinched from pod2man
(via Colin in Debian bug#496063).

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8640 cda61777-01e9-0310-a592-d414129be87e

15 years agoFix missing docs for \cfg{paper-contents-indent-step} and
simon [Tue, 20 Jan 2009 18:50:18 +0000 (18:50 +0000)]
Fix missing docs for \cfg{paper-contents-indent-step} and
\cfg{paper-contents-margin}. Also correct the spelling of the
former.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8424 cda61777-01e9-0310-a592-d414129be87e

15 years agoFix unintentional bash-specificity in Makefile. (Patch from Colin
simon [Tue, 20 Jan 2009 18:36:24 +0000 (18:36 +0000)]
Fix unintentional bash-specificity in Makefile. (Patch from Colin
Watson.)

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8422 cda61777-01e9-0310-a592-d414129be87e

15 years agoUse of \lcont in the document preamble caused an assertion failure.
simon [Tue, 20 Jan 2009 18:34:41 +0000 (18:34 +0000)]
Use of \lcont in the document preamble caused an assertion failure.
Fix it.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8421 cda61777-01e9-0310-a592-d414129be87e

15 years agoTest for r8309/r8321.
jacob [Sun, 23 Nov 2008 17:48:58 +0000 (17:48 +0000)]
Test for r8309/r8321.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8322 cda61777-01e9-0310-a592-d414129be87e

15 years agoExtend r8309 to try to ensure that single-quote/apostrophe characters in code
jacob [Sun, 23 Nov 2008 17:41:44 +0000 (17:41 +0000)]
Extend r8309 to try to ensure that single-quote/apostrophe characters in code
contexts get output usefully in the face of UTF-8 *roff implementations.
Works on Debian-derived distributions (and hence along with r8309 should fix
#496063), but I'm slightly worried about portability as I've used a named
character "\(aq" which doesn't appear in the "classic" reference CS TR #54.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8321 cda61777-01e9-0310-a592-d414129be87e

15 years agoCut-and-paste error: reference to "man page" in Windows Help section.
jacob [Sun, 23 Nov 2008 15:05:19 +0000 (15:05 +0000)]
Cut-and-paste error: reference to "man page" in Windows Help section.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8320 cda61777-01e9-0310-a592-d414129be87e

15 years agoLet's not use parentheses in test.but in a way that tempts Halibut
simon [Fri, 21 Nov 2008 19:27:07 +0000 (19:27 +0000)]
Let's not use parentheses in test.but in a way that tempts Halibut
to try to put them into an Info node name, so as to avoid the error
message when it fails.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8313 cda61777-01e9-0310-a592-d414129be87e

15 years agoCorrect mishandling of paragraphs beginning with "\#{".
simon [Fri, 21 Nov 2008 19:25:26 +0000 (19:25 +0000)]
Correct mishandling of paragraphs beginning with "\#{".
(Embarrassingly, this was showing up in inputs/test.but itself.)

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8312 cda61777-01e9-0310-a592-d414129be87e

15 years agoClean up some compiler warnings.
simon [Fri, 21 Nov 2008 19:20:12 +0000 (19:20 +0000)]
Clean up some compiler warnings.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8310 cda61777-01e9-0310-a592-d414129be87e

15 years agoDon't translate hyphens into \(hy inside \c{...} or code paragraphs,
simon [Fri, 21 Nov 2008 19:15:50 +0000 (19:15 +0000)]
Don't translate hyphens into \(hy inside \c{...} or code paragraphs,
because otherwise UTF-8 versions of man(1) tend to turn them into
Unicode hyphen characters, with the result that if you cut and paste
sample command lines out of man pages in the obvious way then the
things that look like hyphens are not in fact the character that the
program in question would recognise as an option introducer.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8309 cda61777-01e9-0310-a592-d414129be87e

15 years agoTurn the numeric parameter to err_sfntbadglyph from wchar_t to
simon [Wed, 9 Jul 2008 17:06:29 +0000 (17:06 +0000)]
Turn the numeric parameter to err_sfntbadglyph from wchar_t to
unsigned int, after a correspondent mentioned that DJGPP produces a
very scary warning about integer promotion making use of the former
in va_arg non-portable. Whether or not that's standards-justifiable,
it's certainly the case that we were casting _to_ wchar_t from
unsigned int in all cases of this error actually being used, so the
simplest thing is just to transfer the number through va_arg as
unsigned.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@8112 cda61777-01e9-0310-a592-d414129be87e

16 years agoFix cut'n'paste error which had the effect of making the default for
jacob [Wed, 19 Mar 2008 22:28:15 +0000 (22:28 +0000)]
Fix cut'n'paste error which had the effect of making the default for
\cfg{html-section-shownumber}{n} undefined.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7929 cda61777-01e9-0310-a592-d414129be87e

16 years agoNew option *-section-shownumber, alongside *-section-numeric and in
simon [Mon, 25 Feb 2008 19:36:12 +0000 (19:36 +0000)]
New option *-section-shownumber, alongside *-section-numeric and in
both the back ends which currently support that, to leave out
chapter and section numbers totally in section headings. Can be
useful for publishing man pages (which don't normally want section
numbers) on the web.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7892 cda61777-01e9-0310-a592-d414129be87e

16 years agoCope with TrueType fonts with slightly broken cmaps, just ignoring code points
ben [Sun, 2 Dec 2007 18:38:31 +0000 (18:38 +0000)]
Cope with TrueType fonts with slightly broken cmaps, just ignoring code points
that can't be resolved (apart from warning about it).

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7800 cda61777-01e9-0310-a592-d414129be87e

16 years agoTypo.
simon [Sun, 2 Dec 2007 11:41:21 +0000 (11:41 +0000)]
Typo.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7799 cda61777-01e9-0310-a592-d414129be87e

16 years agoRecognise a couple more types of Unicode 'cmap'. Also fail if a format 4
ben [Sun, 2 Dec 2007 00:01:30 +0000 (00:01 +0000)]
Recognise a couple more types of Unicode 'cmap'.  Also fail if a format 4
'cmap' refers to a character off the end of the glyphIndexArray.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7798 cda61777-01e9-0310-a592-d414129be87e

16 years agoThe length parameters in mbstowcs and wcstombs are limits on the
simon [Thu, 21 Jun 2007 14:10:01 +0000 (14:10 +0000)]
The length parameters in mbstowcs and wcstombs are limits on the
_output_ length, not the input length. Adjust accordingly.

This has the side effect of working around what I believe to be a
bug in DJGPP's mbstowcs(), namely that if you give it a string which
exactly fits in the output length _without_ the trailing NUL, then
it will write n-1 characters of the string plus a NUL where I
believe it should write n characters of the string and no NUL.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7622 cda61777-01e9-0310-a592-d414129be87e

17 years agoList some documentation sources, and another todo item.
ben [Sun, 8 Apr 2007 20:47:01 +0000 (20:47 +0000)]
List some documentation sources, and another todo item.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7454 cda61777-01e9-0310-a592-d414129be87e

17 years agoRemove heading underlines from todo list.
ben [Sun, 8 Apr 2007 11:23:27 +0000 (11:23 +0000)]
Remove heading underlines from todo list.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7453 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd support for doing different underlining of different heading levels
ben [Sun, 8 Apr 2007 11:16:23 +0000 (11:16 +0000)]
Add support for doing different underlining of different heading levels
in the Info backend, with the defaults chosen to match what Emacs
recognises and renders prettily.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7452 cda61777-01e9-0310-a592-d414129be87e

17 years agoAnother observation about indices.
ben [Sun, 8 Apr 2007 00:44:13 +0000 (00:44 +0000)]
Another observation about indices.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7451 cda61777-01e9-0310-a592-d414129be87e

17 years agoGNU manuals are fairly clear that "Info" is spelt in mixed case and set
ben [Sun, 8 Apr 2007 00:17:52 +0000 (00:17 +0000)]
GNU manuals are fairly clear that "Info" is spelt in mixed case and set
in a Roman font.  Follow suit.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7450 cda61777-01e9-0310-a592-d414129be87e

17 years agoA few thoughts I had while actually using Halibut's Info output.
ben [Sat, 7 Apr 2007 23:33:50 +0000 (23:33 +0000)]
A few thoughts I had while actually using Halibut's Info output.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7449 cda61777-01e9-0310-a592-d414129be87e

17 years agoDocument TrueType support.
ben [Tue, 13 Feb 2007 22:05:16 +0000 (22:05 +0000)]
Document TrueType support.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7284 cda61777-01e9-0310-a592-d414129be87e

17 years agoRevert an accidental commit -- we don't have OpenType support quite yet.
ben [Tue, 13 Feb 2007 21:51:09 +0000 (21:51 +0000)]
Revert an accidental commit -- we don't have OpenType support quite yet.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7283 cda61777-01e9-0310-a592-d414129be87e

17 years agoMake quite a lot of hyphens into non-breaking ones. This gives rather
ben [Tue, 13 Feb 2007 21:46:25 +0000 (21:46 +0000)]
Make quite a lot of hyphens into non-breaking ones.  This gives rather
nicer output.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7282 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd a --list-fonts option, since getting PostScript names out of TrueType
ben [Tue, 13 Feb 2007 21:38:21 +0000 (21:38 +0000)]
Add a --list-fonts option, since getting PostScript names out of TrueType
fonts is difficult.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7281 cda61777-01e9-0310-a592-d414129be87e

17 years agoWhen building the static Huffman tables, it's vital to include the
simon [Tue, 13 Feb 2007 19:23:47 +0000 (19:23 +0000)]
When building the static Huffman tables, it's vital to include the
two unused entries at the end of the lit/len table (286 and 287),
because without them all the 9-bit codes are off by four. I can only
assume I hadn't noticed this before because no test file I've
compressed had both (a) contained byte values >= 0x90 and (b)
required a static block.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7279 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd a test for glyph-name de-duplication in TrueType fonts -- several MS
ben [Tue, 13 Feb 2007 00:14:55 +0000 (00:14 +0000)]
Add a test for glyph-name de-duplication in TrueType fonts -- several MS
fonts have separate glyphs for U+0394 GREEK CAPITAL LETTER DELTA and
U+2206 INCREMENT, but call both of them "Delta".

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7278 cda61777-01e9-0310-a592-d414129be87e

17 years agoCope with TrueType fonts that have duplicate glyph names by renaming glyphs
ben [Tue, 13 Feb 2007 00:12:16 +0000 (00:12 +0000)]
Cope with TrueType fonts that have duplicate glyph names by renaming glyphs
as necessary.  The algorithm for ensuring that the new name is unused is
partly Gareth's fault.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7277 cda61777-01e9-0310-a592-d414129be87e

17 years agoCope with TrueType fonts without a 'post' table or with a format 3 'post'
ben [Mon, 12 Feb 2007 22:21:03 +0000 (22:21 +0000)]
Cope with TrueType fonts without a 'post' table or with a format 3 'post'
table (which doesn't specify glyph names), constructing an arbitrary list
of glyph names for ourselves.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7276 cda61777-01e9-0310-a592-d414129be87e

17 years agoPresumed typo preventing compilation in r7269.
jacob [Sun, 11 Feb 2007 17:30:49 +0000 (17:30 +0000)]
Presumed typo preventing compilation in r7269.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7270 cda61777-01e9-0310-a592-d414129be87e

17 years agoImproved error handling in sfnt support. No more calls to abort()!
ben [Sun, 11 Feb 2007 15:19:10 +0000 (15:19 +0000)]
Improved error handling in sfnt support.  No more calls to abort()!

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7269 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd support for extracting kerning tables from 'kern' tables. Only format 0
ben [Sat, 10 Feb 2007 22:34:44 +0000 (22:34 +0000)]
Add support for extracting kerning tables from 'kern' tables.  Only format 0
(simple pair kerning) is supported, but with both Apple- and Microsoft-format
headers.

Also reference Microsoft's TrueType specification in comments, since I've used
that to write some of this code.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7268 cda61777-01e9-0310-a592-d414129be87e

17 years agoImprove (and greatly complicate) CMap generation for TrueType fonts.
ben [Sat, 10 Feb 2007 14:29:37 +0000 (14:29 +0000)]
Improve (and greatly complicate) CMap generation for TrueType fonts.
We now detect ranges of glyphs mapped contiguously and use {begin,end}cidrange
for them, and also bunch together multiple characters and ranges in each
{begin,end}cid{char,range} pair.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7263 cda61777-01e9-0310-a592-d414129be87e

17 years agoNow that glyph indices are exposed to bk_pdf.c, move CMap generation there,
ben [Sat, 10 Feb 2007 13:35:52 +0000 (13:35 +0000)]
Now that glyph indices are exposed to bk_pdf.c, move CMap generation there,
since that seems closer to being where it belongs.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7262 cda61777-01e9-0310-a592-d414129be87e

17 years agoGenerate a "W" array for CIDFonts, since acroread seems to do very silly
ben [Sat, 10 Feb 2007 12:33:56 +0000 (12:33 +0000)]
Generate a "W" array for CIDFonts, since acroread seems to do very silly
things without one.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7261 cda61777-01e9-0310-a592-d414129be87e

17 years agoSupport for embedding TrueType fonts in PDF output. The code isn't the most
ben [Thu, 8 Feb 2007 21:50:00 +0000 (21:50 +0000)]
Support for embedding TrueType fonts in PDF output.  The code isn't the most
beautiful I've ever written, and xpdf turns out not to support the encoding
mechanism I've chosen, but it works in GhostScript so I'm not too unhappy for
now.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7259 cda61777-01e9-0310-a592-d414129be87e

17 years agoRemove slightly odd formatting left in by accident.
jacob [Wed, 7 Feb 2007 19:58:05 +0000 (19:58 +0000)]
Remove slightly odd formatting left in by accident.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7248 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd support for extracting some global font metrics from the 'OS/2' table
ben [Wed, 7 Feb 2007 00:00:06 +0000 (00:00 +0000)]
Add support for extracting some global font metrics from the 'OS/2' table
of fonts that have one.  This should help with generating the
FontDescriptor object in PDF.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7246 cda61777-01e9-0310-a592-d414129be87e

17 years agoMake ps_token() more generally available and use it to improve the formatting
ben [Tue, 6 Feb 2007 23:01:42 +0000 (23:01 +0000)]
Make ps_token() more generally available and use it to improve the formatting
of Type 42 fonts.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7245 cda61777-01e9-0310-a592-d414129be87e

17 years agoInsert a missing (though strictly unnecessary) newline.
ben [Tue, 6 Feb 2007 22:55:31 +0000 (22:55 +0000)]
Insert a missing (though strictly unnecessary) newline.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7244 cda61777-01e9-0310-a592-d414129be87e

17 years agoTweak to Tye 42 font generation -- construct the CharStrings dictionary
ben [Tue, 6 Feb 2007 22:53:33 +0000 (22:53 +0000)]
Tweak to Tye 42 font generation -- construct the CharStrings dictionary
rather more in PostScript and less in C.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7243 cda61777-01e9-0310-a592-d414129be87e

17 years agoConstruct a table for mapping glyph names back into glyph indices, for use
ben [Tue, 6 Feb 2007 22:48:16 +0000 (22:48 +0000)]
Construct a table for mapping glyph names back into glyph indices, for use
when we come to embed TrueType fonts in PDF.  Also provide functions for
using this table and its inverse.  Unrelatedly, support extracting the
italic angle from the 'post' table.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7242 cda61777-01e9-0310-a592-d414129be87e

17 years agoNow we have the new `module' command, use it.
simon [Mon, 5 Feb 2007 12:43:17 +0000 (12:43 +0000)]
Now we have the new `module' command, use it.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7225 cda61777-01e9-0310-a592-d414129be87e

17 years agoQuell warnings about declared but undefined static functions by not declaring
ben [Sun, 4 Feb 2007 23:41:42 +0000 (23:41 +0000)]
Quell warnings about declared but undefined static functions by not declaring
them either.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7219 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd a "const" to the argument of dupstr() so that GCC doesn't complain when
ben [Sun, 4 Feb 2007 23:39:47 +0000 (23:39 +0000)]
Add a "const" to the argument of dupstr() so that GCC doesn't complain when
we pass it a constant string.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7218 cda61777-01e9-0310-a592-d414129be87e

17 years agoTidy up the handling of non-standard glyphs by defining glyph_extern()
ben [Sun, 4 Feb 2007 14:16:26 +0000 (14:16 +0000)]
Tidy up the handling of non-standard glyphs by defining glyph_extern()
early and using it whenever we need the name of a non-standard glyph.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7216 cda61777-01e9-0310-a592-d414129be87e

17 years agoBuild script for building Halibut using bob.
simon [Sun, 4 Feb 2007 11:13:43 +0000 (11:13 +0000)]
Build script for building Halibut using bob.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7204 cda61777-01e9-0310-a592-d414129be87e

17 years agoCorrect a comment.
ben [Sat, 3 Feb 2007 14:40:40 +0000 (14:40 +0000)]
Correct a comment.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7202 cda61777-01e9-0310-a592-d414129be87e

17 years agoQuell some warnings from GCC.
ben [Sat, 3 Feb 2007 14:14:32 +0000 (14:14 +0000)]
Quell some warnings from GCC.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7201 cda61777-01e9-0310-a592-d414129be87e

17 years agoWhen adding a new file, it helps to "svn add" it.
ben [Sat, 3 Feb 2007 14:08:09 +0000 (14:08 +0000)]
When adding a new file, it helps to "svn add" it.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7200 cda61777-01e9-0310-a592-d414129be87e

17 years agoWhen loading a Type 1 font, remember to terminate the linked list we load
ben [Sat, 3 Feb 2007 14:05:32 +0000 (14:05 +0000)]
When loading a Type 1 font, remember to terminate the linked list we load
it into.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7199 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd support for using TrueType fonts, including embedding in PostScript but
ben [Sat, 3 Feb 2007 14:02:21 +0000 (14:02 +0000)]
Add support for using TrueType fonts, including embedding in PostScript but
not yet in PDF.  There's a lot of cleaning up to be done, especially in the
area of error, but I think it would be better committed gradually.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7198 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd an `Up' link to the HTML navigation bar of sufficiently deep documents.
jacob [Wed, 31 Jan 2007 23:32:12 +0000 (23:32 +0000)]
Add an `Up' link to the HTML navigation bar of sufficiently deep documents.
(This doesn't affect any of the source texts I know about.)
Also add <link rel="up">, even in the cases where it's just the same as
<link rel="ToC">. (This does.)

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7193 cda61777-01e9-0310-a592-d414129be87e

17 years agoI haven't found any browsers that do anything disgusting with
jacob [Wed, 31 Jan 2007 22:23:09 +0000 (22:23 +0000)]
I haven't found any browsers that do anything disgusting with
\cfg{html-rellinks}, and it generally seems to be a Good Thing, so I've
turned it on by default. (The lurkers support me in u2u.)

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7188 cda61777-01e9-0310-a592-d414129be87e

17 years agoUse consistent capitalisation for HTML tags.
jacob [Sun, 28 Jan 2007 18:42:50 +0000 (18:42 +0000)]
Use consistent capitalisation for HTML tags.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7178 cda61777-01e9-0310-a592-d414129be87e

17 years agoMinimal support for <LINK REL="next"> etc machine-readable navigation links.
jacob [Sun, 28 Jan 2007 17:16:48 +0000 (17:16 +0000)]
Minimal support for <LINK REL="next"> etc machine-readable navigation links.

Off by default for now, but I don't intend that it should stay this way; they
seem useful and harmless. I just want to check a few more browsers to ensure
they don't do anything obnoxious with them.

So far I've only seen lynx and links do something with them (provide toolbars).
iCab and some Mozilla derivatives/extensions are also alleged to do this; Opera
is said to allow PgDn type browsing through the entire set of pages; and
Mozilla is rumoured to use the "next" link for prefetching.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7177 cda61777-01e9-0310-a592-d414129be87e

17 years agoTweak the HTML Help output to enable Previous/Next navigation in the generated
jacob [Sun, 28 Jan 2007 16:22:43 +0000 (16:22 +0000)]
Tweak the HTML Help output to enable Previous/Next navigation in the generated
CHM, and added the toolbar buttons for this.

Also rationalised the other options a bit:
 - added Forward button (since we have Back);
 - removed Locate/Sync (since we have auto-sync enabled for the ToC);
 - removed Stop and Refresh (mostly a waste of space for help, but still
   available from the Options menu if users really want them);
 - enabled advanced facilities on the Search tab (search within results, etc).

All this seems to have had no obvious ill effects (tested on Win98), although
the resulting CHM file is slightly bigger (~3kbyte, <1%).

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7176 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd support for PFB files. This seems to have caused me to completely
ben [Sat, 27 Jan 2007 20:47:41 +0000 (20:47 +0000)]
Add support for PFB files.  This seems to have caused me to completely
rewrite the Type 1 font support, and I'm sure the result is more complex
than it needs to be, but it seems to work correctly, so I shouldn't
complain.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7175 cda61777-01e9-0310-a592-d414129be87e

17 years agoDuplicate fix of Kevin Lyles's bug from r7092.
simon [Thu, 11 Jan 2007 09:39:35 +0000 (09:39 +0000)]
Duplicate fix of Kevin Lyles's bug from r7092.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7093 cda61777-01e9-0310-a592-d414129be87e

17 years agoUpdate the TODO list to match the current state of the world.
ben [Sun, 7 Jan 2007 11:51:18 +0000 (11:51 +0000)]
Update the TODO list to match the current state of the world.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7070 cda61777-01e9-0310-a592-d414129be87e

17 years agoAdd a mechanism for disabling ligature substitution for an entire paragraph
ben [Sun, 7 Jan 2007 11:48:58 +0000 (11:48 +0000)]
Add a mechanism for disabling ligature substitution for an entire paragraph
and apply it to code paragraphs.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7069 cda61777-01e9-0310-a592-d414129be87e

17 years agoOur standard mapping for the first font should start at 0x20, not 0x21.
ben [Sun, 7 Jan 2007 00:20:25 +0000 (00:20 +0000)]
Our standard mapping for the first font should start at 0x20, not 0x21.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7067 cda61777-01e9-0310-a592-d414129be87e

17 years agoSupport for getting ligature information from AFM files, which was the
ben [Sun, 7 Jan 2007 00:15:52 +0000 (00:15 +0000)]
Support for getting ligature information from AFM files, which was the
whole point of the glyph renumbering.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7066 cda61777-01e9-0310-a592-d414129be87e

17 years agoMake ps_glyph_to_unicode() take a glyph index instead of a glyph name.
ben [Sat, 6 Jan 2007 17:47:34 +0000 (17:47 +0000)]
Make ps_glyph_to_unicode() take a glyph index instead of a glyph name.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7062 cda61777-01e9-0310-a592-d414129be87e

17 years agoOverhaul of glyph-name handling in the paper backends. Before, we had
ben [Sat, 6 Jan 2007 17:32:34 +0000 (17:32 +0000)]
Overhaul of glyph-name handling in the paper backends.  Before, we had
a separate dense array of glyph names for each font, and referenced glyphs
by indicies into that array, which meant that the array had to be set
up before we could generate any indices.  Now we have an overall array of
glyph names, and use the same glyph indicies for all fonts.  Some arrays
have had to turn into tree234s as a result.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7061 cda61777-01e9-0310-a592-d414129be87e

17 years agoI've worked out why ligation was being (correctly) suppressed in code
ben [Sat, 6 Jan 2007 16:05:28 +0000 (16:05 +0000)]
I've worked out why ligation was being (correctly) suppressed in code
paragraphs and found some cases where it isn't.  Add test cases for these
to remind me to deal with them later.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7060 cda61777-01e9-0310-a592-d414129be87e

17 years agoJames should apparently have been removed from this file years ago. Fix that.
ben [Tue, 2 Jan 2007 22:38:23 +0000 (22:38 +0000)]
James should apparently have been removed from this file years ago.  Fix that.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7051 cda61777-01e9-0310-a592-d414129be87e

17 years agoFix the behaviour of constructions like \e{index \i{term}} -- the index tag
jacob [Mon, 1 Jan 2007 21:27:39 +0000 (21:27 +0000)]
Fix the behaviour of constructions like \e{index \i{term}} -- the index tag
was causing emphasis to be broken (particularly noticeable in text-like
backends). There are some instances of this in the PuTTY manual, for instance.

Unfortunately, \k references in similar situations still aren't quite right,
but fixing that will be more involved, and I haven't found any instances
yet.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7049 cda61777-01e9-0310-a592-d414129be87e

17 years agoBump copyright dates, and change the one at the start of the manual to be
ben [Mon, 1 Jan 2007 15:40:57 +0000 (15:40 +0000)]
Bump copyright dates, and change the one at the start of the manual to be
a range rather than a single year.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7047 cda61777-01e9-0310-a592-d414129be87e

17 years agoGenerate ligature information from the standard AFM files rather than
ben [Mon, 1 Jan 2007 15:32:32 +0000 (15:32 +0000)]
Generate ligature information from the standard AFM files rather than
hard-coding it.  No practical gain, since the hard-coded entries were correct,
but aesthetically better.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7046 cda61777-01e9-0310-a592-d414129be87e

17 years agoInitial ligature support. This adds support for emitting ligatures, and adds
ben [Sun, 31 Dec 2006 21:38:46 +0000 (21:38 +0000)]
Initial ligature support.  This adds support for emitting ligatures, and adds
the "fi" and "fl" ligatures to the built-in fonts, but doesn't add support
for reading ligature information from AFM files because that requires coping
with forward references to glyph names, which is tricky.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7045 cda61777-01e9-0310-a592-d414129be87e

17 years agoFix segfault in info backend when invoked with inputs/test.but
jacob [Sun, 31 Dec 2006 18:01:08 +0000 (18:01 +0000)]
Fix segfault in info backend when invoked with inputs/test.but
(which triggers err_infonodechar with fpos==NULL).

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7044 cda61777-01e9-0310-a592-d414129be87e

17 years agoEmit lots of odd characters so as to test the paper backends' ability to
ben [Sun, 31 Dec 2006 14:36:13 +0000 (14:36 +0000)]
Emit lots of odd characters so as to test the paper backends' ability to
use two encodings of the same font.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7042 cda61777-01e9-0310-a592-d414129be87e

17 years agoTweak /OUT pdfmark generation -- PLRM suggests that constructing a large
ben [Tue, 12 Dec 2006 21:51:33 +0000 (21:51 +0000)]
Tweak /OUT pdfmark generation -- PLRM suggests that constructing a large
executable array is likely to use lots of stack space, which might be bad on
Level 1 interpreters, so use the same mechanism as for other pdfmarks and
have a procedure that does nothing if pdfmark isn't defined.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@6995 cda61777-01e9-0310-a592-d414129be87e

17 years agoThese HHP window dimensions seem to be rubbish. Better off without
simon [Tue, 12 Dec 2006 21:36:08 +0000 (21:36 +0000)]
These HHP window dimensions seem to be rubbish. Better off without
any, I reckon.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@6994 cda61777-01e9-0310-a592-d414129be87e

17 years agoRough-and-ready line wrapping for PostScript, to keep us below the DSC-mandated
ben [Tue, 12 Dec 2006 00:13:59 +0000 (00:13 +0000)]
Rough-and-ready line wrapping for PostScript, to keep us below the DSC-mandated
255 characters per line (excluding newline characters).  In fact, it tries to
keep us below 80 characters so as to make the PostScript more readable (and
demonstrate that it's working).

git-svn-id: svn://svn.tartarus.org/sgt/halibut@6993 cda61777-01e9-0310-a592-d414129be87e

17 years agoActually, the separator in the "NAME" section really ought to be an
ben [Mon, 11 Dec 2006 23:28:51 +0000 (23:28 +0000)]
Actually, the separator in the "NAME" section really ought to be an
EN DASH, falling back to MINUS and then HYPHEN-MINUS.  Make it so.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@6992 cda61777-01e9-0310-a592-d414129be87e

17 years agoSupport for the MS HTML Help system in the HTML back end. As yet I
simon [Mon, 11 Dec 2006 19:43:10 +0000 (19:43 +0000)]
Support for the MS HTML Help system in the HTML back end. As yet I
don't know how to write out a .CHM directly, but I am at least able
to have the HTML back end write out the three auxiliary files which
enable a .CHM to be generated using the MS HTML Help compiler.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@6991 cda61777-01e9-0310-a592-d414129be87e

17 years agoJust noticed that Ben missed another PostScript/PDF inversion.
simon [Mon, 11 Dec 2006 14:15:15 +0000 (14:15 +0000)]
Just noticed that Ben missed another PostScript/PDF inversion.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@6990 cda61777-01e9-0310-a592-d414129be87e