1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 05:55:08 +00:00
serenity/Userland/Libraries/LibGfx/Font/VectorFont.h
Ben Wiederhake a99cd09891 Libraries: Add missing includes, add namespace qualifiers
This remained undetected for a long time as HeaderCheck is disabled by
default. This commit makes the following file compile again:

    // file: compile_me.cpp
    #include <LibDNS/Question.h>
    // That's it, this was enough to cause a compilation error.

Likewise for most other files touched by this commit.
2022-09-18 13:27:24 -04:00

50 lines
1.3 KiB
C++

/*
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Noncopyable.h>
#include <AK/RefCounted.h>
#include <LibGfx/Forward.h>
namespace Gfx {
struct ScaledFontMetrics {
float ascender { 0 };
float descender { 0 };
float line_gap { 0 };
int height() const
{
return ascender - descender;
}
};
struct ScaledGlyphMetrics {
int ascender;
int descender;
int advance_width;
int left_side_bearing;
};
class VectorFont : public RefCounted<VectorFont> {
public:
virtual ~VectorFont() { }
virtual ScaledFontMetrics metrics(float x_scale, float y_scale) const = 0;
virtual ScaledGlyphMetrics glyph_metrics(u32 glyph_id, float x_scale, float y_scale) const = 0;
virtual float glyphs_horizontal_kerning(u32 left_glyph_id, u32 right_glyph_id, float x_scale) const = 0;
virtual RefPtr<Gfx::Bitmap> rasterize_glyph(u32 glyph_id, float x_scale, float y_scale) const = 0;
virtual u32 glyph_count() const = 0;
virtual u16 units_per_em() const = 0;
virtual u32 glyph_id_for_code_point(u32 code_point) const = 0;
virtual String family() const = 0;
virtual String variant() const = 0;
virtual u16 weight() const = 0;
virtual u8 slope() const = 0;
virtual bool is_fixed_width() const = 0;
};
}