mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 21:01:37 +00:00
fix installer wizard text positioning when a line starts with a normal kana in japanese
This commit is contained in:
parent
369320b939
commit
5cbed2fe22
4 changed files with 21 additions and 13 deletions
|
|
@ -670,7 +670,7 @@ ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float maxWidt
|
||||||
return MeasureCentredParagraph(font, fontSize, lineMargin, lines);
|
return MeasureCentredParagraph(font, fontSize, lineMargin, lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawRubyAnnotatedText(const ImFont* font, float fontSize, float maxWidth, const ImVec2& pos, float lineMargin, const char* text, std::function<void(const char*, ImVec2)> drawMethod, std::function<void(const char*, float, ImVec2)> annotationDrawMethod, bool isCentred)
|
void DrawRubyAnnotatedText(const ImFont* font, float fontSize, float maxWidth, const ImVec2& pos, float lineMargin, const char* text, std::function<void(const char*, ImVec2)> drawMethod, std::function<void(const char*, float, ImVec2)> annotationDrawMethod, bool isCentred, bool leadingSpace)
|
||||||
{
|
{
|
||||||
auto annotationFontSize = fontSize * ANNOTATION_FONT_SIZE_MODIFIER;
|
auto annotationFontSize = fontSize * ANNOTATION_FONT_SIZE_MODIFIER;
|
||||||
|
|
||||||
|
|
@ -678,7 +678,13 @@ void DrawRubyAnnotatedText(const ImFont* font, float fontSize, float maxWidth, c
|
||||||
auto lines = Split(input.first.c_str(), font, fontSize, maxWidth);
|
auto lines = Split(input.first.c_str(), font, fontSize, maxWidth);
|
||||||
|
|
||||||
for (auto& line : lines)
|
for (auto& line : lines)
|
||||||
|
{
|
||||||
line = ReAddRubyAnnotations(line, input.second);
|
line = ReAddRubyAnnotations(line, input.second);
|
||||||
|
if (!line.empty() && line.substr(0, 3) != "「" && leadingSpace)
|
||||||
|
{
|
||||||
|
line = " " + line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto paragraphSize = MeasureCentredParagraph(font, fontSize, lineMargin, lines);
|
auto paragraphSize = MeasureCentredParagraph(font, fontSize, lineMargin, lines);
|
||||||
auto offsetY = 0.0f;
|
auto offsetY = 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ std::vector<std::string> RemoveAnnotationFromParagraph(const std::vector<std::st
|
||||||
std::string RemoveAnnotationFromParagraphLine(const std::vector<TextSegment>& annotatedLine);
|
std::string RemoveAnnotationFromParagraphLine(const std::vector<TextSegment>& annotatedLine);
|
||||||
ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float lineMargin, const std::vector<std::string>& lines);
|
ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float lineMargin, const std::vector<std::string>& lines);
|
||||||
ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float maxWidth, float lineMargin, const char* text);
|
ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float maxWidth, float lineMargin, const char* text);
|
||||||
void DrawRubyAnnotatedText(const ImFont* font, float fontSize, float maxWidth, const ImVec2& pos, float lineMargin, const char* text, std::function<void(const char*, ImVec2)> drawMethod, std::function<void(const char*, float, ImVec2)> annotationDrawMethod, bool isCentred = false);
|
void DrawRubyAnnotatedText(const ImFont* font, float fontSize, float maxWidth, const ImVec2& pos, float lineMargin, const char* text, std::function<void(const char*, ImVec2)> drawMethod, std::function<void(const char*, float, ImVec2)> annotationDrawMethod, bool isCentred = false, bool leadingSpace = false);
|
||||||
float Lerp(float a, float b, float t);
|
float Lerp(float a, float b, float t);
|
||||||
float Cubic(float a, float b, float t);
|
float Cubic(float a, float b, float t);
|
||||||
float Hermite(float a, float b, float t);
|
float Hermite(float a, float b, float t);
|
||||||
|
|
|
||||||
|
|
@ -800,7 +800,9 @@ static void DrawDescriptionContainer()
|
||||||
[=](const char* str, float size, ImVec2 pos)
|
[=](const char* str, float size, ImVec2 pos)
|
||||||
{
|
{
|
||||||
DrawTextBasic(g_seuratFont, size, pos, IM_COL32(255, 255, 255, 255 * textAlpha), str);
|
DrawTextBasic(g_seuratFont, size, pos, IM_COL32(255, 255, 255, 255 * textAlpha), str);
|
||||||
}
|
},
|
||||||
|
false,
|
||||||
|
Config::Language == ELanguage::Japanese
|
||||||
);
|
);
|
||||||
|
|
||||||
drawList->PopClipRect();
|
drawList->PopClipRect();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue