#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_FONT_TEST_HELPERS_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_FONT_TEST_HELPERS_H_
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "third_party/blink/public/platform/web_font_prewarmer.h"
#include "third_party/blink/renderer/platform/fonts/font_description.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
namespace blink {
class Font;
namespace test {
Font CreateTestFont(const AtomicString& family_name,
const String& font_path,
float size,
const FontDescription::VariantLigatures* = nullptr,
void (*init_font_description)(FontDescription*) = nullptr);
Font CreateTestFont(const AtomicString& family_name,
const uint8_t* data,
size_t data_size,
float size,
const FontDescription::VariantLigatures* = nullptr);
Font CreateAhemFont(float size);
#if BUILDFLAG(IS_WIN)
class TestFontPrewarmer : public WebFontPrewarmer {
public:
void PrewarmFamily(const WebString& family_name) override;
const Vector<String>& PrewarmedFamilyNames() const { return family_names_; }
private:
Vector<String> family_names_;
};
class ScopedTestFontPrewarmer {
public:
ScopedTestFontPrewarmer();
~ScopedTestFontPrewarmer();
const Vector<String>& PrewarmedFamilyNames() const {
return current_.PrewarmedFamilyNames();
}
private:
TestFontPrewarmer current_;
raw_ptr<WebFontPrewarmer> saved_;
};
#endif
}
}
#endif