mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-27 02:20:17 +00:00
This change removes wrappers inherited from Gfx::Typeface for WOFF and WOFF2 fonts. The only purpose they served is owning of ttf ByteBuffer produced by decoding a WOFF/WOFF2 font. Now new FontData class is responsible for holding ByteBuffer when a font is constructed from non-externally owned memory.
31 lines
681 B
C++
31 lines
681 B
C++
/*
|
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/HashMap.h>
|
|
#include <AK/Noncopyable.h>
|
|
#include <AK/RefCounted.h>
|
|
#include <LibCore/Resource.h>
|
|
#include <LibGfx/Forward.h>
|
|
|
|
namespace Gfx {
|
|
|
|
class FontData {
|
|
public:
|
|
static NonnullOwnPtr<FontData> create_from_byte_buffer(ByteBuffer&&);
|
|
static NonnullOwnPtr<FontData> create_from_resource(Core::Resource const&);
|
|
|
|
ReadonlyBytes bytes() const;
|
|
|
|
private:
|
|
FontData(ByteBuffer&& byte_buffer);
|
|
FontData(NonnullRefPtr<Core::Resource> resource);
|
|
|
|
Variant<ByteBuffer, NonnullRefPtr<Core::Resource>> m_data;
|
|
};
|
|
|
|
}
|