|
Operator SDK
Build MIDI processing and UI modes for the Operator device
|
Text-layout helpers for Operator modes (opt-in, header-only). More...
#include <cstddef>#include <cstdint>Namespaces | |
| namespace | op::sdk::text |
| Text measurement and layout helpers for mode UIs. | |
| namespace | op |
| Root namespace for the Operator SDK. | |
| namespace | op::sdk |
| Core SDK helpers for modes (timing, text, MIDI, and math). | |
Functions | |
| std::size_t | op::sdk::text::detail::fs_strlen (const char *s) noexcept |
| Freestanding inline strlen. | |
| void | op::sdk::text::detail::fs_write_u32 (uint32_t u, char *out, uint8_t out_size, uint8_t pos) |
| Shared core: write the decimal digits of an already-unsigned magnitude into out[pos..], NUL-terminating. | |
| void | op::sdk::text::format_uint (uint32_t v, char *out, uint8_t out_size) |
| Overwrite out with the decimal digits of v, NUL-terminated. | |
| void | op::sdk::text::format_int (int32_t v, char *out, uint8_t out_size, bool force_plus=false) |
| Overwrite out with the signed decimal of v, NUL-terminated. | |
| void | op::sdk::text::append_uint (char *buf, uint8_t buf_size, uint32_t v) |
| Append the decimal digits of v at the existing NUL of buf. | |
| void | op::sdk::text::append_int (char *buf, uint8_t buf_size, int32_t v, bool force_plus=false) |
| Append the signed decimal of v at the existing NUL of buf. | |
| void | op::sdk::text::format_str (const char *s, char *out, uint8_t out_size) |
| Overwrite out with a bounded copy of s (freestanding strlcpy). | |
| void | op::sdk::text::append_str (char *buf, uint8_t buf_size, const char *s) |
| Append a bounded copy of s at the existing NUL of buf (freestanding strcat). | |
| void | op::sdk::text::append_enum (char *buf, uint8_t buf_size, uint32_t idx, const char *const *labels, uint32_t count, const char *fallback="?") |
| Append labels[idx] at the existing NUL of buf, bounds-checked. | |
| void | op::sdk::text::append_fixed (char *buf, uint8_t buf_size, int32_t value, uint8_t decimals) |
| Append value as a fixed-point decimal with decimals fractional digits at the existing NUL of buf. | |
| uint16_t | op::sdk::text::strlen_chars (const char *s) |
| Count the characters in a NUL-terminated string. | |
| uint16_t | op::sdk::text::text_width (const char *s) |
| Pixel width of a string rendered in the standard 5x7 font. | |
| uint16_t | op::sdk::text::large_text_width (const char *s) |
| Pixel width of a string rendered in the large 8x12 font. | |
| uint16_t | op::sdk::text::align_center_x (const char *s, uint16_t total_w) |
| X-offset that horizontally centers a standard-font string inside a box. | |
| uint16_t | op::sdk::text::large_align_center_x (const char *s, uint16_t total_w) |
| X-offset that horizontally centers a large-font string inside a box. | |
| void | op::sdk::text::truncate_with_ellipsis (const char *s, uint16_t max_chars, char *out, uint16_t out_size) |
| Copy s into out, appending "..." when it exceeds max_chars. | |
| uint8_t | op::sdk::text::word_wrap (const char *s, uint16_t width_px, const char **line_starts, uint8_t max_lines) |
| Greedy word-wrap a NUL-terminated string into lines no wider than width_px pixels (standard font). | |
Variables | |
| constexpr uint8_t | op::sdk::text::kFontStdAdvance = 6 |
| Horizontal advance (pixels) of one standard-font glyph. | |
| constexpr uint8_t | op::sdk::text::kFontStdSpaceAdvance = 4 |
| Horizontal advance (pixels) of the standard-font space glyph. | |
| constexpr uint8_t | op::sdk::text::kFontStdHeight = 8 |
| Line height (pixels) of the standard font. | |
| constexpr uint8_t | op::sdk::text::kFontLargeAdvance = 8 |
| Horizontal advance (pixels) of one large-font glyph. | |
| constexpr uint8_t | op::sdk::text::kFontLargeSpaceAdvance = 6 |
| Horizontal advance (pixels) of the large-font space glyph. | |
| constexpr uint8_t | op::sdk::text::kFontLargeHeight = 13 |
| Line height (pixels) of the large font. | |
Text-layout helpers for Operator modes (opt-in, header-only).
Include on demand. This header is deliberately not pulled in by the umbrella operator_sdk.h.
All functions are pure (no ABI calls, no global state) and take only what is needed. Width math assumes the device's built-in fonts:
|
inlinenoexcept |
Freestanding inline strlen.
The SDK ABI target is -nostdlib on arm-none-eabi, so std::strlen (from libc) is not available. Hand-rolled here so every TU that includes text.h stays libc-free.
|
inline |
Shared core: write the decimal digits of an already-unsigned magnitude into out[pos..], NUL-terminating.
Returns nothing, bounded by out_size. A leading sign char (if any) must already be placed by the caller at pos.