|
23 | 23 | */ |
24 | 24 |
|
25 | 25 |
|
26 | | -import ParseMethods from '../ParseMethods.js'; |
27 | 26 | import {CharacterMap, CommandMap} from '../SymbolMap.js'; |
| 27 | +import {Symbol} from '../Symbol.js'; |
28 | 28 | import {TexConstant} from '../TexConstants.js'; |
29 | 29 | import {TextMacrosMethods} from '../textmacros/TextMacrosMethods.js'; |
| 30 | +import TexParser from '../TexParser.js'; |
30 | 31 |
|
31 | 32 |
|
32 | 33 | /** |
@@ -160,25 +161,37 @@ new CommandMap('textcomp-macros', { |
160 | 161 | }, TextMacrosMethods); |
161 | 162 |
|
162 | 163 |
|
| 164 | +/** |
| 165 | + * Handle old style characters. |
| 166 | + * @param {TexParser} parser The current tex parser. |
| 167 | + * @param {Symbol} mchar The parsed symbol. |
| 168 | + */ |
| 169 | +function mathchar0miOldstyle(parser: TexParser, mchar: Symbol) { |
| 170 | + const def = mchar.attributes || {}; |
| 171 | + def.mathvariant = TexConstant.Variant.OLDSTYLE; |
| 172 | + const node = parser.create('token', 'mi', def, mchar.char); |
| 173 | + parser.Push(node); |
| 174 | +} |
| 175 | + |
163 | 176 | /** |
164 | 177 | * Identifiers from the Textcomp package. |
165 | 178 | */ |
166 | | -new CharacterMap('textcomp-oldstyle', ParseMethods.mathchar0mi, { |
| 179 | +new CharacterMap('textcomp-oldstyle', mathchar0miOldstyle, { |
167 | 180 |
|
168 | 181 | // This is not the correct glyph |
169 | | - 'textcentoldstyle': ['\u00A2', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
| 182 | + 'textcentoldstyle': '\u00A2', |
170 | 183 | // This is not the correct glyph |
171 | | - 'textdollaroldstyle': ['\u0024', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
| 184 | + 'textdollaroldstyle': '\u0024', |
172 | 185 |
|
173 | 186 | // Table 16: textcomp Old-Style Numerals |
174 | | - 'textzerooldstyle': ['0', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
175 | | - 'textoneoldstyle': ['1', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
176 | | - 'texttwooldstyle': ['2', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
177 | | - 'textthreeoldstyle': ['3', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
178 | | - 'textfouroldstyle': ['4', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
179 | | - 'textfiveoldstyle': ['5', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
180 | | - 'textsixoldstyle': ['6', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
181 | | - 'textsevenoldstyle': ['7', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
182 | | - 'texteightoldstyle': ['8', {mathvariant: TexConstant.Variant.OLDSTYLE}], |
183 | | - 'textnineoldstyle': ['9', {mathvariant: TexConstant.Variant.OLDSTYLE}] |
| 187 | + 'textzerooldstyle': '0', |
| 188 | + 'textoneoldstyle': '1', |
| 189 | + 'texttwooldstyle': '2', |
| 190 | + 'textthreeoldstyle': '3', |
| 191 | + 'textfouroldstyle': '4', |
| 192 | + 'textfiveoldstyle': '5', |
| 193 | + 'textsixoldstyle': '6', |
| 194 | + 'textsevenoldstyle': '7', |
| 195 | + 'texteightoldstyle': '8', |
| 196 | + 'textnineoldstyle': '9' |
184 | 197 | }); |
0 commit comments