LibGfx: Join SkiaFont.cpp into Font

No need to keep this function in a separate file.
This commit is contained in:
Aliaksandr Kalenik 2025-04-20 01:18:46 +02:00 committed by Andreas Kling
commit 455700d379
Notes: github-actions[bot] 2025-04-21 07:52:36 +00:00
3 changed files with 8 additions and 24 deletions

View file

@ -13,7 +13,6 @@ set(SOURCES
Font/Font.cpp
Font/FontData.cpp
Font/FontDatabase.cpp
Font/FontSkia.cpp
Font/PathFontProvider.cpp
Font/Typeface.cpp
Font/TypefaceSkia.cpp

View file

@ -129,4 +129,12 @@ hb_font_t* Font::harfbuzz_font() const
return m_harfbuzz_font;
}
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;
}
}

View file

@ -1,23 +0,0 @@
/*
* 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;
}
}