Files
HellionChat/HellionChat/Ui/StyleEngine/Widgets/ChannelHeaderDetail.cs
T
JonKazama-Hellion dfc0cda806 fix(chat): four things the header review found, all of them visible
The self-test was the worst of them, because it is the only tool that makes block
A judgeable at all and it destroyed itself on use. It returned Fail while the
atlas was not ready, and its own weight buttons trigger a rebuild -- which is
asynchronous, not synchronous as the comment claimed. Click a weight, watch the
step go red. It waits now, like the two existing steps that had already worked
this out.

The translated stand-in was drawn in the meta face, whose glyph range is ASCII
plus a middle dot. Fifteen of the twenty-five translations reach outside that, so
"not logged in" would have rendered as a row of question marks in Japanese,
Russian, Korean, Greek and eleven others -- and the measured width would have
been the width of the question marks, so the right edge would have drifted too.
The plan said to keep it on the body face and the comment in FontManager says so
as well; the code simply did not. The detail is two parts now rather than one
string, and each part is measured under the face that draws it.

The header was the only place in the UI pushing RegularFont directly, without the
FontsEnabled-or-UseHellionFont check every other push site makes. With both
toggles off the window draws in AXIS and the header would have drawn in
Inter-Light, at a different size, in a band measured against a third one.

And the icon sat on the text baseline. FontAwesome is a fixed-width handle built
at Dalamud's own size and does not follow the plugin's font setting, so at any
other body size it hangs. The sidebar already knew this and centres against the
row; the header does the same now.

Two smaller ones came along: the minimum-height threshold was compared unscaled,
which would have dissolved it at higher display scales, and the height passed
into that check included the input row -- so "is there still room to read" was
measuring the wrong thing. Both callers now say what sits below them.
2026-08-19 10:21:03 +02:00

45 lines
1.7 KiB
C#

using System.Globalization;
namespace HellionChat.Ui.StyleEngine.Widgets;
// Where you are and what time it is, as two parts rather than one string.
//
// They are split because they cannot share a face. The clock and a world name are
// Latin in every client, which is why the meta face gets away with a glyph range
// of ASCII plus a middle dot. The stand-in for "no world known" is translated
// into 25 languages, and fifteen of those reach outside that range -- drawn in the
// meta face they would come out as rows of question marks. So the caller draws
// WhereIsTranslated text in the body face and the rest in the meta face.
//
// The clock follows the same Use24HourClock setting the message timestamps do.
// Two clock formats in one window, with the header sitting directly above a
// column of timestamps, would be a defect rather than a preference. Culture is
// pinned for the same reason it is pinned in the message list: a German machine
// renders "PM" as "nachm." under its own culture.
internal readonly record struct ChannelHeaderDetailParts(
string Where,
string Clock,
bool WhereIsTranslated
)
{
internal const string Separator = " · ";
}
internal static class ChannelHeaderDetail
{
internal static ChannelHeaderDetailParts Format(
string? world,
DateTimeOffset now,
bool use24Hour,
string fallback
)
{
var missing = string.IsNullOrWhiteSpace(world);
var clock = use24Hour
? now.ToString("HH:mm", CultureInfo.InvariantCulture)
: now.ToString("h:mm tt", CultureInfo.InvariantCulture);
return new ChannelHeaderDetailParts(missing ? fallback : world!, clock, missing);
}
}