/* * Copyright (c) 2024, Aliaksandr Kalenik * * SPDX-License-Identifier: BSD-2-Clause */ #include namespace Gfx { NonnullOwnPtr FontData::create_from_byte_buffer(ByteBuffer&& byte_buffer) { return adopt_own(*new FontData(move(byte_buffer))); } NonnullOwnPtr FontData::create_from_resource(Core::Resource const& resource) { return adopt_own(*new FontData(resource)); } ReadonlyBytes FontData::bytes() const { return m_data.visit( [&](ByteBuffer const& byte_buffer) { return byte_buffer.bytes(); }, [&](Core::Resource const& resource) { return resource.data(); }); } FontData::FontData(ByteBuffer&& byte_buffer) : m_data(move(byte_buffer)) { } FontData::FontData(NonnullRefPtr resource) : m_data(move(resource)) { } }