ImagerXCCharMapImpl.mesa
Copyright 1987, 1992 by Xerox Corporation. All rights reserved.
Jean-Marc Frailong February 10, 1988 11:22:45 am PST
Defines mappings from standard (???) Tioga character codes to XC1-2-2 codes
The idea is to provide mappings in such a way that, in a style, one may say:
(GreekFont) "Greek font" {
IF the device (xc) .eq THEN {"Classic" family "Hippo" XCMap} ELSE {"Hippo" family}
} PrintRule
which means that when XC device is selected (and also XC fonts...) then the characters in that font are to be remapped according to the Hippo font -> XC1-2-2 mapping
Willie-s, April 6, 1992 12:56 pm PDT
DIRECTORY
Ascii, Char, Rope, SymTab, ImagerXCMap;
ImagerXCCharMapImpl: CEDAR PROGRAM
IMPORTS Char, Rope, SymTab
EXPORTS ImagerXCMap
~ BEGIN OPEN ImagerXCMap;
Tioga->XC mapping components
asciiExceptions: PartialMap LIST [ -- irregular ASCII characters
Maps differently a few ASCII characters that do not behave normally with all Tioga fonts
XC['$, CS0, 244B], -- 044B: $ is mapped to dollar, not ASCII currency sign
XC['\047, CS0, 271B], -- 047B: ' is mapped to right quote, not ASCII apostrophy
XC['-, CS0, 055B], -- Minus (or use one of the other dashes? )
XC['^, CS0, 255B], -- 136B: is mapped to up arrow, not ASCII spacing circumflex
XC['←, CS0, 254B], -- 137B: is mapped to left arrow, not ASCII underscore
XC['\140, CS0, 251B] -- 140B: ` is mapped to left quote, not ASCII spacing grave accent
];
hyphens: PartialMap LIST [
Defines the various standard dash/hyphens (in a single place to facilitate changes...)
XC['\023, GTS1, 045B], -- 023B: Em dash
XC['\026, GTS1, 044B], -- 026B: En dash
XC['\030, GTS1, 046B] -- 030B: Figure dash (OldDash for TEditFormatImpl)
];
tiogaExtras: PartialMap LIST [ -- special for Tioga10
Extension of ASCII for Tioga family
Overlay asciiExceptions, tiogaExtras
Maps [001B .. 017B], [200B .. 376B] with plenty of holes
XC[', GTS1, 064B], -- 001B: Start of field (NOT IN Classic/Modern)
XC[', GTS1, 065B], -- 002B: End of field (NOT IN Classic/Modern)
XC[', CS0, 000B], -- 003B: not in XC1-2-2
XC[', CS0, 260B], -- 004B: Degree
XC[' , CS0, 301B], -- 005B: Grave accent, non-spacing
XC[', CS0, 000B], -- 007B: not in XC1-2-2
XC[' , CS0, 302B], -- 013B: Acute accent, non-spacing
XC[', ALC, 050B], -- 017B: Angstrom (use A circle accented letter)
XC[', CS0, 261B], -- 020B: PlusOrMinus
XC[', GR, 156B], -- 024B: lambda
XC[', GR, 157B], -- 025B: mu (in fact micron, but absent from classic/modern)
XC[', GR, 135B], -- 026B: Omega
XC['—, GTS1, 045B], -- 030B: Em dash (xOldDash for TEditFormatImpl)
XC[', CS0, 000B], -- 032B: not in XC1-2-2
XC[', ALC, 047B], -- 200B: A trema
XC[', ALC, 124B], -- 201B: O trema
XC[', ALC, 247B], -- 240B: a trema
XC[', ALC, 324B], -- 241B: o trema
XC[', ALC, 345B], -- 243B: u trema
XC[', ALC, 255B], -- 244B: c cedilla
XC[', CS0, 251B], -- 251B: Left quote
XC[', CS0, 252B], -- 252B: Left double quote
XC[', CS0, 253B], -- 253B: Left brackets
XC[', CS0, 254B], -- 254B: Left arrow (variant graphics)
XC[', CS0, 255B], -- 255B: Up arrow (variant graphics)
XC[', CS0, 256B], -- 256B: Right arrow
XC[', CS0, 257B], -- 257B: Down arrow
XC[', JIS1, 172B], -- 265B: Star
XC[', GTS1, 146B], -- 267B: Bullet
XC[', CS0, 271B], -- 271B: Right quote
XC[', CS0, 272B], -- 272B: Right double quote
XC[', CS0, 273B], -- 273B: Right brackets
XC[' , CS0, 301B], -- 301B: Grave accent, non-spacing (variant graphics)
XC[' , CS0, 302B], -- 302B: Acute accent, non-spacing (variant graphics)
XC[' , CS0, 303B], -- 303B: Circumflex accent, non-spacing (variant graphics)
XC[', CS0, 323B] -- 323B: Copyright
];
apl: PartialMap LIST [ -- TBD
All non-identity characters in APL font
Do NOT merge with any other map ...
];
amTeX: PartialMap LIST [
All non-identity characters in AMTeX fonts
Do NOT merge with any other map ...
XC['\000, CS0, 000B], -- 000B: Little square - Cancelled as control code (NUL)
XC[', CS0, 257B], -- 001B: Down arrow
XC[', GR, 141B], -- 002B: alpha
XC[', GR, 142B], -- 003B: beta
XC[', GTS1, 266B], -- 004B: Logical And
XC[', GTS1, 152B], -- 005B: Logical Not
XC[', GTS1, 112B], -- 006B: Member of
XC[', GR, 163B], -- 007B: pi
XC[', GR, 156B], -- 010B: lambda
XC['\011, CS0, 257B], -- 011B: lambda - Cancelled as control code (TAB)
XC['\012, GR, 145B], -- 012B: delta - Cancelled as control code (LF)
XC[' , CS0, 255B], -- 013B: Up arrow
XC[' , CS0, 261B], -- 014B: PlusOrMinus
XC['\015, GTS1, 142B], -- 015B: Absolute Sum - Cancelled as control code (CR)
XC[', JIS1, 147B], -- 016B: Infinity
XC[', GTS1, 272B], -- 017B: Partial derivative
XC[', GTS1, 133B], -- 020B: Contained in
XC[', GTS1, 132B], -- 021B: Contains
XC[', GTS1, 126B], -- 022B: Intersection
XC[', GTS1, 127B], -- 023B: Union
XC[', GTS1, 265B], -- 024B: For all
XC[', GTS1, 264B], -- 025B: There exists
XC[', GTS1, 144B], -- 026B: Absolute product
XC[', GTS1, 121B], -- 027B: Twin arrows
XC['—, CS0, 254B], -- 030B: Left arrow
XC[', CS0, 256B], -- 031B: Right arrow
XC[', JIS1, 142B], -- 032B: Different
XC[', JIS1, 176B], -- 033B: Diamond (not in Classic/Modern)
XC[', JIS1, 145B], -- 034B: Less than or equal
XC[', JIS1, 146B], -- 035B: Greater than or equal
XC[', GTS1, 162B], -- 036B: Identical
XC[', GTS1, 267B], -- 037B: Logical Or
XC['$, CS0, 244B], -- 044B: $ is mapped to dollar, not ASCII currency sign
XC[', GTS1, 165B], -- 177B: Integral
XC[', CS0, 244B], -- 244B: Dollar (variant graphics)
XC[', CS0, 251B], -- 251B: Left quote (variant graphics)
XC[', CS0, 252B], -- 252B: Left double quote (variant graphics)
XC[', CS0, 253B], -- 253B: Left brackets (variant graphics)
XC[', CS0, 254B], -- 254B: Left arrow (variant graphics)
XC[', CS0, 255B], -- 255B: Up arrow (variant graphics)
XC[', CS0, 256B], -- 256B: Right arrow (variant graphics)
XC[', CS0, 257B], -- 257B: Down arrow (variant graphics)
XC[', CS0, 271B], -- 271B: Right quote (variant graphics)
XC[', CS0, 272B], -- 272B: Right double quote (variant graphics)
XC[', CS0, 273B], -- 273B: Right brackets (variant graphics)
XC[', CS0, 323B] -- 323B: Copyright (variant graphics)
];
cream: PartialMap LIST [
Adjuncts to asciiExceptions for Cream font
Maps [001B .. 037B] only
XC[', JIS1, 145B], -- 001B: Less than or equal
XC[', CS0, 000B], -- 003B: not in XC1-2-2
XC[', CS0, 000B], -- 005B: not in XC1-2-2
XC[', GTS1, 162B], -- 006B: Identical
XC[', GTS1, 162B], -- 007B: Degree (approximation only...)
XC[', JIS1, 142B], -- 016B: Different
XC[', CS0, 000B], -- 017B: not in XC1-2-2
XC[', GTS2, 252B], -- 021B: Double up arrow (not in Classic/Modern)
XC[', JIS1, 146B], -- 022B: Greater than or equal
XC[', CS0, 000B], -- 023B: not in XC1-2-2
XC[', CS0, 000B], -- 024B: not in XC1-2-2
XC[', ELA, 303B], -- 025B: Overline (not in Classic/Modern)
XC[', CS0, 000B], -- 026B: not in XC1-2-2
XC[', CS0, 000B], -- 027B: not in XC1-2-2
XC[', GTS1, 045B], -- 030B: Em dash (xOldDash for TEditFormatImpl)
XC[', CS0, 000B], -- 031B: not in XC1-2-2
XC[', GTS1, 117B], -- 033B: Implies
XC[', JIS2, 042B], -- 035B: Square
XC[', CS0, 000B] -- 036B: not in XC1-2-2
];
cyrillic: PartialMap LIST [ -- TBD
Full map for Cyrillic family
];
eightBitExtras: PartialMap LIST [ --
Adjuncts to asciiExceptions for EightBitTimesRoman font
Maps [001B .. 017B], [200B..376B] with plenty of holes
XC[', CS0, 317B], -- 001B: Hacheck, non-spacing instead of spacing
XC[', CS0, 277B], -- 002B: Spanish question mark
XC[', ALC, 255B], -- 003B: c cedilla
XC[', CS0, 310B], -- 004B: Trema, non-spacing instead of spacing
XC[', CS0, 301B], -- 005B: grave accent, non-spacing instead of spacing
XC[', LIG, 041B], -- 006B: ff ligature
XC[', CS0, 251B], -- 007B: Left quote (alternate)
XC[', CS0, 241B], -- 010B: Inverted bang
XC[' , CS0, 302B], -- 013B: acute accent, non-spacing instead of spacing
XC[', CS0, 305B], -- 016B: long accent, non-spacing instead of spacing
XC[', CS0, 304B], -- 020B: tilda accent, non-spacing instead of spacing
XC[', LIG, 042B], -- 021B: ffi ligature
XC[', LIG, 043B], -- 022B: ffl ligature
XC['\023, GTS1, 045B], -- 023B: Em dash - Defined in hyphens
XC[', LIG, 044B], -- 024B: fi ligature
XC[', LIG, 045B], -- 025B: fl ligature
XC['\026, GTS1, 044B], -- 026B: En dash - Defined in hyphens
XC[', CS0, 306B], -- 027B: Breve, non-spacing instead of spacing
XC['\030, GTS1, 046B], -- 030B: Figure dash (OldDash) - Defined in hyphens
XC[', ELA, 326B], -- 035B: Dot below accent, non-spacing instead of spacing (??)
XC[', CS0, 304B], -- 036B: Tilda, non-spacing instead of spacing
XC[', CS0, 312B], -- 037B: Ring, non-spacing instead of spacing
XC[', ALC, 047B], -- 200B: A trema
XC[', ALC, 124B], -- 201B: O trema
XC[', ALC, 050B], -- 202B: A with ring accent
XC[', LIG, 041B], -- 220B: ff ligature
XC[', LIG, 042B], -- 221B: ffi ligature
XC[', LIG, 043B], -- 222B: ffl ligature
XC[', LIG, 044B], -- 223B: fi ligature
XC[', LIG, 045B], -- 224B: fl ligature
XC[', GTS1, 044B], -- 233B: En dash
XC[', GTS1, 045B], -- 234B: Em dash
XC[', GTS1, 046B], -- 235B: Figure dash
XC[', ELA, 326B], -- 235B: UnderDot accent, non-spacing instead of spacing
XC[', ALC, 247B], -- 240B: a trema
XC[', ALC, 324B], -- 241B: o trema
XC[', ALC, 250B], -- 242B: a with ring accent
XC[', ALC, 345B], -- 243B: u trema
XC[', ALC, 255B], -- 244B: c cedilla
XC[', CS0, 310B], -- 250B: Trema, non-spacing instead of spacing
XC[', CS0, 312B], -- 251B: Ring accent, non-spacing instead of spacing
XC[', CS0, 301B], -- 252B: Grave accent, non-spacing instead of spacing
XC[', CS0, 302B], -- 253B: Acute accent, non-spacing instead of spacing
XC[', CS0, 303B], -- 254B: Circumflex accent, non-spacing instead of spacing
XC[', CS0, 304B], -- 255B: Tilda, non-spacing instead of spacing
XC[', CS0, 306B], -- 256B: Breve accent, non-spacing instead of spacing
XC[', CS0, 305B], -- 257B: Macron accent, non-spacing instead of spacing
XC[', CS0, 242B], -- 261B: Cent
XC[', CS0, 243B], -- 262B: Pound
XC[', JIS1, 172B], -- 265B: Star
XC[', CS0, 247B], -- 266B: Section
XC[', GTS1, 146B], -- 267B: Bullet
XC[', GTS1, 060B], -- 270B: Dag
XC[', GTS1, 061B], -- 271B: Ddag
XC[', CS0, 266B], -- 272B: Paragraph
XC[', CS0, 261B], -- 274B: PlusOrMinus
XC[', CS0, 241B], -- 275B: Inverted bang
XC[', CS0, 277B], -- 276B: Inverted question mark
XC[', CS0, 137B], -- 277B: Underscore
XC[', GTS1, 43B], -- 337B: Discretionary hyphen (??)
XC[', CS0, 306B], -- 350B: Breve, non-spacing instead of spacing
XC[', ELA, 326B] -- 351B: UnderDot accent, non-spacing instead of spacing
];
gacha: PartialMap LIST [
Remove apostrophy and left quote hacks for gacha (fixed-pitch terminal emulation)
XC['\047, CS0, 047B], -- 047B: apostrophy remains apostrophy
XC['\140, CS0, 140B] -- 140B: spacing grave accent remains spacing grave accent
];
hebrew: PartialMap LIST [ -- TBD
Full map for Hebrew family
];
helvetica: PartialMap LIST [ --
Full map for Helvetica/TimesRoman font (XC Helvetica/TimesRoman are not strictly kosher for codes in asciiExceptions)
Maps [001B .. 017B] with plenty of holes
XC[', CS0, 277B], -- 002B: Spanish question mark
XC[', ALC, 255B], -- 003B: c cedilla
XC[', LIG, 041B], -- 006B: ff ligature
XC[', CS0, 251B], -- 007B: Left quote (alternate)
XC[', CS0, 241B], -- 010B: Inverted bang
XC[', LIG, 042B], -- 021B: ffi ligature
XC[', LIG, 043B], -- 022B: ffl ligature
XC['\023, GTS1, 045B], -- 023B: Em dash - Defined in hyphens
XC[', LIG, 044B], -- 024B: fi ligature
XC[', LIG, 045B], -- 025B: fl ligature
XC['\026, GTS1, 044B], -- 026B: En dash - Defined in hyphens
XC['\030, GTS1, 046B], -- 030B: Figure dash (OldDash) - Defined in hyphens
XC['\047, LIG, 047B] -- 047B: ' is mapped
];
hippo: PartialMap LIST [ -- For greek fonts
Greek alphabet, on top as asciiExceptions & hyphens
XC[', CS0, 251B], -- 007B: Left quote (alternate)
XC['A, GR, 101B], XC['a, GR, 141B], -- Alpha, alpha
XC['B, GR, 102B], XC['b, GR, 142B], -- Beta, beta (word middle missing)
XC['G, GR, 104B], XC['g, GR, 144B], -- Gamma, gamma
XC['D, GR, 105B], XC['d, GR, 145B], -- Delta, delta
XC['E, GR, 106B], XC['e, GR, 146B], -- Epsilon, epsilon
XC['Z, GR, 111B], XC['z, GR, 151B], -- Zeta, zeta
XC['H, GR, 112B], XC['h, GR, 152B], -- Eta, eta
XC['Q, GR, 113B], XC['q, GR, 153B], -- Theta, theta
XC['I, GR, 114B], XC['i, GR, 154B], -- Iota, iota
XC['K, GR, 115B], XC['k, GR, 155B], -- Kappa, kappa
XC['L, GR, 116B], XC['l, GR, 156B], -- Lambda, lambda
XC['M, GR, 117B], XC['m, GR, 157B], -- Mu, mu
XC['N, GR, 120B], XC['n, GR, 160B], -- Nu, nu
XC['C, GR, 121B], XC['c, GR, 161B], -- Xi, xi
XC['O, GR, 122B], XC['o, GR, 162B], -- Omicron, omicron
XC['P, GR, 123B], XC['p, GR, 163B], -- Pi pi
XC['R, GR, 125B], XC['r, GR, 165B], -- Rho, rho
XC['S, GR, 126B], XC['s, GR, 166B], XC['j, GR, 167B], -- Sigma, sigma, sigma end
XC['T, GR, 130B], XC['t, GR, 170B], -- Tau, tau
XC['U, GR, 131B], XC['u, GR, 171B], -- Upsilon, upsilon
XC['F, GR, 132B], XC['f, GR, 172B], -- Phi, phi
XC['X, GR, 133B], XC['x, GR, 173B], -- Chi, chi
XC['Y, GR, 134B], XC['y, GR, 174B], -- Psi, psi
XC['W, GR, 135B], XC['w, GR, 175B] -- Omega, omega
];
math: PartialMap LIST [ -- complete mapping for Math family
Stand alone
XC[', GTS1, 173B], -- 001B: Product sign
XC[', GTS1, 062B], -- 002B: Bra
XC[', GTS1, 063B], -- 003B: Ket
XC[', CS0, 243B], -- 005B: Pound sign
XC[', GTS1, 165B], -- 005B: Integral
XC[', GTS1, 166B], -- 006B: Path integral
XC[', CS0, 266B], -- 013B: Paragraph sign
XC[', CS0, 000B], -- 017B: No equivalent symbol in XC1-2-2
XC[', GTS1, 172B], -- 023B: Sum sign
XC[', GTS1, 157B], -- 026B: Because sign
XC['#, LIG, 376B], -- 040B: Visible space (not in Classic/Modern)
XC[' , GTS1, 060B], -- 041B: Dag
XC[', CS0, 260B], -- 042B: Degree sign
XC[', JIS1, 147B], -- 043B: Infinity sign
XC[', CS0, 242B], -- 044B: Cent sign
XC[', CS0, 270B], -- 045B: Divide sign
XC['', GTS1, 266B], -- 046B: Logical AND
XC['P, GTS1, 163B], -- 047B: Define symbol
XC['`, CS0, 047B], -- 050B: Prime symbol, replace with regular ASCII quote (no equivalent) ??
XC[', GTS1, 174B], -- 051B: Radical symbol
XC[', CS0, 047B], -- 052B: Small dot, replace with regular ASCII quote (no equivalent) ??
XC[', CS0, 261B], -- 053B: PlusOrMinus symbol
XC[' , GTS1, 114B], -- 054B: Such that symbol
XC[', GTS1, 175B], -- 055B: MinusOrPlus symbol
XC['+, JIS1, 150B], -- 056B: Therefore symbol
XC[', GTS1, 145B], -- 057B: Absolute division symbol
XC[', JIS1, 173B], -- 060B: Circle (not in Classic/Modern)
XC[', JIS2, 042B], -- 061B: Square
XC[', GR, 105B], -- 062B: Triangle (use greek Delta, normal not in Classic/Modern)
XC['., JIS1, 176B], -- 063B:Diamond (not in Classic/Modern)
XC[', GTS1, 142B], -- 064B: Absolute sum symbol
XC[', GTS1, 143B], -- 065B: Absolute difference symbol
XC[', GTS1, 144B], -- 066B: Absolute product symbol
XC[' , GTS1, 154B], -- 067B: Angle symbol
XC[', JIS1, 172B], -- 070B: Star
XC['", CS0, 047B], -- 071B: Medium dot, replace with regular ASCII quote (no equivalent) ??
XC[', CS0, 247B], -- 072B: Section symbol
XC[', GTS2, 273B], -- 073B: Black filler (not in Classic/Modern)
XC['d, JIS1, 145B], -- 074B: Less than or equal to symbol
XC['`, JIS1, 142B], -- 075B: Different symbol
XC['e, JIS1, 146B], -- 076B: Greater than or equal to symbol
XC[', CS0, 277B], -- 077B: Reverse question mark
XC[', GTS1, 100B], -- 100B: Care of symbol
XC[', GTS1, 265B], -- 101B: Forall symbol
XC[', GTS1, 112B], -- 102B: Member of symbol
XC[', GTS1, 254B], -- 103B: Complex set symbol
XC[', GTS1, 271B], -- 104B: Nabla symbol
XC[', GTS1, 264B], -- 105B: There exists symbol
XC['!, GTS1, 061B], -- 106B: DDag symbol
XC[', GTS1, 133B], -- 107B: Contained in symbol
XC[', GTS1, 137B], -- 110B: Not contained in symbol
XC[', GTS1, 131B], -- 111B: Contained in or equal to symbol
XC[', GTS1, 132B], -- 112B: Contains symbol
XC[', GTS1, 136B], -- 113B: Not contains symbol
XC[', GTS1, 130B], -- 114B: Contains or equal symbol
XC['[, LIG, 276B], -- 115B: Carriage Return symbol (not in Classic/Modern)
XC[' , GTS1, 113B], -- 116B: Not member symbol
XC[', GTS1, 141B], -- 117B: Empty set symbol
XC[', GTS1, 161B], -- 120B: Proportional symbol
XC[', GTS1, 121B], -- 121B: Twin arrows
XC['], GTS1, 256B], -- 122B: Real set symbol
XC['H, GTS1, 171B], -- 123B: Asympt. equal symbol
XC[', GTS1, 160B], -- 124B: Perpendicular symbol
XC['*, GTS1, 127B], -- 125B: Union symbol
XC['(, GTS1, 267B], -- 126B: Logical OR symbol
XC['{, GTS1, 162B], -- 127B: Identical symbol
XC[' , CS0, 264B], -- 130B: Times symbol
XC[', LIG, 272B], -- 131B: Line Feed symbol (not in Classic/Modern)
XC[', GTS1, 270B], -- 132B: QED symbol
XC['z, CS0, 074B], -- 133B: Less than symbol (no curly version in XC1-2-2)
XC['\, CS0, 057B], -- 134B: Over symbol (no thick version in XC1-2-2)
XC['{, CS0, 076B], -- 135B: Greater than symbol (no curly version in XC1-2-2)
XC[', CS0, 257B], -- 136B: Down arrow (not in Classic/Modern)
XC['b, CS0, 256B], -- 137B: Right arrow (not in Classic/Modern)
XC[', GTS1, 247B], -- 141B: Aleph symbol
XC[', GTS1, 123B], -- 142B: Leads to symbol
XC[', CS0, 323B], -- 143B: Copyright symbol
XC[', GTS1, 272B], -- 144B: Partial derivative symbol
XC['C, GTS1, 167B], -- 145B: Approx. equal symbol
XC[', GTS1, 122B], -- 146B: Bidirectional arrow
XC[', GTS1, 117B], -- 147B: Implies arrow
XC[', GTS1, 150B], -- 150B: Planck constant
XC[', GTS1, 260B], -- 151B: Left ceiling
XC[', GTS1, 261B], -- 152B: Right ceiling
XC[', GTS1, 262B], -- 153B: Left floor
XC[', GTS1, 263B], -- 154B: Right floor
XC['%, GTS1, 110B], -- 155B: Parallel symbol
XC[', GTS1, 152B], -- 156B: Logical not symbol
XC[', GTS1, 147B], -- 157B: Little circle
XC[', GTS1, 066B], -- 160B: Left perp. symbol
XC[', GTS1, 070B], -- 161B: Left double perp. symbol
XC[', CS0, 322B], -- 162B: Registered symbol
XC['g, GTS1, 076B], -- 163B: Right up arrow
XC['f, GTS1, 074B], -- 164B: Left up arrow
XC[', GTS1, 077B], -- 165B: Left down arrow
XC['h, GTS1, 075B], -- 166B: Right down arrow
XC[', GTS1, 102B], -- 167B: Much smaller symbol
XC[', GTS1, 103B], -- 170B: Much larger symbol
XC['), GTS1, 126B], -- 171B: Intersection symbol
XC[', GTS1, 067B], -- 172B: Right perp. symbol
XC[', CS0, 274B], -- 173B: 1/4 fraction
XC[', CS0, 275B], -- 174B: 1/2 fraction
XC[', CS0, 276B], -- 175B: 3/4 fraction
XC[', GTS1, 120B] -- 176B: Reciprocal arrows
];
oldEnglish: PartialMap LIST [ -- complete mapping for Math family
XC[', CS0, 251B] -- 007B: Left quote (alternate)
];
sail: PartialMap LIST [
Ascii extensions for SAIL
XC[', CS0, 257B], -- 001B: Down arrow
XC[', GR, 141B], -- 002B: alpha
XC[', GR, 142B], -- 003B: beta
XC[', GTS1, 266B], -- 004B: Logical And
XC[', GTS1, 152B], -- 005B: Logical Not
XC[', GTS1, 112B], -- 006B: Member of
XC[', GR, 163B], -- 007B: pi
XC[', GR, 156B], -- 010B: lambda
XC[' , CS0, 000B], -- 013B: not in XC1-2-2
XC[' , CS0, 000B], -- 014B: not in XC1-2-2
XC[', JIS1, 147B], -- 016B: Infinity
XC[', GTS1, 272B], -- 017B: Partial derivative
XC[', GTS1, 133B], -- 020B: Contained in
XC[', GTS1, 132B], -- 021B: Contains
XC[', GTS1, 126B], -- 022B: Intersection
XC[', GTS1, 127B], -- 023B: Union
XC[', GTS1, 265B], -- 024B: For all
XC[', GTS1, 264B], -- 025B: There exists
XC[', GTS1, 144B], -- 026B: Absolute product
XC[', GTS1, 122B], -- 027B: Left-Right arrow
XC['—, CS0, 137B], -- 030B: Underscore
XC[', CS0, 256B], -- 031B: Right arrow
XC[', CS0, 176B], -- 032B: Tilda symbol
XC[', JIS1, 142B], -- 033B: Different
XC[', JIS1, 145B], -- 034B: Less than or equal
XC[', JIS1, 146B], -- 035B: Greater than or equal
XC[', GTS1, 162B], -- 036B: Identical
XC[', GTS1, 267B], -- 037B: Logical Or
XC['~, CS0, 175B] -- 176B: Right brace (as 175B) ???
];
Standard maps
maps: PUBLIC SymTab.Ref;
cs0Map: PUBLIC Map NEW [MapRep]; -- c -> [CS0, c]
starsMap: Map NEW [MapRep]; -- c-> *
GetFamilyMap: PUBLIC PROC [family: Rope.ROPE] RETURNS [map: Map] ~ {
Retrieve the mapping for specified family. If not found, return identity map to set 0
map NARROW [SymTab.Fetch[maps, family].val];
IF map=NIL THEN {
AddMap[family, NIL]; -- define the thing to be identity since unknown...
map NARROW [SymTab.Fetch[maps, family].val]; -- in case of race condition...
};
};
GetFontMap: PUBLIC PROC [fontName: Rope.ROPE] RETURNS [map: Map] ~ {
Retrieve the mapping for a specific map. All fonts for a family are guaranteed to have the same Map pointer (so that modifications to one also modify the other).
Family is found as <family>-brr (press style) or <family>10B
Everything up to / or > is ignored first...
map NARROW [SymTab.Fetch[maps, fontName].val];
IF map=NIL THEN { -- map not registered yet
family: Rope.ROPE ClipAfter[fontName, "/>"];
SELECT TRUE FROM
IsSuffix[fontName, "-mrr"] => family StripSuffix[family, "-mrr"];
IsSuffix[fontName, "-mir"] => family StripSuffix[family, "-mir"];
IsSuffix[fontName, "-brr"] => family StripSuffix[family, "-brr"];
IsSuffix[fontName, "-bir"] => family StripSuffix[family, "-bir"];
IsSuffix[fontName, "I"] => family StripScale[family, "I"];
IsSuffix[fontName, "B"] => family StripScale[family, "B"];
IsSuffix[fontName, "IB"] => family StripScale[family, "IB"];
ENDCASE => family StripScale[family, ""];
map GetFamilyMap[family];
[] SymTab.Store[maps, fontName, map]; -- for future reference...
};
};
ControlCharacterBug: PUBLIC SIGNAL [code: CHAR] ~ CODE;
controlChars: LIST OF CHAR LIST [Ascii.CR, Ascii.TAB];
These are the only control codes known by TEditFormat.
MakeMap: PUBLIC PROC [entriesList: PartialMaps, default: Map cs0Map] RETURNS [map: Map] ~ {
Create a Map from a list of overlaid PartialMap. Last entry specifying a character wins. Unassigned characters use the default mapping. The map is added to the table.
map NEW [MapRep];
FOR c: CHAR IN CHAR DO map[c] default[c] ENDLOOP;
FOR lists: PartialMaps entriesList, lists.rest UNTIL lists=NIL DO
FOR entries: PartialMap lists.first, entries.rest UNTIL entries=NIL DO
entry: XC = entries.first;
FOR lc: LIST OF CHAR controlChars, lc.rest UNTIL lc=NIL DO
IF entry.c=lc.first THEN SIGNAL ControlCharacterBug[entry.c];
ENDLOOP;
map[entry.c] Char.Make[set: ORD[entry.set], code: entry.code];
ENDLOOP;
ENDLOOP;
};
AddMap: PUBLIC PROC [family: Rope.ROPE, entriesList: PartialMaps, default: Map cs0Map] ~ {
Create a Map from a list of overlaid PartialMap. Last entry specifying a character wins. Unassigned characters use the default mapping. The map is added to the table.
map: Map MakeMap[entriesList, default];
[] SymTab.Store[maps, family, map];
};
InitMaps: PROC [] RETURNS [] ~ {
Create all the maps that go from Tioga fonts to XC1-2-2 codes
maps SymTab.Create[case: FALSE];
FOR c: CHAR IN CHAR DO cs0Map[c] Char.Make[set: 0, code: ORD[c]] ENDLOOP;
FOR c: CHAR IN CHAR DO starsMap[c] Char.Make[set: 0, code: ORD['*]] ENDLOOP;
FOR lc: LIST OF CHAR controlChars, lc.rest UNTIL lc=NIL DO -- Aargh !!!
starsMap[lc.first] Char.Make[set: 0, code: ORD[lc.first]];
ENDLOOP;
AddMap["AMTeX", LIST[amTeX]];
AddMap["APL", LIST[apl]];
AddMap["Arrows", NIL]; -- No possible mapping
AddMap["Asterisk", NIL, starsMap]; -- Funny case...
AddMap["Chess", NIL]; -- No possible mapping
AddMap["Classic", LIST[asciiExceptions]];
AddMap["Cream", LIST[asciiExceptions, cream]];
AddMap["Cyrillic", LIST[cyrillic]];
AddMap["EightBitTimesRoman", LIST[asciiExceptions, hyphens, eightBitExtras]];
AddMap["Gacha", LIST[asciiExceptions, gacha]];
AddMap["Hebrew", LIST[hebrew]];
AddMap["Helvetica", LIST[hyphens, helvetica]];
AddMap["Hippo", LIST[asciiExceptions, hyphens, hippo]];
AddMap["Logo", NIL]; -- TBD
AddMap["Math", LIST[math]];
AddMap["OldEnglish", LIST[asciiExceptions, hyphens, oldEnglish]];
AddMap["ReverseGacha", LIST[asciiExceptions, gacha]];
AddMap["Sail", LIST[asciiExceptions, sail]];
AddMap["Template", NIL]; -- No possible mapping
AddMap["TimesRoman", LIST[hyphens, helvetica]];
AddMap["Tioga", LIST[asciiExceptions, tiogaExtras]];
AddMap["VoicePlay", NIL]; -- No possible mapping
AddMap["VoiceProfile", NIL]; -- No possible mapping
AddMap["XeroxLogotypes", NIL]; -- TBD
};
Utilities
ClipAfter: PROC [r: Rope.ROPE, clip: Rope.ROPE] RETURNS [after: Rope.ROPE] ~ {
Remove from r everything up to the last occurence of a char from clip
clipPos: INT;
len: INT = Rope.Length[r];
FOR pos: INT -1, Rope.SkipTo[r, clipPos, clip] UNTIL pos=len DO
clipPos pos+1;
ENDLOOP;
after Rope.Substr[r, clipPos];
};
IsSuffix: PROC [r: Rope.ROPE, suffix: Rope.ROPE, case: BOOL TRUE] RETURNS [BOOL] ~ {
Returns TRUE iff suffix matches the end of r
pos: INT = Rope.FindBackward[r, suffix, 0, case];
IF pos<0 THEN RETURN [FALSE];
RETURN [pos+Rope.Length[suffix]=Rope.Length[r]];
};
StripSuffix: PROC [r: Rope.ROPE, suffix: Rope.ROPE] RETURNS [prefix: Rope.ROPE] ~ {
prefix Rope.Substr[r, 0, Rope.Length[r]-Rope.Length[suffix]];
};
StripScale: PROC [r: Rope.ROPE, suffix: Rope.ROPE] RETURNS [prefix: Rope.ROPE] ~ {
prefixLen: INT Rope.Length[r]-Rope.Length[suffix];
FOR i: INT DECREASING IN [0 .. prefixLen) DO
IF Rope.Fetch[prefix, i] IN ['0 .. '9] THEN prefixLen i ELSE EXIT;
ENDLOOP;
prefix Rope.Substr[r, 0, prefixLen];
};
InitMaps[];
END.