ImagerXCMap.mesa
Copyright Ó 1987, 1992 by Xerox Corporation. All rights reserved.
Jean-Marc Frailong February 1, 1988 1:45:25 pm PST
Defines mappings from standard (???) Tioga character codes to XC1-2-2 codes.
Provides a special font-mapping context.
DIRECTORY
Imager USING [Context],
ImagerFont USING [XChar],
IO USING [STREAM],
Rope USING [ROPE],
SymTab USING [Ref];
ImagerXCMap: CEDAR DEFINITIONS
~ BEGIN
Map: TYPE ~ REF MapRep;
MapRep: TYPE ~ ARRAY CHAR OF ImagerFont.XChar;
Set: TYPE ~ MACHINE DEPENDENT {
CS0 (0B), -- ASCII/ISO/CCITT Roman Alphabet and Punctuation
JIS1 (041B), -- JIS Symbols 1 - Punctuation and Symbols not in CS0
JIS2 (042B), -- JIS Symbols 2 - Punctuation and Symbols not in CS0
ELA (043B), -- Extended Latin Alphabets
JHS (044B), -- Japanese Hiragana Syllabary and Bo-po-mo-fo
JKS (045B), -- Japanese Katakana Syllabary
GR (046B), -- Greek Alphabet
CY (047B), -- Cyrillic Alphabet
FMC (050B), -- Form and Mosaic Characters
MJS3 (164B), -- Symbols 3: Miscellaneous Japanese Symbols
MJS4 (166B), -- Symbols 4: Miscellaneous Japanese Symbols
AR (340B), -- Arabic Alphabet
HE (341B), -- Hebrew Alphabet
KH (343B), -- Korean Hangul
GTS2 (356B), -- General and Technical Symbols 2
GTS1 (357B), -- General and Technical Symbols 1
LIG (360B), -- Ligatures and Field Format Symbols
ALC (361B), -- Accented Latin Characters
ARX (365B), -- Initial, Medial and Final Arabic Characters
VRG (375B), -- Variant representations for Graphic Characters
(377B)}; -- reserve 8 bits
BPMF: Set = JHS; -- Chinese Bo-po-mo-fo (same as Japanese Hiragana Syllabary)
XC: TYPE ~ RECORD [c: CHAR, set: Set, code: BYTE];
PartialMap: TYPE ~ LIST OF XC;
PartialMaps: TYPE ~ LIST OF PartialMap;
cs0Map: Map; -- defines the identity mapping CHAR -> [CS0, CHAR]
maps: SymTab.Ref; -- holds the maps accessed through GetMap/GetFontMap
FontMap: TYPE ~ LIST OF FontMapEntry;
FontMapEntry: TYPE ~ RECORD [
inputName: Rope.ROPE,
outputName: Rope.ROPE,
map: Map,
scale: REAL ¬ 1.0, -- necessary because Tioga fonts do not have the scale factor properly set
warn: BOOL ¬ FALSE
];
Building a map
ControlCharacterBug: SIGNAL [code: CHAR];
MakeMap: PROC [entriesList: PartialMaps, default: Map ¬ cs0Map] RETURNS [map: Map];
Build a map from partial maps. Raises ControlCharacterBug is one of the basic control characters is assigned in one of the partial maps.
Access to map table
AddMap: PROC [family: Rope.ROPE, entriesList: PartialMaps, default: Map ¬ cs0Map];
Build a map from partial maps and add it to the table under the family name.
GetFamilyMap: PROC [family: Rope.ROPE] RETURNS [map: Map];
Retrieve the mapping for specified family. If not found, return identity map to set 0
GetFontMap: PROC [fontName: Rope.ROPE] RETURNS [map: Map];
Retrieve the mapping for specified font. If not found, return identity map to set 0. All fonts of a same family have the same Map pointer
Filtering imager context
tiogaToXC: FontMap; -- maps Tioga fonts to XC equivalents
pressToXC: FontMap; -- maps Press fonts to XC equivalents
tiogaAndPressToXC: FontMap; -- maps Tioga & Press fonts to XC equivalents
FilterFonts: PROC [c: Imager.Context, fontMap: FontMap, msg: IO.STREAM, verbose: BOOL] RETURNS [context: Imager.Context];
Create a new context that will do the specified font filtering
END.