1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

LibGfx: Make BitmapFont::variant() report a complete typeface

This commit is contained in:
thankyouverycool 2021-09-23 19:43:55 -04:00 committed by Andreas Kling
parent 39484fc02c
commit 84ce923850
2 changed files with 16 additions and 1 deletions

View file

@ -10,6 +10,7 @@
#include <AK/Utf8View.h>
#include <LibCore/FileStream.h>
#include <LibGfx/FontDatabase.h>
#include <LibGfx/FontStyleMapping.h>
namespace Gfx {
@ -348,6 +349,20 @@ String BitmapFont::qualified_name() const
return String::formatted("{} {} {}", family(), presentation_size(), weight());
}
String BitmapFont::variant() const
{
StringBuilder builder;
builder.append(weight_to_name(weight()));
if (slope()) {
if (builder.string_view() == "Regular"sv)
builder.clear();
else
builder.append(" ");
builder.append(slope_to_name(slope()));
}
return builder.to_string();
}
Font const& Font::bold_variant() const
{
if (m_bold_variant)