mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
The FontString methods 4.3.4 has that 1.12 lacked. SetWordWrap is 1.12's own SetNonSpaceWrap on 4.3.4's style bit 0x40 (set when the text does not wrap). 1.12's text engine already honours the bit: TextBlockCreate turns it into text flag 0x2, and the layout and line count stop after one line on it. A change lays the string out again as SetText does, shared with SetMaxLines as FontString::Layout::Invalidate; a rebuild alone left a text-sized string at its old height, so the fit cut at a whole word with no ellipsis. GetFieldSize returns what 1.12 holds rather than 4.3.4's constant 8191: n - 1 bytes for a string with XML bytes="n" (SetText's SStrCopy keeps one for the terminator), and infinity for a string with no fixed size, whose buffer grows to any length.
27 lines
1.2 KiB
C++
27 lines
1.2 KiB
C++
// This file is part of ClassicAPI.
|
|
//
|
|
// ClassicAPI is free software: you can redistribute it and/or modify it under the terms
|
|
// of the GNU General Public License as published by the Free Software Foundation, either
|
|
// version 3 of the License, or (at your option) any later version.
|
|
//
|
|
// ClassicAPI is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
// PURPOSE. See the GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License along with
|
|
// ClassicAPI. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#pragma once
|
|
|
|
namespace FontString::Layout {
|
|
|
|
// Lay a font string out again exactly as SetText (FUN_00771D80) does after a
|
|
// content change, so a layout-affecting property (max lines, word wrap) takes
|
|
// effect on the next draw: drop the cached measures, release the built text,
|
|
// clear the layout-dirty bit and resize the region. A string sized by its
|
|
// text gets its new height this way; a rebuild alone keeps the old one.
|
|
// Re-calling SetText would NOT work - it returns early on unchanged text.
|
|
void Invalidate(void *fontString);
|
|
|
|
} // namespace FontString::Layout
|