mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 09:07:41 +00:00
LibGfx: Make BitmapFont::variant() report a complete typeface
This commit is contained in:
parent
39484fc02c
commit
84ce923850
2 changed files with 16 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <AK/Utf8View.h>
|
#include <AK/Utf8View.h>
|
||||||
#include <LibCore/FileStream.h>
|
#include <LibCore/FileStream.h>
|
||||||
#include <LibGfx/FontDatabase.h>
|
#include <LibGfx/FontDatabase.h>
|
||||||
|
#include <LibGfx/FontStyleMapping.h>
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
|
|
||||||
|
@ -348,6 +349,20 @@ String BitmapFont::qualified_name() const
|
||||||
return String::formatted("{} {} {}", family(), presentation_size(), weight());
|
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
|
Font const& Font::bold_variant() const
|
||||||
{
|
{
|
||||||
if (m_bold_variant)
|
if (m_bold_variant)
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
|
|
||||||
String family() const override { return m_family; }
|
String family() const override { return m_family; }
|
||||||
void set_family(String family) { m_family = move(family); }
|
void set_family(String family) { m_family = move(family); }
|
||||||
String variant() const override { return String::number(weight()); }
|
String variant() const override;
|
||||||
|
|
||||||
String qualified_name() const override;
|
String qualified_name() const override;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue