Module for creating formatted output in GNU roff (with ms macro package by default).
In order to create PostScript and PDF files, groff(1) must be installed. On Linux, run:
$ sudo apt-get install ghostscript groff
Create a PDF report from ms markup:
character(:), allocatable :: roff
integer :: rc
! Generate markup with macro package -ms.
roff = dm_roff_ms_header(title='Test Report', author='Sensor Node 1', &
institution='University of Elbonia', &
font_family=ROFF_FONT_HELVETICA, &
left_footer=dm_time_date(), &
right_footer='DMPACK ' // DM_VERSION_STRING)
roff = roff // dm_roff_ms_sh(2, 'Results')
roff = roff // dm_roff_ms_lp('First paragraph.')
! Create PDF from markup.
rc = dm_roff_to_pdf(roff, '/tmp/report.pdf', macro=ROFF_MACRO_MS)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | ROFF_DEVICE_NONE | = | 0 |
Invalid device. |
| integer, | public, | parameter | :: | ROFF_DEVICE_UTF8 | = | 1 |
Plain text (UTF-8). |
| integer, | public, | parameter | :: | ROFF_DEVICE_PS | = | 2 |
PostScript. |
| integer, | public, | parameter | :: | ROFF_DEVICE_PDF | = | 3 |
PDF. |
| integer, | public, | parameter | :: | ROFF_DEVICE_HTML | = | 4 |
HTML 4.01. |
| integer, | public, | parameter | :: | ROFF_DEVICE_LAST | = | 4 |
Never use this. |
| integer, | public, | parameter | :: | ROFF_DEVICE_NAME_LEN | = | 4 |
Max. device name length. |
| character(len=*), | public, | parameter | :: | ROFF_DEVICE_NAMES(ROFF_DEVICE_NONE:ROFF_DEVICE_LAST) | = | [character(ROFF_DEVICE_NAME_LEN)::'none', 'utf8', 'ps', 'pdf', 'html'] |
Device names. |
| integer, | public, | parameter | :: | ROFF_MACRO_NONE | = | 0 |
No macro package. |
| integer, | public, | parameter | :: | ROFF_MACRO_MS | = | 1 |
Macro package -ms. |
| integer, | public, | parameter | :: | ROFF_MACRO_LAST | = | 1 |
Never use this. |
| integer, | public, | parameter | :: | ROFF_FONT_NONE | = | 0 |
Default font (Times Roman). |
| integer, | public, | parameter | :: | ROFF_FONT_AVANT_GARDE | = | 1 |
Avant Garde. |
| integer, | public, | parameter | :: | ROFF_FONT_BOOKMAN | = | 2 |
Bookman. |
| integer, | public, | parameter | :: | ROFF_FONT_HELVETICA | = | 3 |
Helvetica. |
| integer, | public, | parameter | :: | ROFF_FONT_HELVETICA_NARROW | = | 4 |
Helvetica Narrow. |
| integer, | public, | parameter | :: | ROFF_FONT_NEW_CENTURY_SCHOOLBOOK | = | 5 |
New Century Schoolbook. |
| integer, | public, | parameter | :: | ROFF_FONT_PALATINO | = | 6 |
Palatino. |
| integer, | public, | parameter | :: | ROFF_FONT_TIMES_ROMAN | = | 7 |
Times Roman. |
| integer, | public, | parameter | :: | ROFF_FONT_ZAPF_CHANCERY | = | 8 |
Zapf Chancery (italic only). |
| integer, | public, | parameter | :: | ROFF_FONT_LAST | = | 8 |
Never use this. |
| integer, | public, | parameter | :: | ROFF_FONT_NAME_LEN | = | 3 |
Max. font name length. |
| character(len=*), | public, | parameter | :: | ROFF_FONT_NAMES(ROFF_FONT_NONE:ROFF_FONT_LAST) | = | [character(ROFF_FONT_NAME_LEN)::'T', 'A', 'BM', 'H', 'HN', 'N', 'P', 'T', 'ZCM'] |
Font family names. |
| character(len=*), | public, | parameter | :: | ROFF_REQUEST_BP | = | '.bp'//NL |
Page break. |
| character(len=*), | public, | parameter | :: | ROFF_REQUEST_BR | = | '.br'//NL |
Line break. |
| character(len=*), | public, | parameter | :: | ROFF_REQUEST_MS_P1 | = | '.P1'//NL |
Typeset header on page 1 (ms). |
| character(len=*), | public, | parameter | :: | ROFF_ESC_DUMMY | = | '\&' |
Interpolate a dummy character. |
| character(len=*), | public, | parameter | :: | ROFF_ESC_EMDASH | = | '\[em]' |
em dash. |
| character(len=*), | public, | parameter | :: | ROFF_ESC_ENDASH | = | '\[en]' |
en dash. |
| character(len=*), | public, | parameter | :: | ROFF_ESC_HR | = | "\l'\n(.lu'" |
Horizontal rule. |
| character(len=*), | public, | parameter | :: | ROFF_ESC_HYPHEN | = | '\[hy]' |
Hyphen. |
| character(len=*), | public, | parameter | :: | ROFF_ESC_MVUP | = | '\u' |
Move ½ em up. |
| character(len=*), | public, | parameter | :: | ROFF_ESC_NBSP | = | '\~' |
None-breaking space. |
| character(len=*), | public, | parameter | :: | ROFF_ENCODING_UTF8 | = | '.\" -*- mode: troff; coding: utf-8 -*-'//NL |
UTF-8 encoding for preconv. |
Generic macro function to set register value.
Returns macro to set register value (4-byte integer).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | register |
Register name. |
||
| integer(kind=i4), | intent(in) | :: | value |
Register value. |
||
| character(len=*), | intent(in), | optional | :: | unit |
Optional unit. |
Output string.
Returns macro to set register value (4-byte real).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | register |
Register name. |
||
| real(kind=r4), | intent(in) | :: | value |
Register value. |
||
| character(len=*), | intent(in), | optional | :: | unit |
Optional unit. |
Output string.
Returns .true. if argument device is a valid device enumerator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | device |
Device type ( |
Returns .true. if argument macro is a valid macro enumerator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | macro |
Macro type ( |
Converts PostScript file input to PDF file output by executing
ps2pdf(1). On error, an empty PDF file may be created. This
function requires Ghostscript to be installed locally.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | input |
Path of PostScript file. |
||
| character(len=*), | intent(in) | :: | output |
Path of PDF file. |
Passes the markup string roff to groff(1) to create a PDF file
that is written to path. An existing file will not be replaced. On
error, an empty file may still be created. By default, this function
uses macro package ms, unless argument macro is passed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(inout) | :: | roff |
Markup string. |
||
| character(len=*), | intent(in) | :: | path |
Path of output file. |
||
| integer, | intent(in), | optional | :: | macro |
Macro package to use ( |
|
| logical, | intent(in), | optional | :: | pic |
Run pic preprocessor. |
|
| logical, | intent(in), | optional | :: | preconv |
Run preconv preprocessor. |
|
| logical, | intent(in), | optional | :: | tbl |
Run tbl preprocessor. |
Passes the markup string roff to groff(1) to create a PostScript
file that is written to path. An existing file will not be
replaced. On error, an empty file may still be created. By default,
this function uses macro package ms, unless argument macro is
passed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(inout) | :: | roff |
Markup string. |
||
| character(len=*), | intent(in) | :: | path |
Path of output file. |
||
| integer, | intent(in), | optional | :: | macro |
Macro package to use ( |
|
| logical, | intent(in), | optional | :: | pic |
Run pic preprocessor. |
|
| logical, | intent(in), | optional | :: | preconv |
Run preconv preprocessor. |
|
| logical, | intent(in), | optional | :: | tbl |
Run tbl preprocessor. |
Returns GNU roff version as allocatable string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in), | optional | :: | name |
Add prefix |
|
| logical, | intent(out), | optional | :: | found |
Returns |
Version string.
Creates a new GNU roff document with macro package ms. The result has to be piped to groff(1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in), | optional | :: | title |
Document title. |
|
| character(len=*), | intent(in), | optional | :: | author |
Author name. |
|
| character(len=*), | intent(in), | optional | :: | institution |
Institution name. |
|
| integer, | intent(in), | optional | :: | font_family |
Font family enumerator ( |
|
| integer, | intent(in), | optional | :: | font_size |
Font size in pt. |
|
| character(len=*), | intent(in), | optional | :: | left_header |
Left header content. |
|
| character(len=*), | intent(in), | optional | :: | center_header |
Center header content. |
|
| character(len=*), | intent(in), | optional | :: | right_header |
Right header content. |
|
| character(len=*), | intent(in), | optional | :: | left_footer |
Left footer content. |
|
| character(len=*), | intent(in), | optional | :: | center_footer |
Center footer content. |
|
| character(len=*), | intent(in), | optional | :: | right_footer |
Right footer content. |
|
| logical, | intent(in), | optional | :: | page_one |
Enable header on page 1. |
Output string.
Returns table markup for tbl(1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(inout) | :: | format(:,:) |
Table format. |
||
| character(len=*), | intent(inout) | :: | data(:,:) |
Table data. |
||
| logical, | intent(in), | optional | :: | all_box |
Encloses each item of the table in a box. |
|
| logical, | intent(in), | optional | :: | box |
Encloses the table in a box. |
|
| logical, | intent(in), | optional | :: | double_box |
Encloses the table in a double box. |
|
| logical, | intent(in), | optional | :: | center |
Centers the table (default is left-justified). |
|
| logical, | intent(in), | optional | :: | expand |
Makes the table as wide as the current line length. |
|
| logical, | intent(in), | optional | :: | no_spaces |
Ignore leading and trailing spaces in data items. |
Output string.
Returns request to define a named stroke colour.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | ident |
Colour identifier. |
||
| integer, | intent(in) | :: | r |
Red channel. |
||
| integer, | intent(in) | :: | g |
Green channel. |
||
| integer, | intent(in) | :: | b |
Blue channel. |
Output string.
Returns escape sequence to change stroke colour of text to
identifier ident. The identifier has to be defined with
dm_roff_defcolor() beforehand. The result is not new-line
terminated!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | ident |
Colour identifier. |
||
| character(len=*), | intent(in) | :: | text |
Text. |
Output string.
Returns .PSPIC macro to add image in Encapsulated PostScript (EPS)
format. Argument align must be either L (left), R (right), or
C (center). If not passed, the image will be centered.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
Path to EPS file. |
||
| character(len=1), | intent(in), | optional | :: | align |
Image alignment ( |
|
| real, | intent(in), | optional | :: | width |
Image width [cm]. |
|
| real, | intent(in), | optional | :: | height |
Image height [cm]. |
Output string.
Returns escape sequence to change type size. Argument n must be
single digit. The result is not new-line terminated!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Absolute or relative size [pt]. |
||
| character(len=*), | intent(in) | :: | text |
Text. |
||
| character(len=1), | intent(in), | optional | :: | rel |
|
Output string.
Returns request to add vertical spacing.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in), | optional | :: | distance |
Vertical space. |
|
| character(len=1), | intent(in), | optional | :: | unit |
Distance unit. Uses [vee] is not passed. |
Output string.
Returns argument text between T{ and T} to create a text block.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
Text. |
Output string.
Returns macro to add institution of author(s). Multiple institutions have to be separated by new line.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | institution |
Institution name. |
Output string.
Returns macro to add author. Multiple authors have to be separated by new line.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | author |
Author name. |
Returns macro to draw a box around text. This function does not
append a new-line character!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
Text. |
Returns macro to define a string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
String name. |
||
| character(len=*), | intent(in), | optional | :: | string |
String contents. |
Output string.
Returns macro to add paragraph (without indent).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in), | optional | :: | text |
Paragraph text. |
Output string.
Returns macro to set section heading macro (without number).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | level |
Heading level (depth). |
||
| character(len=*), | intent(in) | :: | text |
Heading text. |
Output string.
Returns macro to add standard paragraph.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in), | optional | :: | text |
Paragraph text. |
Output string.
Returns macro to add section heading (without number).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | level |
Heading level (depth). |
||
| character(len=*), | intent(in) | :: | text |
Heading text. |
Output string.
Returns macro to add title.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | title |
Title. |
Output string.