# UFX Alternate Characters Extension DRAFT This document proposes a backward-compatible extension to the ufx font format, to encode alternate characters inside a font as well as encode information regarding the character IDs they replace. ## Rationale In addition to extensive character sets, professional typeface families come with a variety of technical features that help typographers fine-tune the quality of their work. The goal of this extension is to enable ufx fonts to encode some of those same features, to help improve the quality of typography on uxn environments. This extension encodes information entirely in the C1 controls area, which is otherwise left completely blank. Uxn font renderers that don't understand the extension can continue to render text normally. ## Encoding Format All encoded information starts in the byte address of character U+00A0. First byte determines amount of stylistic sets. A stylistic set consists of the following: - Byte that determines length of the following list - List of: - Byte that determines which char ID to replace - Byte that determines which char ID the alternate is coded in Stylistic sets can have length 0 to skip set numbers. The following stylistic sets are reserved for specific features: 0 - Case-sensitive Forms The only reason stylistic sets should be reserved is if they can be simply automated by the typesetting program. As such, there are not many sets that can. Most are better left to be switched on by the user. ## Challenges The encoding limits of the extension depend heavily on the ufx size, especially the mapping data. The limits are likely calculable to some extent, but it's pretty variable (balancing between amount of characters to encode and how the stylistic sets are mapped out). Since the encoding data is length-delimited, practically this shouldn't pose a significant issue especially for the renderers. Of course, to even take advantage of this, the text renderer has to know to look for that data. Ideally, if the font doesn't support the extension, the C1 controls are left completely blank, leading the renderer to read the stylistic set count as zero. If such an assumption is not desired, an alternative solution may be proposed (like setting char 00A0 width to an abnormal value such as 255, which might pose problems). Once the details are more certain, Slight will update its text renderer to support this extension, and design an additional interface for configuring the alternates. When editing a font in Slight the user can toggle support for the extension on or off; if disabled, all characters are edited like normal. Technically, a simpler way would be to throw all the alternates in a separate font. However, this is highly inefficient if all one desires is a few new characters.