SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Toggle main menu visibility
Loading...
Searching...
No Matches
VBF.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <array>
4
#include <filesystem>
5
6
#include <
sourcepp/parser/Binary.h
>
7
#include <
sourcepp/Macros.h
>
8
#include <
sourcepp/Math.h
>
9
10
namespace
vtfpp
{
11
12
constexpr
uint32_t
VBF_SIGNATURE
=
sourcepp::parser::binary::makeFourCC
(
"VFNT"
);
13
14
class
VBF
{
15
public
:
16
enum
Flags
: uint16_t {
17
FLAG_NONE
= 0,
18
FLAG_BOLD
= 1 << 0,
19
FLAG_ITALIC
= 1 << 1,
20
FLAG_OUTLINE
= 1 << 2,
21
FLAG_DROP_SHADOW
= 1 << 3,
22
FLAG_BLUR
= 1 << 4,
23
FLAG_SCANLINE
= 1 << 5,
24
FLAG_ANTIALIASED
= 1 << 6,
25
FLAG_CUSTOM
= 1 << 7,
26
};
27
28
struct
Glyph
{
29
sourcepp::math::Vec2ui16
position
;
30
sourcepp::math::Vec2ui16
size
;
31
sourcepp::math::Vec3i16
abcSpacing
;
32
};
33
34
explicit
VBF
(std::span<const std::byte> vbfData);
35
36
explicit
VBF
(
const
std::filesystem::path& vbfPath);
37
38
[[nodiscard]]
explicit
operator
bool()
const
;
39
40
[[nodiscard]] sourcepp::math::Vec2ui16
getPageSize
()
const
;
41
42
[[nodiscard]] sourcepp::math::Vec2ui16
getMaxGlyphSize
()
const
;
43
44
[[nodiscard]]
Flags
getFlags
()
const
;
45
46
[[nodiscard]] uint16_t
getAscent
()
const
;
47
48
[[nodiscard]]
const
std::array<Glyph, 256>&
getGlyphs
()
const
;
49
50
protected
:
51
uint32_t
version
= 0;
52
sourcepp::math::Vec2ui16
pageSize
{};
53
sourcepp::math::Vec2ui16
maxGlyphSize
{};
54
Flags
flags
=
FLAG_NONE
;
55
uint16_t
ascent
= 0;
56
std::array<Glyph, 256>
glyphs
{};
57
};
58
SOURCEPP_BITFLAGS_ENUM
(
VBF::Flags
)
59
60
}
// namespace vtfpp
Binary.h
Macros.h
SOURCEPP_BITFLAGS_ENUM
#define SOURCEPP_BITFLAGS_ENUM(Enum)
Defines bitwise operators for an enum or enum class.
Definition
Macros.h:29
Math.h
vtfpp::VBF::maxGlyphSize
sourcepp::math::Vec2ui16 maxGlyphSize
Definition
VBF.h:53
vtfpp::VBF::getFlags
Flags getFlags() const
Definition
VBF.cpp:59
vtfpp::VBF::getPageSize
sourcepp::math::Vec2ui16 getPageSize() const
Definition
VBF.cpp:51
vtfpp::VBF::Flags
Flags
Definition
VBF.h:16
vtfpp::VBF::FLAG_ANTIALIASED
@ FLAG_ANTIALIASED
Definition
VBF.h:24
vtfpp::VBF::FLAG_BLUR
@ FLAG_BLUR
Definition
VBF.h:22
vtfpp::VBF::FLAG_ITALIC
@ FLAG_ITALIC
Definition
VBF.h:19
vtfpp::VBF::FLAG_DROP_SHADOW
@ FLAG_DROP_SHADOW
Definition
VBF.h:21
vtfpp::VBF::FLAG_NONE
@ FLAG_NONE
Definition
VBF.h:17
vtfpp::VBF::FLAG_BOLD
@ FLAG_BOLD
Definition
VBF.h:18
vtfpp::VBF::FLAG_OUTLINE
@ FLAG_OUTLINE
Definition
VBF.h:20
vtfpp::VBF::FLAG_SCANLINE
@ FLAG_SCANLINE
Definition
VBF.h:23
vtfpp::VBF::FLAG_CUSTOM
@ FLAG_CUSTOM
Definition
VBF.h:25
vtfpp::VBF::ascent
uint16_t ascent
Definition
VBF.h:55
vtfpp::VBF::getMaxGlyphSize
sourcepp::math::Vec2ui16 getMaxGlyphSize() const
Definition
VBF.cpp:55
vtfpp::VBF::glyphs
std::array< Glyph, 256 > glyphs
Definition
VBF.h:56
vtfpp::VBF::pageSize
sourcepp::math::Vec2ui16 pageSize
Definition
VBF.h:52
vtfpp::VBF::version
uint32_t version
Definition
VBF.h:51
vtfpp::VBF::getGlyphs
const std::array< Glyph, 256 > & getGlyphs() const
Definition
VBF.cpp:67
vtfpp::VBF::getAscent
uint16_t getAscent() const
Definition
VBF.cpp:63
vtfpp::VBF::VBF
VBF(std::span< const std::byte > vbfData)
Definition
VBF.cpp:11
vtfpp::VBF::flags
Flags flags
Definition
VBF.h:54
sourcepp::parser::binary::makeFourCC
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
Definition
Binary.h:20
vtfpp
Definition
DistanceMapping.h:8
vtfpp::VBF_SIGNATURE
constexpr uint32_t VBF_SIGNATURE
Definition
VBF.h:12
vtfpp::VBF::Glyph
Definition
VBF.h:28
vtfpp::VBF::Glyph::size
sourcepp::math::Vec2ui16 size
Definition
VBF.h:30
vtfpp::VBF::Glyph::position
sourcepp::math::Vec2ui16 position
Definition
VBF.h:29
vtfpp::VBF::Glyph::abcSpacing
sourcepp::math::Vec3i16 abcSpacing
Definition
VBF.h:31
include
vtfpp
VBF.h
Generated on
for SourcePP by
1.17.0