add furigana support to config names

This commit is contained in:
DeaTh-G 2025-01-25 17:31:56 +01:00
parent 3460d887d1
commit 2ba725708d
2 changed files with 34 additions and 6 deletions

View file

@ -669,7 +669,7 @@ static void DrawContainer(ImVec2 min, ImVec2 max, bool isTextArea)
} }
// The draw area // The draw area
drawList->PushClipRect({ min.x - Scale(8.0f) + gridSize * 2.0f - Scale(28.0f) * 0.55f, min.y + gridSize * 2.0f - Scale(28.0f) * 0.55f}, {max.x + Scale(8.0f) - gridSize * 2.0f + 1.0f, max.y - gridSize * 2.0f + 1.0f}); drawList->PushClipRect({ min.x - Scale(8.0f) + gridSize * 2.0f - Scale(28.0f) * 0.55f, min.y + gridSize * 2.0f - Scale(28.0f) * 0.55f }, { max.x + Scale(8.0f) - gridSize * 2.0f + 1.0f, max.y - gridSize * 2.0f + 1.0f });
} }
static void DrawDescriptionContainer() static void DrawDescriptionContainer()

View file

@ -724,6 +724,11 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
auto alpha = fadedOut ? 0.5f : 1.0f; auto alpha = fadedOut ? 0.5f : 1.0f;
auto textColour = IM_COL32(255, 255, 255, 255 * alpha); auto textColour = IM_COL32(255, 255, 255, 255 * alpha);
if (Config::Language == ELanguage::Japanese)
{
textPos.y += Scale(10.0f);
}
if (g_selectedItem == config) if (g_selectedItem == config)
{ {
float prevItemOffset = (g_prevSelectedRowIndex - g_selectedRowIndex) * (optionHeight + optionPadding); float prevItemOffset = (g_prevSelectedRowIndex - g_selectedRowIndex) * (optionHeight + optionPadding);
@ -746,7 +751,23 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
} }
else else
{ {
drawList->AddText(g_seuratFont, size, textPos, textColour, configName.c_str(), 0, 0.0f, &textClipRect); DrawRubyAnnotatedText
(
g_seuratFont,
size,
textClipRect.z - textClipRect.x,
textPos,
0.0f,
configName.c_str(),
[=](const char* str, ImVec2 pos)
{
DrawTextBasic(g_seuratFont, size, pos, textColour, str);
},
[=](const char* str, float annotationSize, ImVec2 pos)
{
DrawTextBasic(g_seuratFont, annotationSize, pos, textColour, str);
}
);
} }
// Right side // Right side
@ -1233,12 +1254,19 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax)
auto fontSize = Scale(26.0f); auto fontSize = Scale(26.0f);
DrawRubyAnnotatedText( float offsetY = 0.0f;
if (Config::Language == ELanguage::Japanese)
{
offsetY = Scale(10.0f);
}
DrawRubyAnnotatedText
(
g_seuratFont, g_seuratFont,
fontSize, fontSize,
clipRectMax.x - clipRectMin.y, clipRectMax.x - clipRectMin.x,
{ clipRectMin.x, thumbnailMax.y + fontSize - 5.0f }, { clipRectMin.x, thumbnailMax.y + fontSize - 5.0f + offsetY },
0.0f, 5.0f,
desc.c_str(), desc.c_str(),
[=](const char* str, ImVec2 pos) [=](const char* str, ImVec2 pos)