ladybird/Libraries/LibGfx/Font/FontSkia.cpp
Aliaksandr Kalenik 8e2d1559ec LibGfx: Join ScaledFont into Font
Since ScaledFont is the only class inherited from Font we could simply
merge them.
2025-04-21 09:51:16 +02:00

23 lines
514 B
C++

/*
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/TypeCasts.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/TypefaceSkia.h>
#include <core/SkFont.h>
namespace Gfx {
SkFont Font::skia_font(float scale) const
{
auto const& sk_typeface = as<TypefaceSkia>(*m_typeface).sk_typeface();
auto sk_font = SkFont { sk_ref_sp(sk_typeface), pixel_size() * scale };
sk_font.setSubpixel(true);
return sk_font;
}
}