mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
Backport three FontString methods, each working WITH the engine's own text-layout machinery instead of reconstructing it: - IsTruncated(): did the engine cut the text off with an ellipsis? Reads render truth -- the built text node keeps a copy of the string it actually laid out (node+0x48), the ellipsized form on truncation -- and compares it to the source. Same "displayed vs full" check retail does (5.4.8 inner fn 0x0045E001). Re-calling the display-text resolver from Lua cannot work: it reads the laid-out rect (fs+0x64), which is zero between frames, so it never sees the bound. - SetMaxLines(n)/GetMaxLines(): cap the fontstring to n wrapped lines, ellipsizing the rest. Writes the engine's own per-fontstring maxLines field (fs+0x128, already honored by the truncation resolver) and re-invalidates the layout the way SetText does (drop caches, release node, notify region). Vanilla has no SetWordWrap -- the fs->layout flag translator exposes no no-wrap bit -- so SetMaxLines(1) is how you make a single-line, ellipsized label. Also correct a mislabeled bit in the inline-texture notes: fs+0x120 bit 0x1000 (gxu/node bit 0x40) is NON-SPACE-WRAP (what SetNonSpaceWrap toggles), not a dedicated "editable" flag. The inline-texture code uses it as an editbox proxy, which works because multi-line editors enable non-space-wrap while display text does not; the comments now say so, with the rare-edge-case caveat. Documentation only, no logic change. Verified in-game: IsTruncated true/false across bounded/unbounded boxes; SetMaxLines caps of 1/2/9/0 with matching GetNumLines and IsTruncated.