Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
MSDFFont.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/Font.h"
7#include "mc/deps/core/file/PathBuffer.h"
8#include "mc/deps/minecraft_renderer/renderer/Type.h"
9
10// auto generated forward declare list
11// clang-format off
13class ScreenContext;
14class Vec2;
15namespace Core { class Path; }
16namespace mce { class Color; }
17namespace mce { class MaterialPtr; }
18namespace mce { class TextureGroup; }
19// clang-format on
20
21class MSDFFont : public ::Font {
22public:
23 // member variables
24 // NOLINTBEGIN
25 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mFontPagePrefix;
26 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, float>> mUnicodeWidths;
27 ::ll::TypedStorage<8, 64, ::std::unordered_set<int>> mSheetScannedForWidthsAndOffsets;
28 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, int>> mRemappedGlyphs;
29 // NOLINTEND
30
31public:
32 // prevent constructor by default
33 MSDFFont();
34
35public:
36 // virtual functions
37 // NOLINTBEGIN
38 virtual float _getCharWidth(int uniChar, bool forceUnicode) /*override*/;
39
40 virtual bool supportsChar(int const& character) /*override*/;
41
42 virtual float getWrapHeight() const /*override*/;
43
44 virtual float getScaleFactor() const /*override*/;
45
46 virtual bool isScreenPixelAligned() const /*override*/;
47
48 virtual bool materialCanBeOverridden() const /*override*/;
49
50 virtual void uploadTextureToGPU() /*override*/;
51
52 virtual void setTextConstantsInScreenContext(
53 ::ScreenContext& screenContext,
54 int,
55 float guiScale,
56 ::mce::Color const& textColor,
57 bool hasShadow
58 ) const /*override*/;
59
60 virtual ::Vec2 getTranslationFactor() const /*override*/;
61
62 virtual void _scanUnicodeCharacterSize(int character, int sheet, bool forceUnicode) /*override*/;
63
64 virtual bool _supportsShadowInSingleDraw() /*override*/;
65
66 virtual ::ResourceLocation _getFontSheetLocation(int sheet, bool) const /*override*/;
67
68 virtual ::mce::MaterialPtr const& getMaterial(int sheet, bool isOddGuiScale) const /*override*/;
69
70 virtual ::mce::Font::Type getType(int glyphSheet) const /*override*/;
71
72 virtual void loadFontData(bool) /*override*/;
73
74 virtual float buildChar(
75 ::std::vector<::Font::GlyphQuad>& quads,
76 int i,
77 ::mce::Color const& color,
78 bool italic,
79 float x,
80 float y,
81 bool unicode
82 ) /*override*/;
83
84 virtual ::Core::PathBuffer<::std::string>
85 getUnicodeFontNameWithPage(::Core::Path const& fontName, uchar const page) const;
86
87 virtual int _getReplacementCharacter() /*override*/;
88
89 virtual ::std::string _remapString(::std::string_view str) const /*override*/;
90
91 virtual void switchFontsource(::Core::Path const&, ::Core::Path const&) /*override*/;
92
93 virtual ::std::pair<::Core::PathBuffer<::std::string> const&, ::Core::PathBuffer<::std::string> const&>
94 getFontSources() const /*override*/;
95 // NOLINTEND
96
97public:
98 // member functions
99 // NOLINTBEGIN
100 MCNAPI MSDFFont(
101 ::Core::Path const& fontPagePrefix,
102 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
103 bool uploadOnConstruction
104 );
105
106 MCNAPI void _loadMsdfFontInformation(::Core::Path const& fontName, uchar const page);
107 // NOLINTEND
108
109public:
110 // constructor thunks
111 // NOLINTBEGIN
112 MCNAPI void* $ctor(
113 ::Core::Path const& fontPagePrefix,
114 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
115 bool uploadOnConstruction
116 );
117 // NOLINTEND
118
119public:
120 // virtual function thunks
121 // NOLINTBEGIN
122 MCNAPI float $_getCharWidth(int uniChar, bool forceUnicode);
123
124 MCNAPI bool $supportsChar(int const& character);
125
126 MCNAPI float $getWrapHeight() const;
127
128 MCNAPI float $getScaleFactor() const;
129
130 MCNAPI bool $isScreenPixelAligned() const;
131
132 MCNAPI bool $materialCanBeOverridden() const;
133
134 MCNAPI void $uploadTextureToGPU();
135
137 ::ScreenContext& screenContext,
138 int,
139 float guiScale,
140 ::mce::Color const& textColor,
141 bool hasShadow
142 ) const;
143
144 MCNAPI ::Vec2 $getTranslationFactor() const;
145
146 MCNAPI void $_scanUnicodeCharacterSize(int character, int sheet, bool forceUnicode);
147
149
150 MCNAPI ::ResourceLocation $_getFontSheetLocation(int sheet, bool) const;
151
152 MCNAPI ::mce::MaterialPtr const& $getMaterial(int sheet, bool isOddGuiScale) const;
153
154 MCNAPI ::mce::Font::Type $getType(int glyphSheet) const;
155
156 MCNAPI void $loadFontData(bool);
157
158 MCNAPI float $buildChar(
159 ::std::vector<::Font::GlyphQuad>& quads,
160 int i,
161 ::mce::Color const& color,
162 bool italic,
163 float x,
164 float y,
165 bool unicode
166 );
167
168 MCNAPI ::Core::PathBuffer<::std::string>
169 $getUnicodeFontNameWithPage(::Core::Path const& fontName, uchar const page) const;
170
172
173 MCNAPI ::std::string $_remapString(::std::string_view str) const;
174
175 MCNAPI void $switchFontsource(::Core::Path const&, ::Core::Path const&);
176
177 MCNAPI ::std::pair<::Core::PathBuffer<::std::string> const&, ::Core::PathBuffer<::std::string> const&>
179 // NOLINTEND
180};
Definition Path.h:10
Definition Font.h:5
Definition MSDFFont.h:5
MCAPI float $buildChar(::std::vector<::Font::GlyphQuad > &quads, int i, ::mce::Color const &color, bool italic, float x, float y, bool unicode)
MCAPI bool $_supportsShadowInSingleDraw()
MCAPI float $getWrapHeight() const
MCAPI::Vec2 $getTranslationFactor() const
MCAPI void $setTextConstantsInScreenContext(::ScreenContext &screenContext, int, float guiScale, ::mce::Color const &textColor, bool hasShadow) const
MCAPI::std::string $_remapString(::std::string_view str) const
MCAPI bool $materialCanBeOverridden() const
MCAPI bool $isScreenPixelAligned() const
MCAPI ::std::pair<::Core::PathBuffer<::std::string > const &, ::Core::PathBuffer<::std::string > const & > $getFontSources() const
MCAPI::mce::MaterialPtr const & $getMaterial(int sheet, bool isOddGuiScale) const
MCAPI void $loadFontData(bool)
MCAPI void $switchFontsource(::Core::Path const &, ::Core::Path const &)
MCAPI bool $supportsChar(int const &character)
MCAPI::ResourceLocation $_getFontSheetLocation(int sheet, bool) const
MCAPI void $_scanUnicodeCharacterSize(int character, int sheet, bool forceUnicode)
MCAPI::mce::Font::Type $getType(int glyphSheet) const
MCAPI void _loadMsdfFontInformation(::Core::Path const &fontName, uchar const page)
MCAPI float $getScaleFactor() const
MCAPI void * $ctor(::Core::Path const &fontPagePrefix, ::std::shared_ptr<::mce::TextureGroup > textureGroup, bool uploadOnConstruction)
MCAPI int $_getReplacementCharacter()
MCAPI ::Core::PathBuffer<::std::string > $getUnicodeFontNameWithPage(::Core::Path const &fontName, uchar const page) const
MCAPI void $uploadTextureToGPU()
MCAPI float $_getCharWidth(int uniChar, bool forceUnicode)
Definition Path.h:16
Definition ResourceLocation.h:15
Definition ScreenContext.h:5
Definition Vec2.h:5
Definition Color.h:13
Definition MaterialPtr.h:14
Definition TextureGroup.h:7
STL namespace.
Definition Font.h:15