FontsRus

Summary
FontsRus (stylized as Fonts 'Я' Us) is an app that comes pre-installed on more recent InternalUI builds. It was first publicly spotted on the iOS 13.0 InternalUI build. FontsRus allows you to test different aspects of the text systems and fonts Apple ships with iOS. It provides access to all fonts bundled, downloadable fonts, and invisible fonts in the system. The app has four view modes: Fonts, Displays, Samples, and Test. These are selectable from the tab bar at the bottom of the application.

Fonts
The app allows you to select 2 fonts to compare. In the fonts list, you can pick a primary font and a secondary font. The font selection is broken into different categories to help narrow down the search and help Apple test the font APIs.


 * Postscript: Fonts are sorted by postscript name
 * Family: Fonts are sorted by daily name
 * UI Fonts: Primary fonts used by the UI listed by weight
 * Invisible: These are fonts that are not normally seen in the UI processes but are used internally by the OS. NOTE: building this list is a bit more expensive so there might be a lag. We need to work on making this faster at the GSFont and CoreText levels.
 * Text Styles: Will provide you with a font that a developer would use if they call one of the many UIKit Text Styles
 * Downloadables: Will provide you with a list of fonts that are available for download on the server. Note, it may take some time to produce the list the first time you select this. Items in red will indicate that the font has not been downloaded. If you wish to download the font, click the Info button, then proceed to Download the font in the Info pane once it appears.
 * Bundled: These are fonts that are bundles with the application. The purpose is to mimmic and test the registration APIs. Items in red mean fonts that have not been registered. (i.e. usable by the OS). To register a font, click on the Info button, then proceed to Register the font in the Info pane once it appears.
 * Unregistered: Advanced feature used by the Type team to test fonts on the fly. This is not recommended for general use.

Displays
This is used to test the different mechanisms used by the OS to display text. You can test Labels (UILabel and CTLines), TextViews, CoreText Frames, Repertoire, and WebViews. Each of these views allow you to flip quickly between your primary and secondary font. Just swipe right or left to do so. Note that in some views the swipe action may be consumed by the scrollview. We need to fix this. Generally swiping near the top of the view where the font name is displayed works well. You can also switch between different family weights by swiping up and down. Again the swipe action may be consumed by other views. There are preferences that apply to each view. You can view these by clicking on the slide icon on the top left.


 * Labels: tests fonts in UILabel and CTLine. By default, fallbacks are not enabled so if a font does not support a character, you will see LastResort. Additionally, you can set the preferred language for fallbacks. This is useful to see how text will display under different localizations. You need to enter an ISO language code: e.g. ja, zh-Hans, ko, ar, etc.
 * TextView: tests UITextViews. Note that this is the one view where you can customize the text you wish to display. All other text is fed by text you select from the Samples tab.
 * CoreText: test CTFrames
 * Repertoire: informational pane to display all glyphs in a font. You are able to select individual glyphs and obtain information about them. You may also mark glyphs with different colors for testing purposes. See Glyph Marking below.
 * WebView: tests fonts in a WebView. Note, if displaying an html, then font selection has no effect on what is being displayed This can be overridden by the option to test the said html using the font selected.

Display Preferences
These are settings you can apply to each of the different styles of displays.


 * Align UI Label Right: when ON it will align the text in the UILabel view to the right.
 * Allow Fallbacks: if ON, text will fallback according to the font fallback mechanism in CoreText. If OFF, you will see Last Resorts glyphs whenever the font cannot handle a particular character. This is useful tool to determine when a font is missing character coverage.
 * Classic System Font APIs: when ON, FontsRus will use the classic system font APIs to create system fonts: systemFontOfSize: boldSystemFontOfSize: etc. Otherwise, weights for System Fonts will be created using the systemFontOfSize:weight: API.
 * Alternate Font as Fallback: when ON, it will inject the primary or secondary font (depending on which font you are currently viewing) into the CoreText fallback list. This is useful when trying to figure out if a particular weight of a font family or a completely different font works better as a fallback (typically to UIFonts).
 * Show Glyph Positions: shows vertical lines in the CTLine indicating each glyph position. Basically the advances.
 * Show Line Metrics: shows 3 lines indicating the ascend, descend, and baseline.
 * Show Line Bounds: draws a box around the CTLine based on the typographic line metrics, CTLineGetBoundsWithOptions(lineRef, 0)
 * Show GlyphPath Bounds: will draw a box around the CTLine indicating the path bounds for all glyphs in the string. CTLineGetBoundsWithOptions(lineRef, kCTLineBoundsUseGlyphPathBounds)
 * Show Optical Bounds: draw a box around the CTLine based on CTLineGetBoundsWithOptions(lineRef, kCTLineBoundsUseOpticalBounds)
 * Show Language Extents: draws a box around the CTLine indicating the outsets provided to UIKit to extend a label height. CTLineGetBoundsWithOptions(lineRef, kCTLineBoundsIncludeLanguageExtents)
 * Show Line Outsets: same as Show Language extents but we compute the size of the box using CTFontGetLanguageAwareOutsets. It also draws a frame around the UILabel so this is more comprehensive way to test for the outsets/language extents.
 * Log Frame Draws: times how long it takes to setup a CTFrame and draw it and sends the results to the Log.
 * Toggle Metrics: Displays different color lines for the ascender, base line, and ascender. (currently only implemented in Labels display)
 * Mapped Unicodes: replaces the text being viewed by all the unicode characters the font can map. Useful to see or print all the characters that are accessible for direct text entry.
 * Show Waterfall: displays a simple sample text in all the weights supported by the font family.
 * Vertical Text: enables the vertical flag in CoreText so that the text is displayed vertically. Useful to test CJK fonts that have the vertical feature.
 * Glyph Marking: Repertoire view only. When enabled, two buttons (labeled Red and Blue) appear at the bottom of the repertoire. Then you can click on any glyph on the repertoire and then mark it Red or Blue by clicking on the said buttons. Moreover, each time you mark one of the glyphs, it is logged into a file in the user's Documents folder/directory (the name of the file is logged whenever you enable glyph marking). This is useful for QA to mark many glyphs in a font for further examination, fixing, etc.
 * Set HTML in Font: If the sample being viewed is HTML, you can view the entire text of the HTLM source using the font you have selected for Primary or Secondary font. Otherwise, this option has no effect.
 * Print: TextView display only. Prints the text in the view.

Samples
Provides you with many canned sets of text to use in the different views provided by the Displays tab. Most samples are just plain strings in different languages. Some samples are HTML. The HTML samples may contain multi-styled text. Full HTLM sample viewing (that is, honoring the formatting) can only be seen in WebViews. TBD: Add RTF samples, and allow custom creation/storing of samples.

Tests
Canned list of tests you can run. Some of these tests are true Unit Tests in that they will return a pass of fail (work in progress). Other tests are informational only: they can act on the current font selection, or take an action based on the input that it is passed in the "Text Input" field. For example, you can do Unicode to Text conversions.