summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/term_ascii.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When showing more than one formatted manual page, insert horizontal linesschwarze2014-12-311-1/+15
| | | | | | between pages. Suggested by Theo Buehler <theo at math dot ethz dot ch>. Even in UTF-8 output mode, do not use fancy line drawing characters such that you can easily use /^--- to skip to the next manual in your pager.
* Enforcing an arbitrary, implementation dependent, undocumented limitschwarze2014-12-191-1/+4
| | | | | | by calling assert() when valid user input exceeds it is a bad idea. Allocate the terminal font stack dynamically instead of crashing above 10 entries. Issue found by jsg@ with afl.
* Prevent negative arguments to the .ll request from causing integerschwarze2014-11-201-4/+6
| | | | | | | | | underflow. Found while preparing an audit of termp.rmargin. Overflow can also happen, but i see no sane way to deal with it, so just let it happen. It doesn't happen for any sane input anyway, groff behaviour is undefined, and the resulting values are legal, even though they are useless.
* In -Tascii mode, print "<?>" only for Unicode escapes of unknownschwarze2014-10-281-3/+3
| | | | | | representation, not for character escapes with unknown names. According to groff, the latter produce no output, and we now warn about them.
* Make the character table available to libroff so it can check theschwarze2014-10-281-9/+11
| | | | | | | | validity of character escape names and warn about unknown ones. This requires mchars_spec2cp() to report unknown names again. Fortunately, that doesn't require changing the calling code because according to groff, invalid character escapes should not produce output anyway, and now that we warn about them, that's fine.
* Refine -Tascii rendering of Unicode characters, mostly to better agreeschwarze2014-10-281-35/+35
| | | | | | | | | with groff, in particular in cases where groff uses backspace overstrike. In two cases, agreement is impossible because groff clobbers the previous line: \(*G \(*S In a number of cases, groff rendering is so misleading that i chose to render differently: \(Sd \(TP \(Tp \(Po \(ps \(sc \(r! \(r? \(de While here, also correct the \(la and \(ra Unicode code points.
* In -Tascii mode, provide approximations even for some Unicode escapeschwarze2014-10-261-3/+5
| | | | | | | | sequences above codepoint 512 by doing a reverse lookup in the existing mandoc_char(7) character table. Again, groff isn't smart enough to do this and silently discards such escape sequences without printing anything.
* Improve -Tascii output for Unicode escape sequences: For the first 512schwarze2014-10-261-1/+76
| | | | | | | | | | | | code points, provide ASCII approximations. This is already much better than what groff does, which prints nothing for most code points. A few minor fixes while here: * Handle Unicode escape sequences in the ASCII range. * In case of errors, use the REPLACEMENT CHARACTER U+FFFD for -Tutf8 and the string "<?>" for -Tascii output. * Handle all one-character escape sequences in mchars_spec2{cp,str}() and remove the workarounds on the higher level.
* Implement the traditional -h option for man(1): show the SYNOPSIS only.schwarze2014-09-031-3/+7
| | | | | | | As usual, we get mandoc -h and apropos -h for free. Try stuff like "apropos -h In=dirent" or "apropos -h Fa=timespec". Only useful for terminal output, so -Tps, -Tpdf, -Thtml ignore -h for now.
* typo, sorryschwarze2014-08-171-2/+2
|
* While all current callers pass valid data to ascii_hspan() only,schwarze2014-08-171-2/+2
| | | | | | it's safer to assume incoming enum data might be invalid and catch it instead of happily returning an unitialized int. No functional change right now.
* Some compilers apparently worry that abort() might returnschwarze2014-08-141-2/+3
| | | | | | and then throw a "may be used uninitialized" warning, so sprinkle some /* NOTREACHED */. No functional change. Noticed by Thomas Klausner <wiz at NetBSD dot org>.
* Begin cleanup of scaling units.schwarze2014-08-131-11/+21
| | | | | | | | | | | | Note that we use 240u := 1i for all devices, even -Tps and -Tpdf. Big fix of -Tascii rendering of f, m, and u. Small fix of -Tascii rendering of c. Big fix of -Thtml rendering of u. Big fix of -Tps rendering of m, p, and u. Clarify -Tps rendering of c. Correct documentation of scaling units, in particular with respect to u. This for example improves rendering of the OpenGL manuals. Joint work with kristaps@.
* Clarity with respect to floating point handling:schwarze2014-08-081-7/+7
| | | | | | Write double constants as double rather than integer literals. Remove useless explicit (double) cast done at one place and nowhere else. No functional change.
* Even for UTF-8 output, a non-breaking space character has the same widthschwarze2014-07-271-2/+7
| | | | as a normal space character, and not width 0. Bug reported by bentley@.
* KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */,schwarze2014-04-201-26/+17
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Support relative arguments to .ll (increase or decrease line length).schwarze2014-03-301-8/+12
|
* Implement the roff(7) .ll (line length) request.schwarze2014-03-301-2/+16
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* The files mandoc.c and mandoc.h contained both specialised low-levelschwarze2014-03-211-2/+2
| | | | | | | functions used for multiple languages (mdoc, man, roff), for example mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary functions. Split the auxiliaries out into their own file and header. While here, do some #include cleanup.
* Use a standard locale name, "UTF-8" is an ugly non-standard aliasschwarze2013-06-011-3/+2
| | | | | that doesn't work on OpenBSD. OK tedu@ naddy@
* As requested by kristaps@, add and improve comments related to -Omdoc;schwarze2011-12-051-1/+5
| | | | while here, clean up some redundant initializations in print_man_head().
* Support -man -Omdoc to format man(7) manuals in mdoc(7) output style;schwarze2011-11-131-3/+8
| | | | | | | | | | | so far, this is only accepting the option, i will commit the (few) formatting tweaks separately. This is intentionally undocumented for two reasons: (1) We dream of making it the default at some point, so the option will hopefully go away again. (2) It is not needed for production, but mostly for automated man(7) to mdoc(7) output comparisons, to help -Tman development.
* Make the default left text margin configurable from the command line,schwarze2011-11-131-4/+8
| | | | | | | just like the default right margin already is. This may be useful for people with expensive screen real estate. Besides, it helps automated man(7) to mdoc(7) output comparisons to validate -Tman output. ok kristaps@ on an earlier version
* Merge release 1.11.3, almost all code by kristaps@:schwarze2011-05-291-21/+91
| | | | | | | | | * Unicode output support (no Unicode input yet, though). * Refactoring: completely handle predefined strings in roff.c. - New function mandoc_escape() replaces a2roffdeco() and mandoc_special(). - Start using mandoc_getarg() in mdoc_argv.c. - Clean up parsing of delimiters in mdoc(7). * And many minor fixes and lots of cleanup.
* Remove unnecessary conditional: term_alloc() cannot return NULL;schwarze2011-01-311-3/+2
| | | | from kristaps@.
* Merge kristaps@' cleaner tbl integration, removing mine;schwarze2011-01-041-5/+2
| | | | there are still a few bugs, but fixing these will be easier in tree.
* Merge release 1.10.4 (all code by kristaps@), providing four new features:schwarze2010-07-131-9/+53
| | | | | | | | | | 1) Proper .Bk support: allow output line breaks at input line breaks, but keep input lines together in the output, finally fixing synopses like aucat(1), mail(1) and tmux(1). 2) Mostly finished -Tps (PostScript) output. 3) Implement -Thtml output for .Nm blocks and .Bk -words. 4) Allow iterative interpolation of user-defined roff(7) strings. Also contains some minor bugfixes and some performance improvements.
* As a first step towards variable-width font support,schwarze2010-06-261-1/+14
| | | | | move all width calculations in term_*.c, *_width(). From kristaps.
* minimal initial -Tps support, from kristaps@ GSOCschwarze2010-06-101-0/+128
so far, monospace without font decoration, but it already has page headers and footers