NodeStyle.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Written by Bill Paxton, January 1981
Last changed by Bill Paxton, December 1, 1982 8:37 am
Plass, March 14, 1985 4:47:24 pm PST
Beach, March 23, 1985 5:16:53 pm PST
Michael Plass, May 20, 1985 8:01:47 pm PDT
Doug Wyatt, September 25, 1986 12:07:30 pm PDT
Style Record Definitions
Style: TYPE ~ REF StyleBody;
StyleBody:
TYPE ~
RECORD [
fontFace: FontFace ← Regular, -- 2 bits
fontAlphabets: FontAlphabets ← CapsAndLower, -- 2 bits
strikeout: FontUnderlining ← None, -- 2 bits
underlining: FontUnderlining ← None, -- 2 bits
lineFormatting: LineFormatting ← FlushLeft, -- 2 bits
lastLineFormatting: LineFormatting ← FlushLeft, -- 2 bits
pathType: PathType ← Filled, -- 2 bits
print: BOOL ← FALSE, -- true if using the hardcopy style rules
isComment: BOOL ← FALSE, -- set to node.comment; readonly for style rules
fixedTabs: BOOL ← FALSE, -- true if stops at fixed locations. else relative to left margin
nestingLevel: [0..MaxNestingLevel] ← 0, -- node level in tree; readonly for style rules
numTabStops: [0..MaxTabStops) ← 0, -- length of the tabStops list
name: ARRAY NameParam OF ATOM,
real: PACKED ARRAY RealParam OF RealCode,
defaultTabStops: TabStop, -- if NIL, use 0.5 in flushLeft blank defaultTabStops
tabStops:
LIST
OF TabStop,
-- kept sorted by decreasing location, i.e., from right to left on page
this order substantially reduces allocations during the creation of the list since styles tend to define tab stops in increasing order, so can add to start of list and list additions must be non-destructive of the previous list. since length of list is given, can easily find the nth stop.
font: ImagerFont.Font, -- function of fontPrefix, fontFamily, fontFace, and fontSize
dataList: DataList -- for special parameters
];
MaxNestingLevel: INTEGER ~ 31; -- 5 bits
MaxTabStops: INTEGER ~ 64; -- 6 bits
NameParam:
TYPE ~ {
style, -- name of the style, such as "TechnicalNote"
fontPrefix, -- prefix of Interpress hierarchical name for font, e.g. Xerox/xc1-1-1/
fontFamily -- name of the font family, such as "Helvetica"
};
RealParam:
TYPE ~ {
special variable used for extensions
freeVar,
miscellaneous font and positioning
fontSize, -- in points
letterspacing, -- distance added between each character
letterspacingStretch,
letterspacingShrink,
hshift, -- distance to offset text, positive to the right
vshift, -- distance to raise text above baseline (can be negative)
tabStops, -- tab spacing in points (for typewriter-style tab stops)
textRotation,
textHue, -- color for text
textSaturation,
textBrightness,
indent parameters
leftIndent, -- all lines indent this much on left
rightIndent, -- all lines indent this much on right
firstIndent, -- first line indent this much more on left
firstIndentRight, -- first line indent this much more on the right
restIndent, -- other lines indent this much more on left
runaroundLeft, -- depth of first indent on the left
runaroundRight, -- depth of first indent on the right
topIndent, -- top line at least this much down from top of viewer/page
bottomIndent, -- bottom baseline at least this up from bottom of page
leading parameters
minLineGap, -- min distance between line top and previous bottom (can be negative)
leading, -- distance between baselines
leadingStretch,
leadingShrink,
topLeading, -- min distance from first baseline to previous
topLeadingStretch,
topLeadingShrink,
bottomLeading, -- min distance from last baseline to next
bottomLeadingStretch,
bottomLeadingShrink,
graphics
areaHue, -- color for filled areas
areaSaturation,
areaBrightness,
outlineHue, -- color for outlines
outlineSaturation,
outlineBrightness,
lineWeight, -- width of graphics lines
page layout parameters
pageWidth,
pageLength,
leftMargin,
rightMargin,
topMargin,
bottomMargin,
headerMargin,
footerMargin,
bindingMargin,
lineLength,
columns, -- number of columns
pagebreak, -- glue added between pages (well sort of)
pagebreakStretch,
pagebreakShrink,
penalty parameters for page layout
pageBreakPenalty, -- penalty for breaking inside node
pageBreakAfterFirstLinePenalty, -- penalty for breaking node after its first line
pageBreakBeforeLastLinePenalty, -- penalty for breaking node before its last line
pageBreakBeforeFirstLinePenalty, -- penalty for breaking before first line of node
pageBreakAfterLastLinePenalty, -- penalty for breaking after last line of node
underline
underlineThickness, -- width of the rule drawn under characters
underlineDescent, -- positive offset to position bottom of underline below the baseline
underlineHue, -- color for underlines
underlineSaturation,
underlineBrightness,
strikeout
strikeoutThickness, -- width of the rule drawn through characters
strikeoutAscent, -- positive offset to position bottom of strikeout above the baseline
strikeoutHue, -- color for strikeouts
strikeoutSaturation,
strikeoutBrightness,
outlinebox
outlineboxThickness, -- width of the rule drawn around text
outlineboxBearoff, -- positive distance between the font box for text and the outline
outlineboxHue, -- color for outlinebox
outlineboxSaturation,
outlineboxBrightness,
background
backgroundAscent, -- positive offset to position top of background above the baseline
backgroundDescent, -- positive offset to position bottom of background below the baseline
backgroundHue, -- color for backgrounds
backgroundSaturation,
backgroundBrightness
};
RealCode: TYPE ~ [0..255] ← 0;
zero: RealCode ~ 0;
overflow: RealCode ~ RealCode.LAST;
DataList: TYPE ~ REF DataEntry;
DataEntryKind: TYPE ~ { object, real, tab };
DataEntry:
TYPE ~
RECORD [
next: DataList,
data:
SELECT kind: DataEntryKind
FROM
object => [
name: ATOM, -- name of the parameter
object: REF -- value of the parameter
],
real => [
-- for real values which overflow the table of common values
param: RealParam, -- which one it is
value: REAL -- the value
],
tab => [
-- for real values from tabspecs which overflow the table of common values
tabStop: TabStop, -- which tab stop it is
which: TabRealParam, -- which value for the tab stop it is
value: REAL -- the value
]
ENDCASE
TabRealParam: TYPE ~ { loc, spacing, weight, vshift };
TabStop: TYPE ~ REF TabStopRec;
LeaderTabStop: TYPE ~ REF leaders TabStopRec;
RuleTabStop: TYPE ~ REF rule TabStopRec;
RulesTabStop: TYPE ~ REF rules TabStopRec;
TabStopRec:
TYPE ~
RECORD [
looks: TextLooks.Looks, -- the default looks for the stop
loc: RealCode, -- the location of the stop
alignment: TabAlign ← FlushLeft, -- how the tab is aligned
alignmentChar: CHAR ← 0C, -- only of interest if alignment = Character
breakIfPast: BOOL ← FALSE, -- what to do if you are already beyond the tab stop
fill:
SELECT fillKind: TabFillKind
FROM
blank => [],
leaders => [
congruent: BOOL ← TRUE, -- otherwise, centered
char: CHAR ← 0C, -- the character to be repeated
spacing: RealCode -- the distance between repetitions
],
rule => [
weight: RealCode, -- the thickness of the rule
vshift: RealCode -- the distance up from the baseline to the bottom of the rule
],
rules => [
rules: TabArray -- array of records with weight and vshift for each rule
],
ENDCASE
];
TabAlign: TYPE ~ { FlushLeft, FlushRight, Centered, Character };
TabFillKind: TYPE ~ { blank, leaders, rule, rules };
TabInfo: TYPE ~ RECORD [weight, vshift: RealCode];
TabArray: TYPE ~ REF TabArrayRec;
TabArrayRec: TYPE ~ RECORD [array: SEQUENCE length: NAT OF TabInfo];
FontFace: TYPE ~ { Regular, Bold, Italic, BoldItalic };
FontAlphabets: TYPE ~ { CapsAndLower, CapsAndSmallCaps, LowerOnly, CapsOnly };
FontUnderlining: TYPE ~ { None, LettersAndDigits, Visible, All };
LineFormatting: TYPE ~ { FlushLeft, FlushRight, Justified, Centered };
PathType: TYPE ~ { Filled, Outlined, FilledAndOutlined };
pointsPerPica: REAL;
pointsPerInch: REAL;
pointsPerCentimeter: REAL;
pointsPerMillimeter: REAL;
pointsPerDidot: REAL;
pointsPerFil: REAL;
pointsPerFill: REAL;
pointsPerFilll: REAL;
Page Layout
GetPageWidth:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,pageWidth]] };
GetPageLength:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,pageLength]] };
GetLeftMargin:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,leftMargin]] };
GetRightMargin:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,rightMargin]] };
GetTopMargin:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,topMargin]] };
GetBottomMargin:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,bottomMargin]] };
GetHeaderMargin:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,headerMargin]] };
GetFooterMargin:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,footerMargin]] };
GetBindingMargin:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,bindingMargin]] };
GetLineLength:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,lineLength]] };
GetColumns:
PROC [s: Style]
RETURNS [
INT]
~ INLINE { RETURN [GetInt[s,columns]] };
GetPageBreak:
PROC [s: Style]
RETURNS [
INT]
~ INLINE { RETURN [GetInt[s,pagebreak]] };
GetPageBreakStretch:
PROC [s: Style]
RETURNS [
INT]
~ INLINE { RETURN [GetInt[s,pagebreakStretch]] };
GetPageBreakShrink:
PROC [s: Style]
RETURNS [
INT]
~ INLINE { RETURN [GetInt[s,pagebreakShrink]] };
Underline, Strikeout, Outlines, and Backgrounds
GetUnderlineThickness:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,underlineThickness]] };
GetUnderlineDescent:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,underlineDescent]] };
GetUnderlineHue:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,underlineHue]] };
GetUnderlineSaturation:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,underlineSaturation]] };
GetUnderlineBrightness:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,underlineBrightness]] };
GetStrikeoutThickness:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,strikeoutThickness]] };
GetStrikeoutAscent:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,strikeoutAscent]] };
GetStrikeoutHue:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,strikeoutHue]] };
GetStrikeoutSaturation:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,strikeoutSaturation]] };
GetStrikeoutBrightness:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,strikeoutBrightness]] };
GetOutlineboxThickness:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,outlineboxThickness]] };
GetOutlineboxBearoff:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,outlineboxBearoff]] };
GetOutlineboxHue:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,outlineboxHue]] };
GetOutlineboxSaturation:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,outlineboxSaturation]] };
GetOutlineboxBrightness:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,outlineboxBrightness]] };
GetBackgroundAscent:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,backgroundAscent]] };
GetBackgroundDescent:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,backgroundDescent]] };
GetBackgroundHue:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,backgroundHue]] };
GetBackgroundSaturation:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,backgroundSaturation]] };
GetBackgroundBrightness:
PROC [s: Style]
RETURNS [
REAL]
~ INLINE { RETURN [GetReal[s,backgroundBrightness]] };