3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/deps/core/file/PathBuffer.h"
7#include "mc/deps/core/math/Color.h"
8#include "mc/deps/core/math/Vec2.h"
9#include "mc/deps/core/utility/NonOwnerPointer.h"
10#include "mc/deps/minecraft_renderer/renderer/MaterialPtr.h"
11#include "mc/deps/minecraft_renderer/renderer/Mesh.h"
12#include "mc/deps/minecraft_renderer/renderer/TexturePtr.h"
13#include "mc/deps/minecraft_renderer/renderer/Type.h"
25namespace Core {
class Path; }
30class Font :
public ::std::enable_shared_from_this<::Font> {
43 ::ll::TypedStorage<4, 8, ::Vec2> meshUpperLeft;
44 ::ll::TypedStorage<4, 8, ::Vec2> meshSize;
45 ::ll::TypedStorage<4, 8, ::Vec2> textureUpperLeft;
46 ::ll::TypedStorage<4, 8, ::Vec2> textureBottomRight;
47 ::ll::TypedStorage<4, 4, int> shear;
48 ::ll::TypedStorage<4, 16, ::mce::Color> color;
54 MCAPI
void append(::Tessellator& t,
bool linearClampFormat)
const;
70 ::ll::TypedStorage<8, 528, ::mce::Mesh> mMesh;
71 ::ll::TypedStorage<8, 32, ::mce::TexturePtr> mTexture;
72 ::ll::TypedStorage<4, 4, int> mSheet;
79 ::ll::TypedStorage<8, 24, ::std::vector<::Font::TextObject::Page>> mPages;
80 ::ll::TypedStorage<4, 16, ::mce::Color> mColor;
81 ::ll::TypedStorage<1, 1, bool> mContainsUnicode;
82 ::ll::TypedStorage<1, 1, bool> mShadow;
89 ::ScreenContext& screenContext,
91 ::mce::MaterialPtr
const* optionalMat,
94 ::UIActorOffscreenCaptureDescription,
95 ::UIThumbnailMeshOffscreenCaptureDescription,
96 ::UIMeshOffscreenCaptureDescription,
97 ::UIStructureVolumeOffscreenCaptureDescription>
const& offscreenCaptureDescription
110 using CurrentLineCallback = ::std::function<bool(::std::string
const&, ::std::string&,
float, uint&)>
const;
112 using StringCache = ::std::map<
113 ::std::tuple<::std::string, ::mce::Color, float, float, bool, bool>,
114 ::std::vector<::std::shared_ptr<::Font::TextObject>>>;
119 ::ll::TypedStorage<4, 512, ::mce::Color[32]> mColors;
120 ::ll::TypedStorage<4, 4, float> mScalarOverride;
121 ::ll::TypedStorage<8, 24, ::std::vector<::std::tuple<int, int, float>>> mScaleOverrideCharacter;
122 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::mce::TextureGroup>> mTextureGroup;
127 ::std::tuple<::std::string, ::mce::Color, float, float, bool, bool>,
128 ::std::vector<::std::shared_ptr<::Font::TextObject>>>>
130 ::ll::TypedStorage<4, 4, int> mObfuscatedIndex;
131 ::ll::TypedStorage<4, 4, float> mObfuscatedTextTime;
132 ::ll::TypedStorage<4, 8, ::Vec2> mCaretRenderPosition;
133 ::ll::TypedStorage<4, 8, ::Vec2> mCaretRenderSize;
134 ::ll::TypedStorage<1, 1, bool> mAlwaysUnicode;
135 ::ll::TypedStorage<1, 1, bool> mAutoResetFormat;
136 ::ll::TypedStorage<1, 1, bool> mUseCache;
137 ::ll::TypedStorage<4, 16, ::mce::Color> mCurrentColor;
138 ::ll::TypedStorage<4, 4, int> mFontTexture;
139 ::ll::TypedStorage<4, 16, ::mce::Color> mCaretColor;
140 ::ll::TypedStorage<1, 1, bool> mItalic;
141 ::ll::TypedStorage<1, 1, bool> mBold;
142 ::ll::TypedStorage<1, 1, bool> mStrikethrough;
143 ::ll::TypedStorage<1, 1, bool> mUnderlined;
144 ::ll::TypedStorage<1, 1, bool> mObfuscated;
145 ::ll::TypedStorage<8, 16, ::mce::MaterialPtr> mFontMat;
157 virtual void switchFontsource(::Core::Path
const&, ::Core::Path
const&) = 0;
159 virtual ::std::pair<::Core::PathBuffer<::std::string>
const&, ::Core::PathBuffer<::std::string>
const&>
160 getFontSources()
const = 0;
162 virtual void fetchPage(
int);
164 virtual void drawCached(
165 ::ScreenContext& screenContext,
166 ::std::string
const& str,
169 ::mce::Color
const& color,
170 bool ignoreColorFormatting,
172 bool drawColorSymbol,
173 ::mce::MaterialPtr
const* optionalMat,
177 ::mce::Color
const& resetColorOverride,
178 ::mce::Color
const& shaderDarkColor,
183 ::UIActorOffscreenCaptureDescription,
184 ::UIThumbnailMeshOffscreenCaptureDescription,
185 ::UIMeshOffscreenCaptureDescription,
186 ::UIStructureVolumeOffscreenCaptureDescription>
const& offscreenCaptureDescription,
187 bool autoGenNormalsAndTangents
190 virtual bool supportsChar(
int const&) = 0;
192 virtual int getLineLength(::std::string
const& str,
float fontSize,
bool showColorSymbol);
194 virtual float getWrapHeight()
const = 0;
196 virtual float getScaleFactor()
const = 0;
198 virtual float getScaleFactor(
int)
const;
200 virtual ::Vec2 getTranslationFactor()
const;
202 virtual bool isScreenPixelAligned()
const = 0;
204 virtual bool materialCanBeOverridden()
const = 0;
206 virtual void uploadTextureToGPU() = 0;
208 virtual void setTextConstantsInScreenContext(::ScreenContext&,
int,
float, ::mce::Color
const&,
bool)
const;
210 virtual ::mce::Font::Type getType(
int glyphSheet)
const;
212 virtual ::std::optional<::mce::Font::RenderingParameters> tryGetRenderingParameters(
213 ::ScreenContext
const& screenContext,
216 ::mce::Color
const& textColor,
222 virtual void onAppSuspended();
224 virtual void onDeviceLost();
226 virtual void reloadFontTextures(::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const&,
bool);
228 virtual bool isReloadingTextures();
230 virtual void unloadTextures();
232 virtual void onLanguageChanged(::std::string
const&);
234 virtual float buildChar(::std::vector<::Font::GlyphQuad>&,
int, ::mce::Color
const&,
bool,
float,
float,
bool) = 0;
236 virtual ::mce::MaterialPtr
const& getMaterial(
int,
bool)
const = 0;
238 virtual void loadFontData(
bool) = 0;
240 virtual int _getReplacementCharacter();
242 virtual bool _supportsShadowInSingleDraw() = 0;
244 virtual float _getCharWidth(
int,
bool) = 0;
246 virtual void _scanUnicodeCharacterSize(
int,
int,
bool) = 0;
248 virtual ::ResourceLocation _getFontSheetLocation(
int,
bool)
const = 0;
250 virtual ::std::string _remapString(::std::string
const& str)
const;
256 MCAPI
explicit Font(::std::shared_ptr<::mce::TextureGroup> textureGroup);
258 MCAPI
bool _chopString(
259 ::std::string& currentLine,
260 ::std::string& activeFormatting,
262 uint& remainingLineCount,
264 bool showColorSymbol,
267 ::std::function<
bool(::std::string
const&, ::std::string&,
float, uint&)> currentLineCallback
270 MCAPI
void _drawTextSegment(
271 ::ScreenContext& screenContext,
272 ::std::string
const& str,
275 ::mce::Color
const& color,
278 bool showColorSymbol,
279 ::mce::MaterialPtr* optionalMat
282 MCAPI
int _drawWordWrap(
283 ::ScreenContext& screenContext,
284 ::std::string
const& str,
288 ::mce::Color
const& color,
293 bool showColorSymbol,
294 ::mce::MaterialPtr* optionalMat
297 MCAPI
int _getStringChopAmount(::std::string
const& currentLine,
bool showColorSymbol,
float maxWidth);
299 MCAPI ::std::shared_ptr<::Font::TextObject> _makeTextObject(
300 ::Tessellator& tessellator,
301 ::std::string
const& str,
302 ::mce::Color
const& ccolor,
303 bool showColorSymbol,
304 bool ignoreColorFormatting,
309 ::mce::Color
const& resetColorOverride,
313 bool autoGenNormalsAndTangents
316 MCAPI
int _processHeightWrap(
317 ::std::string
const& str,
322 bool showColorSymbol,
325 ::std::function<
bool(::std::string
const&, ::std::string&,
float, uint&)> currentLineCallback
328 MCAPI
void calculateTextWidths(::std::string
const& text, ::std::vector<int>& widths);
330 MCAPI
void drawShadow(
331 ::ScreenContext& screenContext,
332 ::std::string
const& str,
335 ::mce::Color
const& color,
336 bool showColorSymbol,
337 ::mce::MaterialPtr* optionalMat,
341 MCAPI
void drawTransformed(
342 ::ScreenContext& screenContext,
343 ::std::string
const& str,
346 ::mce::Color
const& color,
354 MCAPI ::std::unordered_set<::ResourceLocation>
const& getGlyphLocations()
const;
356 MCAPI ::std::vector<::ResourceLocation> getReloadFontTextures()
const;
358 MCAPI
bool hasFormattingCodes(::std::string
const& str)
const;
360 MCAPI
int processLinesInBox(
361 ::std::string
const& str,
364 bool showColorSymbol,
365 ::std::function<
bool(::std::string
const&, ::std::string&,
float, uint&)> currentLineCallback
368 MCAPI
void resetFontData(
bool uploadTextureImmediately);
370 MCAPI
bool supportsString(::std::string
const& str);
372 MCAPI
void tickObfuscatedTextIndex(
float deltaTime,
float obfuscateSwitchTime);
378 MCAPI
static bool containsWideChar(::std::string
const& str);
384 MCAPI
static int const& DEFAULT_FONT_HEIGHT();
386 MCAPI
static int const& DEFAULT_WRAP_HEIGHT();
388 MCAPI static ::Core::PathBuffer<::std::string>
const& NOT_FOUND_PAGE();
390 MCAPI
static int const& NULL_CHAR();
392 MCAPI
static float const& OBFUSCATED_TIME_SWITCH();
394 MCAPI
static int const& PRIVATE_USE_AREA_BEGIN();
396 MCAPI
static int const& PRIVATE_USE_AREA_END();
398 MCAPI
static int const& UNICODE_REPLACEMENT_CHARACTER_CODE();
404 MCAPI
void* $ctor(::std::shared_ptr<::mce::TextureGroup> textureGroup);
416 MCFOLD
void $fetchPage(
int);
418 MCAPI
void $drawCached(
419 ::ScreenContext& screenContext,
420 ::std::string
const& str,
423 ::mce::Color
const& color,
424 bool ignoreColorFormatting,
426 bool drawColorSymbol,
427 ::mce::MaterialPtr
const* optionalMat,
431 ::mce::Color
const& resetColorOverride,
432 ::mce::Color
const& shaderDarkColor,
437 ::UIActorOffscreenCaptureDescription,
438 ::UIThumbnailMeshOffscreenCaptureDescription,
439 ::UIMeshOffscreenCaptureDescription,
440 ::UIStructureVolumeOffscreenCaptureDescription>
const& offscreenCaptureDescription,
441 bool autoGenNormalsAndTangents
444 MCAPI
int $getLineLength(::std::string
const& str,
float fontSize,
bool showColorSymbol);
446 MCAPI
float $getScaleFactor(
int)
const;
448 MCFOLD ::Vec2 $getTranslationFactor()
const;
450 MCFOLD
void $setTextConstantsInScreenContext(::ScreenContext&,
int,
float, ::mce::Color
const&,
bool)
const;
452 MCFOLD ::mce::Font::Type $getType(
int glyphSheet)
const;
454 MCAPI ::std::optional<::mce::Font::RenderingParameters> $tryGetRenderingParameters(
455 ::ScreenContext
const& screenContext,
458 ::mce::Color
const& textColor,
464 MCFOLD
void $onAppSuspended();
466 MCFOLD
void $onDeviceLost();
468 MCAPI
void $reloadFontTextures(::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const&,
bool);
470 MCAPI
bool $isReloadingTextures();
472 MCFOLD
void $unloadTextures();
474 MCFOLD
void $onLanguageChanged(::std::string
const&);
476 MCAPI
int $_getReplacementCharacter();
478 MCFOLD ::std::string $_remapString(::std::string
const& str)
const;
static MCAPI void ** $vftable()
Definition ResourceLoadManager.h:18
Definition ResourceLocation.h:15
Definition ScreenContext.h:5
Definition Tessellator.h:5
Definition TextureGroup.h:7
Definition UIActorOffscreenCaptureDescription.h:5
Definition UIMeshOffscreenCaptureDescription.h:5
Definition UIStructureVolumeOffscreenCaptureDescription.h:8
Definition UIThumbnailMeshOffscreenCaptureDescription.h:5
Definition RenderingParameters.h:7