diff --git a/UnleashedRecomp/ui/imgui_utils.cpp b/UnleashedRecomp/ui/imgui_utils.cpp index ef5163bf..9f7e2766 100644 --- a/UnleashedRecomp/ui/imgui_utils.cpp +++ b/UnleashedRecomp/ui/imgui_utils.cpp @@ -624,7 +624,7 @@ ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float lineMar x = std::max(x, textSize.x); y += textSize.y + Scale(lineMargin); - if (paragraph.annotated) + if (paragraph.annotated && i != (annotationRemovedLines.size() - 1)) y += fontSize * ANNOTATION_FONT_SIZE_MODIFIER; } @@ -633,7 +633,13 @@ ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float lineMar ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float maxWidth, float lineMargin, const char* text) { - return MeasureCentredParagraph(font, fontSize, lineMargin, Split(text, font, fontSize, maxWidth)); + const auto input = RemoveRubyAnnotations(text); + auto lines = Split(input.first.c_str(), font, fontSize, maxWidth); + + for (auto& line : lines) + line = ReAddRubyAnnotations(line, input.second); + + 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 drawMethod, std::function annotationDrawMethod, bool isCentred) diff --git a/UnleashedRecomp/ui/message_window.cpp b/UnleashedRecomp/ui/message_window.cpp index 8e562c77..fe05b8b3 100644 --- a/UnleashedRecomp/ui/message_window.cpp +++ b/UnleashedRecomp/ui/message_window.cpp @@ -292,9 +292,9 @@ void MessageWindow::Draw() if (Config::Language == ELanguage::Japanese) { textMarginX -= Scale(2.5f); - textMarginY -= Scale(7.5f); + textMarginY -= Scale(2.0f); - textY += Scale(lines.size() % 2 == 0 ? 8.5f : 15.5f); + textY += Scale(lines.size() % 2 == 0 ? 1.5f : 8.0f); } bool isController = hid::IsInputDeviceController(); diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index 22860ad2..2373833c 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -1373,7 +1373,11 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax) desc = buf; } - desc += "\n\n" + g_selectedItem->GetValueDescription(Config::Language); + const auto& valueDescription = g_selectedItem->GetValueDescription(Config::Language); + if (!valueDescription.empty()) + { + desc += "\n\n" + valueDescription; + } } clipRectMin = { clipRectMin.x, thumbnailMax.y }; @@ -1388,7 +1392,6 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax) auto textX = clipRectMin.x - Scale(0.5f); auto textY = thumbnailMax.y + offsetY; - auto textSize = MeasureCentredParagraph(g_seuratFont, fontSize, clipRectMax.x - clipRectMin.x, 5.0f, desc.c_str()); if (Config::Language == ELanguage::Japanese) { @@ -1405,6 +1408,8 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax) textY += annotationFontSize; } + auto textSize = MeasureCentredParagraph(g_seuratFont, fontSize, clipRectMax.x - clipRectMin.x, 5.0f, desc.c_str()); + drawList->PushClipRect(clipRectMin, clipRectMax, false); static auto isScrolling = false;