# The OpenJade MIF backend

### Created by Kathleen Marszalek and Paul Prescod
Sponsored by ISOGEN International Corp

## Contents

- Supported Flow Objects
  - character
  - display-group
  - rule
  - score
  - line-field
  - leader
  - link
  - index-entry
  - sequence
  - external-graphic
  - paragraph
  - paragraph-break
  - simple-page-sequence
  - table
  - table-part
  - table-column
  - table-row
  - table-cell
  - table-border
- Problems & Limitations
  - Table border resolution
  - External graphic width and height
  - Space before non-paragraph displayed objects
  - The vertical positioning of the displayed rule flow object
  - The box flow object
- Tips
  - Creating hypertext documents
  - Updating page numbering
  - Specifying colors

## Supported Flow Objects

character
Inherited characteristics | Non-inherited characteristics

- font-weight
- font-posture
- font-name
- font-size
- input-whitespace-treatment
- position-point-shift
- language
- country
- color

Back to top

display-group
Inherited characteristics | Non-inherited characteristics

- space-before
- space-after
- keep-with-previous?
- keep-with-next?
- break-before (#f, page)
- break-after (#f, page)
- keep (#f, page)
- may-violate-keep-before?
- may-violate-keep-after?

Back to top

rule
Inherited characteristics | Non-inherited characteristics

- line-cap
- line-thickness
- line-repeat
- line-sep
- position-point-shift
- display-alignment (start, end, center)
- start-indent
- end-indent
- span (spans all columns if > 1)
- color

- orientation (horizontal, escapement)
- length
- space-before
- space-after
- keep-with-previous?
- keep-with-next?
- break-before (#f, page)
- break-after (#f, page)
- keep (#f, page)
- may-violate-keep-before?
- may-violate-keep-after?

Back to top

score
Inherited characteristics | Non-inherited characteristics

- line-repeat (1 for type of before and through, 1 or 2 for after)

- type (before, through, after)

Back to top

line-field*
Inherited characteristics | Non-inherited characteristics

- field-width
- field-align

* At the beginning of paragraph only.

Back to top

leader*
Inherited characteristics | Non-inherited characteristics
* On the last line of paragraph only. The principal port (the leader string itself) can contain characters only. The content of the flow object is ignored: a dotted leader will always be used. The specified length is ignored: it always fills out the line.

Back to top

link
Inherited characteristics | Non-inherited characteristics

- destination [#f, objects returned by (idref-address ...) and (current-node-address ...)]

Back to top

index-entry
Inherited characteristics | Non-inherited characteristics

- components
- page-number?
- sort-string
- starts-page-range?
- ends-page-range?

components
  is a list of strings that represent index entry levels. This characteristic is not inherited and shall be specified.
page-number?
  is a boolean specifying whether this index entry should contain page number information. This characteristic is not inherited. The default is #t.
sort-string
  is either #f, specifying that this index entry's components should be used for sorting the index, or a string that should be used for sorting. This characteristic is not inherited. The default is #f.
starts-page-range?
  is a boolean specifying whether the index entry starts a page range. This characteristic is not inherited. The default is #f.
ends-page-range?
  is a boolean specifying whether the index entry starts a page range. This characteristic is not inherited. The default is #f.

Here's how to enable the above extension: (declare-flow-object-class index-entry "UNREGISTERED::ISOGEN//Flow Object Class::index-entry")

Back to top

external-graphic
Inherited characteristics | Non-inherited characteristics

- space-before
- space-after

- display?
- scale (max)
- max-width
- max-height
- entity-system-id
- display-alignment
- start-indent
- end-indent
- span (spans all columns if > 1)
- space-before
- space-after
- keep-with-previous?
- keep-with-next?
- break-before (#f, page)
- break-after (#f, page)
- keep (#f, page)
- may-violate-keep-before?
- may-violate-keep-after?

Back to top

paragraph
Inherited characteristics | Non-inherited characteristics

- lines (wrap, asis-wrap)
- hyphenation-ladder-count
- hyphenation-remain-char-count
- hyphenation-push-char-count
- font-weight
- font-posture
- font-name
- font-size
- quadding
- widow-count
- orphan-count
- language
- country

- span (spans all columns if > 1)
- space-before
- space-after
- keep-with-previous?
- keep-with-next?
- break-before (#f, page)
- break-after (#f, page)
- keep (#f, page)
- may-violate-keep-before?
- may-violate-keep-after?
- line-spacing
- min-leading (#f or 0 for proportional line spacing)
- first-line-start-indent

Back to top

paragraph-break
Inherited characteristics | Non-inherited characteristics
Same as for paragraph | Same as for paragraph

Back to top

simple-page-sequence
Inherited characteristics | Non-inherited characteristics

- page-width
- page-height
- left-margin
- right-margin
- top-margin
- bottom-margin
- header-margin
- footer-margin

- left-header
- center-header
- right-header
- left-footer
- center-footer
- right-footer

(page-number-sosofo)
(current-node-page-number-sosofo)
"UNREGISTERED::James Clark//Procedure::if-first-page"
  This can be used only in the specification of the value of one of the header/footer characteristics of simple-page-sequence. It returns a sosofo that will display as sosofo1 if the page is the first page of the simple-page-sequence and as sosofo2 otherwise.
"UNREGISTERED::James Clark//Procedure::if-front-page"
  This can be used only in the specification of the value of one of the header/footer characteristics of simple-page-sequence. It returns a sosofo that will display as sosofo1 if the page is a front (ie recto, odd-numbered) page and as sosofo2 if it is a back (i.e. verso, even-numbered) page.
"UNREGISTERED::James Clark//Characteristic::page-n-columns"
  Value is a strictly positive integer, specifying the number of columns. The initial value is 1.
"UNREGISTERED::James Clark//Characteristic::page-column-sep"
  Value is a length, specifying the separation between columns. The initial value is .5in.
"UNREGISTERED::James Clark//Characteristic::page-balance-columns?"
  Value is a boolean. If true, the columns on the final page of the page-sequence should be balanced. The initial value is #f.

Here's how to enable the above extensions:
(define if-first-page (external-procedure
"UNREGISTERED::James Clark//Procedure::if-first-page"))
(define if-front-page (external-procedure
"UNREGISTERED::James Clark//Procedure::if-front-page"))
(declare-characteristic page-n-columns
"UNREGISTERED::James Clark//Characteristic::page-n-columns" 1)
(declare-characteristic page-n-columns
"UNREGISTERED::James Clark//Characteristic::page-column-gap" (* 36 1pt))
(declare-characteristic page-balance-columns?
"UNREGISTERED::James Clark//Characteristic::page-balance-columns?" #f)

Back to top

table
Inherited characteristics | Non-inherited characteristics

- table-border
- display-alignment
- start-indent
- end-indent

- table-width
- before-row-border
- after-row-border
- before-column-border
- after-column-border
- span (spans all columns if > 1)
- space-before
- space-after
- keep-with-previous?
- keep-with-next?
- break-before (#f, page)
- break-after (#f, page)
- keep (#f, page)
- may-violate-keep-before?
- may-violate-keep-after?

Back to top

table-part
Inherited characteristics | Non-inherited characteristics

- space-before
- space-after
- keep-with-previous?
- keep-with-next?
- break-before (#f, page)
- break-after (#f, page)
- keep (#f, page)
- may-violate-keep-before?
- may-violate-keep-after?

- header
- footer

Back to top

table-column
Inherited characteristics | Non-inherited characteristics

- start-indent
- end-indent

- column-number
- n-columns-spanned
- width

- (table-unit k)

Back to top

table-cell
Inherited characteristics | Non-inherited characteristics

- cell-before-row-margin
- cell-after-row-margin
- cell-before-column-margin
- cell-after-column-margin
- cell-row-alignment
- cell-before-row-border
- cell-after-row-border
- cell-before-column-border
- cell-after-column-border
- cell-background?
- background-color

- column-number
- n-columns-spanned
- n-rows-spanned
- starts-row?
- ends-row?

Back to top

table-border
Inherited characteristics | Non-inherited characteristics

- border-present?
- line-thickness
- line-repeat (0, 1, or 2)
- line-sep
- color

Back to top

## Problems & Limitations

### Table border resolution

It's not clear how to predictably enforce cell borders that have mixed line styles. I've posted a question about this to comp.text.frame, but there were no responses so far.

### External graphic width and height

In order to place external graphics inside a text flow one must use an anchored frame containing the <ImportObject...> statement. The ImportObject within the frame can shrink-wrap the referenced graphics, however the anchored frame itself cannot - in general the size of an anchored frame has to be specified explicitly. I've asked about this in comp.text.frame, but the only solutions involved using external programs to read the graphic size from graphic files.

### Space before non-paragraph displayed objects

Flow objects like external-graphic need to be anchored to empty paragraphs so that that frame can determine their position on the page automatically. Since the smallest paragraph height is 2pt (smallest font size that can be used), the total space before such objects should be larger than that. This does not apply to the paragraph flow objects themselves, and to the rule flow object. The rule flow object has the placement direction display size of 0 and it's possible to use negative PgfLeading to let the next paragraph move up if necessary.

### The vertical positioning of the displayed rule flow object

Since the rule is position using inlined anchored frame, the placement is relative to the font baseline. It's assumed that the baseline is 1/3 the font size from the bottom.

### The box flow object

Not sure how to implement it since anchored frames must have fixed height. Maybe using tables would work here(?)

## Tips

### Creating hypertext documents

You must decide on the filename extension you'll use at the stage when you run jade. If you don't want the .mif extension for your final document, feel free to use other extension when specifying the file name using the -o option.

1. Open the book file.
2. While holding SHIFT, select File->Open All Files in Book from the menu.
3. Save each file using View Only format - make sure you use original filenames.

### Updating page numbering

1. Open the book file.
2. While holding SHIFT, select File->Open All Files in Book from the menu.
3. Select File->Generate/Update... and then press Update.

### Specifying colors

OpenJade supports all color spaces specified in DSSSL. The following example uses the RGB color space to create a red rule:

(make rule color: (color (color-space "ISO/IEC 10179:1996//Color-Space Family::Device RGB") 1 0 0) ... )