Chat Interface Revision (#3840)
Co-authored-by: Anders Jenbo <anders@jenbo.dk>
This commit is contained in:
parent
6de6825ce0
commit
a08026097a
8 changed files with 105 additions and 118 deletions
|
|
@ -283,18 +283,10 @@ bool ContainsSmallFontTallCodepoints(string_view text)
|
|||
return false;
|
||||
}
|
||||
|
||||
int GetLineHeight(string_view text, unsigned fontIndex)
|
||||
{
|
||||
if (fontIndex == 0 && IsSmallFontTall() && ContainsSmallFontTallCodepoints(text)) {
|
||||
return SmallFontTallLineHeight;
|
||||
}
|
||||
return LineHeights[fontIndex];
|
||||
}
|
||||
|
||||
int GetLineHeight(string_view fmt, DrawStringFormatArg *args, std::size_t argsLen, unsigned fontIndex)
|
||||
int GetLineHeight(string_view fmt, DrawStringFormatArg *args, std::size_t argsLen, GameFontTables fontIndex)
|
||||
{
|
||||
constexpr std::array<int, 6> LineHeights = { 12, 26, 38, 42, 50, 22 };
|
||||
if (fontIndex == 0 && IsSmallFontTall()) {
|
||||
if (fontIndex == GameFont12 && IsSmallFontTall()) {
|
||||
char32_t prev = U'\0';
|
||||
char32_t next;
|
||||
FmtArgParser fmtArgParser { fmt, args, argsLen };
|
||||
|
|
@ -307,7 +299,7 @@ int GetLineHeight(string_view fmt, DrawStringFormatArg *args, std::size_t argsLe
|
|||
const std::optional<std::size_t> fmtArgPos = fmtArgParser(rest);
|
||||
if (fmtArgPos) {
|
||||
if (ContainsSmallFontTallCodepoints(args[*fmtArgPos].GetFormatted()))
|
||||
return true;
|
||||
return SmallFontTallLineHeight;
|
||||
prev = U'\0';
|
||||
continue;
|
||||
}
|
||||
|
|
@ -484,6 +476,14 @@ int GetLineWidth(string_view fmt, DrawStringFormatArg *args, std::size_t argsLen
|
|||
return lineWidth != 0 ? (lineWidth - spacing) : 0;
|
||||
}
|
||||
|
||||
int GetLineHeight(string_view text, GameFontTables fontIndex)
|
||||
{
|
||||
if (fontIndex == GameFont12 && IsSmallFontTall() && ContainsSmallFontTallCodepoints(text)) {
|
||||
return SmallFontTallLineHeight;
|
||||
}
|
||||
return LineHeights[fontIndex];
|
||||
}
|
||||
|
||||
int AdjustSpacingToFitHorizontally(int &lineWidth, int maxSpacing, int charactersInLine, int availableWidth)
|
||||
{
|
||||
if (lineWidth <= availableWidth || charactersInLine < 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue