Repository navigation
CPUI 0.1.1
Faster long trees, selects and text inputs, input method text for editors that draw their own text, platform font sizes, and fixes.
Added
FontSystem::revision, which changes whenever the fonts change, for caches of measurements.- Canvases take text with
Canvas::ime: typing, pasting and input methods such as Pinyin, read withUi::ime_onand drawn withPainter::ime.Painter::ime_caretplaces the candidate window, so an editor that draws its own text needs no hidden text input.
Changed
- Trees build and draw only the rows near their visible part, so a tree of 100,000 items takes about 3 ms a frame instead of 690 ms.
- Open selects and comboboxes build only the options near view, and a select or combobox without a width measures its options only when they change, so a thousand options no longer cost several milliseconds a frame.
- Multiline inputs keep their wrapped lines between frames and wrap again only the paragraphs an edit changes, so a text of 100,000 lines takes about 1 ms a frame instead of 65 ms, and about 1.5 ms per keystroke instead of 200 ms.
- Frames that lay out more than about 500 lines of text, such as a long tree or an open select with many options, keep their shaped text between frames instead of shaping it again every frame.
- A field with an error frames its control in the danger color, border and focus ring, as well as showing the message: text inputs, selects, comboboxes and pickers.
Field::error_frame(false)keeps only the message. - Switches, checkboxes and radios respond to the pointer: their edge or track deepens on hover, and a held switch stretches its knob.
- An empty state sets its icon in a tile and its title in a larger, medium weight, with more room before its actions.
- The default font sizes follow the platform: 13, 11, 17 and 22 on macOS, as in its own interface, and 14, 12, 18 and 24 elsewhere as before. Control and row heights are unchanged.
with_font_sizesets one size on every platform. Theme::with_font_sizerounds the note, heading and title sizes to whole pixels, and keeps control and row heights for text smaller than 14 px instead of shrinking them. An application that sets text below 14 px gets the default control heights; setcontrol_heightandrow_heightto keep smaller ones.
Fixed
- A multiline input no longer wraps its text one character per line in its first frame, which took time and kept memory for every character.
- Screen readers announce tree items at their real level; each item was reported one level deeper.
- Text in tinted badges and alerts meets the 4.5:1 contrast of WCAG AA in every tone; success and warning text was below 3:1 in the light theme.
- Without fontconfig, as on Windows and Android, a font set by name uses its family's regular face. A family with one file per weight, such as MiSans, loaded its bold file, or its medium one when its weights are numbered unusually, so regular text rendered heavier.