groff

groff: can I embed images?

杀马特。学长 韩版系。学妹 提交于 2019-12-23 10:23:35
问题 I'm generating some troff-style documentation. Is there a way to embed an image (jpg, etc) into a groff file? 回答1: Depends on the output format. If you are creating a PostScript file, you can use PSPIC which uses a PS file itself with a single image. For example: .PSPIC image.ps Alignment, etc is a bit limited. By default it is aligned to the center but you can put it at the left or the right corner using -L or -R. There are some other options, check the groff_tmac manpage for these (search

Text codepage in groff

喜欢而已 提交于 2019-12-13 00:43:10
问题 How to setup a correct codepage in groff ? For example to use a cyrillic language. Man page notes about -T switch. But troff -T utf8 -ms troff_file.txt gives: warning: invalid input character code 128` 回答1: -Tutf8 only selects the output device. If you want groff to accept Unicode input, use the -K switch. Another way to have Cyrillic is simply to use Tlatin1 to enable eight-bit character codes, and feed groff a source file in a single-byte encoding such as CP 1251 or KOI8-R . Don't forget to

How to send EOF to a process in Java?

有些话、适合烂在心里 提交于 2019-12-10 15:53:31
问题 I want to run groff in a Java program. The input comes from a string. In real command line, we will terminate the input by ^D in Linux/Mac. So how to send this terminator in Java program? String usage += ".Dd \\[year]\n"+ ".Dt test 1\n"+ ".Os\n"+ ".Sh test\n"+ "^D\n"; // <--- EOF here? Process groff = Runtime.getRuntime().exec("groff -mandoc -T ascii -"); groff.getOutputStream().write(usage.getBytes()); byte[] buffer = new byte[1024]; groff.getInputStream().read(buffer); String s = new String