Copyright (c) Hyperion Entertainment and contributors.

WORD IFF Document Storage

From AmigaOS Documentation Wiki
Jump to navigation Jump to search

WORD

IFF FORM / CHUNK DESCRIPTION
============================

Form/Chunk IDs:
   FORM   WORD
   Chunks FONT,COLR,DOC,HEAD,FOOT,PCTS,PARA,TABS,PAGE,TEXT,FSCC,PINF

Date Submitted: 03/87
Submitted by:   James Bayless - New Horizons Software, Inc.


FORM
====

FORM ID:  WORD

FORM Purpose:  Document storage (supports color, fonts, pictures)

FORM Description:

This include file describes FORM WORD and its Chunks

/*
 *      IFF Form WORD structures and defines
 *      Copyright (c) 1987 New Horizons Software, Inc.
 *
 *      Permission is hereby granted to use this file in any and all
 *      applications.  Modifying the structures or defines included
 *      in this file is not permitted without written consent of
 *      New Horizons Software, Inc.
 */

#include ":IFF/ILBM.h"        /* Makes use of ILBM defines */

#define ID_WORD      MakeID('W','O','R','D')      /* Form type */

#define ID_FONT      MakeID('F','O','N','T')      /* Chunks */
#define ID_COLR      MakeID('C','O','L','R')
#define ID_DOC       MakeID('D','O','C',' ')
#define ID_HEAD      MakeID('H','E','A','D')
#define ID_FOOT      MakeID('F','O','O','T')
#define ID_PCTS      MakeID('P','C','T','S')
#define ID_PARA      MakeID('P','A','R','A')
#define ID_TABS      MakeID('T','A','B','S')
#define ID_PAGE      MakeID('P','A','G','E')
#define ID_TEXT      MakeID('T','E','X','T')
#define ID_FSCC      MakeID('F','S','C','C')
#define ID_PINF      MakeID('P','I','N','F')

/*
 *   Special text characters for page number, date, and time
 *   Note:  ProWrite currently supports only PAGENUM_CHAR, and only in
 *      headers and footers
 */

#define PAGENUM_CHAR   0x80
#define DATE_CHAR      0x81
#define TIME_CHAR      0x82

/*
 *   Chunk structures follow
 */

/*
 *   FONT - Font name/number table
 *   There are one of these for each font/size combination
 *   These chunks should appear at the top of the file (before document data)
 */

typedef struct {
   UBYTE   Num;         /* 0 .. 255 */
   UWORD   Size;
/* UBYTE   Name[];      */   /* NULL terminated, without ".font" */
} FontID;

/*
 *   COLR - Color translation table
 *   Translates from color numbers used in file to ISO color numbers
 *   Should be at top of file (before document data)
 *   Note:  Currently ProWrite only checks these values to be its current map,
 *      it does no translation as it does for FONT chunks
 */

typedef struct {
   UBYTE   ISOColors[8];
} ISOColors;

/*
 *   DOC - Begin document section
 *   All text and paragraph formatting following this chunk and up to a
 *   HEAD, FOOT, or PICT chunk belong to the document section
 */

#define PAGESTYLE_1   0      /* 1, 2, 3 */
#define PAGESTYLE_I   1      /* I, II, III */
#define PAGESTYLE_i   2      /* i, ii, iii */
#define PAGESTYLE_A   3      /* A, B, C */
#define PAGESTYLE_a   4      /* a, b, c */

typedef struct {
   UWORD   StartPage;      /* Starting page number */
   UBYTE   PageNumStyle;   /* From defines above */
   UBYTE   pad1;
   LONG    pad2;
} DocHdr;

/*
 *   HEAD/FOOT - Begin header/footer section
 *   All text and paragraph formatting following this chunk and up to a
 *   DOC, HEAD, FOOT, or PICT chunk belong to this header/footer
 *   Note:  This format supports multiple headers and footers, but currently
 *      ProWrite only allows a single header and footer per document
 */

#define PAGES_NONE   0
#define PAGES_LEFT   1
#define PAGES_RIGHT  2
#define PAGES_BOTH   3

typedef struct {
   UBYTE   PageType;       /* From defines above */
   UBYTE   FirstPage;      /* 0 = Not on first page */
   LONG   pad;
} HeadHdr;

/*
 *   PCTS - Begin picture section
 *   Note:  ProWrite currently requires NPlanes to be three (3)
 */

typedef struct {
   UBYTE   NPlanes;      /* Number of planes used in picture bitmaps */
   UBYTE   pad;
} PictHdr;

/*
 *   PARA - New paragraph format
 *   This chunk should be inserted first when a new section is started (DOC,
 *      HEAD, or FOOT), and again whenever the paragraph format changes
 */

#define SPACE_SINGLE   0
#define SPACE_DOUBLE   0x10

#define JUSTIFY_LEFT    0
#define JUSTIFY_CENTER  1
#define JUSTIFY_RIGHT   2
#define JUSTIFY_FULL    3

#define MISCSTYLE_NONE   0
#define MISCSTYLE_SUPER  1      /* Superscript */
#define MISCSTYLE_SUB    2      /* Subscript */

typedef struct {
   UWORD   LeftIndent;    /* In decipoints (720 dpi) */
   UWORD   LeftMargin;
   UWORD   RightMargin;
   UBYTE   Spacing;       /* From defines above */
   UBYTE   Justify;       /* From defines above */
   UBYTE   FontNum;       /* FontNum, Style, etc. for first char in para*/
   UBYTE   Style;         /* Standard Amiga style bits */
   UBYTE   MiscStyle;     /* From defines above */
   UBYTE   Color;         /* Internal number, use COLR to translate */
   LONG    pad;
} ParaFormat;

/*
 *   TABS - New tab stop types/locations
 *   Use an array of values in each chunk
 *   Like the PARA chunk, this should be inserted whenever the tab settings
 *      for a paragraph change
 *   Note:  ProWrite currently does not support TAB_CENTER
 */

#define TAB_LEFT     0
#define TAB_CENTER   1
#define TAB_RIGHT    2
#define TAB_DECIMAL  3

typedef struct {
   UWORD   Position;      /* In decipoints */
   UBYTE   Type;
   UBYTE   pad;
} TabStop;

/*
 *   PAGE - Page break
 *   Just a marker -- this chunk has no data
 */

/*
 *   TEXT - Paragraph text (one block per paragraph)
 *   Block is actual text, no need for separate structure
 *   If the paragraph is empty, this is an empty chunk -- there MUST be
 *   a TEXT block for every paragraph
 *   Note:  The only ctrl characters ProWrite can currently handle in TEXT
 *   chunks are Tab and PAGENUM_CHAR, ie no Return's, etc.
 */

/*
 *   FSCC - Font/Style/Color changes in previous TEXT block
 *   Use an array of values in each chunk
 *   Only include this chunk if the previous TEXT block did not have
 *      the same Font/Style/Color for all its characters
 */

typedef struct {
   UWORD   Location;      /* Character location in TEXT chunk of change */
   UBYTE   FontNum;
   UBYTE   Style;
   UBYTE   MiscStyle;
   UBYTE   Color;
   UWORD   pad;
} FSCChange;

/*
 *   PINF - Picture info
 *   This chunk must only be in a PCTS section
 *   Must be followed by ILBM BODY chunk
 *   Pictures are treated independently of the document text (like a
 *      page-layout system), this chunk includes information about what
 *      page and location on the page the picture is at
 *   Note:  ProWrite currently only supports mskTransparentColor and
 *      mskHasMask masking
 */

typedef struct {
   UWORD         Width, Height;   /* In pixels */
   UWORD         Page;         /* Which page picture is on (0..max) */
   UWORD         XPos, YPos;      /* Location on page in decipoints */
   Masking       Masking;      /* Like ILBM format */
   Compression   Compression;   /* Like ILBM format */
   UBYTE         TransparentColor;   /* Like ILBM format */
   UBYTE         pad;
} PictInfo;

/* end */