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/Type.h"
15class ResourceLoadManager;
16class ResourceLocation;
19struct UIActorOffscreenCaptureDescription;
20struct UIMeshOffscreenCaptureDescription;
21struct UIStructureVolumeOffscreenCaptureDescription;
22struct UIThumbnailMeshOffscreenCaptureDescription;
23namespace Core {
class Path; }
24namespace mce {
class TextureGroup; }
25namespace mce::Font {
struct RenderingParameters; }
28class Font :
public ::std::enable_shared_from_this<::Font> {
107 ::mce::MaterialPtr
const* optionalMat,
110 ::UIActorOffscreenCaptureDescription,
111 ::UIThumbnailMeshOffscreenCaptureDescription,
112 ::UIMeshOffscreenCaptureDescription,
113 ::UIStructureVolumeOffscreenCaptureDescription>
const& offscreenCaptureDescription
126 using CurrentLineCallback = ::std::function<bool(::std::string
const&, ::std::string&,
float, uint&)>
const;
128 using StringCache = ::std::map<
129 ::std::tuple<::std::string, ::mce::Color, float, float, bool, bool>,
130 ::std::vector<::std::shared_ptr<::Font::TextObject>>>;
135 ::ll::TypedStorage<4, 512, ::mce::Color[32]> mColors;
136 ::ll::TypedStorage<4, 4, float> mScalarOverride;
137 ::ll::TypedStorage<8, 24, ::std::vector<::std::tuple<int, int, float>>> mScaleOverrideCharacter;
138 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::mce::TextureGroup>> mTextureGroup;
143 ::std::tuple<::std::string, ::mce::Color, float, float, bool, bool>,
144 ::std::vector<::std::shared_ptr<::Font::TextObject>>>>
146 ::ll::TypedStorage<4, 4, int> mObfuscatedIndex;
147 ::ll::TypedStorage<4, 4, float> mObfuscatedTextTime;
148 ::ll::TypedStorage<4, 8, ::Vec2> mCaretRenderPosition;
149 ::ll::TypedStorage<4, 8, ::Vec2> mCaretRenderSize;
150 ::ll::TypedStorage<1, 1, bool> mAlwaysUnicode;
151 ::ll::TypedStorage<1, 1, bool> mAutoResetFormat;
152 ::ll::TypedStorage<1, 1, bool> mUseCache;
153 ::ll::TypedStorage<4, 16, ::mce::Color> mCurrentColor;
154 ::ll::TypedStorage<4, 4, int> mFontTexture;
155 ::ll::TypedStorage<4, 16, ::mce::Color> mCaretColor;
156 ::ll::TypedStorage<1, 1, bool> mItalic;
157 ::ll::TypedStorage<1, 1, bool> mBold;
158 ::ll::TypedStorage<1, 1, bool> mStrikethrough;
159 ::ll::TypedStorage<1, 1, bool> mUnderlined;
160 ::ll::TypedStorage<1, 1, bool> mObfuscated;
161 ::ll::TypedStorage<8, 16, ::mce::MaterialPtr> mFontMat;
173 virtual void switchFontsource(::Core::Path
const&, ::Core::Path
const&) = 0;
175 virtual ::std::pair<::Core::PathBuffer<::std::string>
const&, ::Core::PathBuffer<::std::string>
const&>
176 getFontSources()
const = 0;
178 virtual void fetchPage(
int);
180 virtual void drawCached(
182 ::std::string
const& str,
185 ::mce::Color
const& color,
186 bool ignoreColorFormatting,
188 bool drawColorSymbol,
189 ::mce::MaterialPtr
const* optionalMat,
193 ::mce::Color
const& resetColorOverride,
194 ::mce::Color
const& shaderDarkColor,
199 ::UIActorOffscreenCaptureDescription,
200 ::UIThumbnailMeshOffscreenCaptureDescription,
201 ::UIMeshOffscreenCaptureDescription,
202 ::UIStructureVolumeOffscreenCaptureDescription>
const& offscreenCaptureDescription,
203 bool autoGenNormalsAndTangents
206 virtual bool supportsChar(
int const&) = 0;
208 virtual int getLineLength(::std::string
const& str,
float fontSize,
bool showColorSymbol);
210 virtual float getWrapHeight()
const = 0;
212 virtual float getScaleFactor()
const = 0;
214 virtual float getScaleFactor(
int)
const;
216 virtual ::Vec2 getTranslationFactor()
const;
218 virtual bool isScreenPixelAligned()
const = 0;
220 virtual bool materialCanBeOverridden()
const = 0;
222 virtual void uploadTextureToGPU() = 0;
224 virtual void setTextConstantsInScreenContext(
::ScreenContext&,
int,
float, ::mce::Color
const&,
bool)
const;
226 virtual ::mce::Font::Type getType(
int glyphSheet)
const;
228 virtual ::std::optional<::mce::Font::RenderingParameters> tryGetRenderingParameters(
232 ::mce::Color
const& textColor,
238 virtual void onAppSuspended();
240 virtual void onDeviceLost();
242 virtual void reloadFontTextures(::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const&,
bool);
244 virtual bool isReloadingTextures();
246 virtual void unloadTextures();
248 virtual void onLanguageChanged(::std::string
const&);
250 virtual float buildChar(::std::vector<::Font::GlyphQuad>&,
int, ::mce::Color
const&,
bool,
float,
float,
bool) = 0;
252 virtual ::mce::MaterialPtr
const& getMaterial(
int,
bool)
const = 0;
254 virtual void loadFontData(
bool) = 0;
256 virtual int _getReplacementCharacter();
258 virtual bool _supportsShadowInSingleDraw() = 0;
260 virtual float _getCharWidth(
int,
bool) = 0;
262 virtual void _scanUnicodeCharacterSize(
int,
int,
bool) = 0;
264 virtual ::ResourceLocation _getFontSheetLocation(
int,
bool)
const = 0;
266 virtual ::std::string _remapString(::std::string
const& str)
const;
272 MCAPI
explicit Font(::std::shared_ptr<::mce::TextureGroup> textureGroup);
274 MCAPI
bool _chopString(
275 ::std::string& currentLine,
276 ::std::string& activeFormatting,
278 uint& remainingLineCount,
280 bool showColorSymbol,
283 ::std::function<
bool(::std::string
const&, ::std::string&,
float, uint&)> currentLineCallback
286 MCAPI
void _drawTextSegment(
288 ::std::string
const& str,
291 ::mce::Color
const& color,
294 bool showColorSymbol,
295 ::mce::MaterialPtr* optionalMat
298 MCAPI
int _drawWordWrap(
300 ::std::string
const& str,
304 ::mce::Color
const& color,
309 bool showColorSymbol,
310 ::mce::MaterialPtr* optionalMat
313 MCAPI
int _getStringChopAmount(::std::string
const& currentLine,
bool showColorSymbol,
float maxWidth);
315 MCAPI ::std::shared_ptr<::Font::TextObject> _makeTextObject(
317 ::std::string
const& str,
318 ::mce::Color
const& ccolor,
319 bool showColorSymbol,
320 bool ignoreColorFormatting,
325 ::mce::Color
const& resetColorOverride,
329 bool autoGenNormalsAndTangents
332 MCAPI
int _processHeightWrap(
333 ::std::string
const& str,
338 bool showColorSymbol,
341 ::std::function<
bool(::std::string
const&, ::std::string&,
float, uint&)> currentLineCallback
344 MCAPI
void calculateTextWidths(::std::string
const& text, ::std::vector<int>& widths);
346 MCAPI
void drawShadow(
348 ::std::string
const& str,
351 ::mce::Color
const& color,
352 bool showColorSymbol,
353 ::mce::MaterialPtr* optionalMat,
357 MCAPI
void drawTransformed(
359 ::std::string
const& str,
362 ::mce::Color
const& color,
370 MCAPI ::std::unordered_set<::ResourceLocation>
const& getGlyphLocations()
const;
372 MCAPI ::std::vector<::ResourceLocation> getReloadFontTextures()
const;
374 MCAPI
int getTextHeight(::std::string
const& str,
float fontSize);
376 MCAPI
bool hasFormattingCodes(::std::string
const& str)
const;
378 MCAPI
int processLinesInBox(
379 ::std::string
const& str,
382 bool showColorSymbol,
383 ::std::function<
bool(::std::string
const&, ::std::string&,
float, uint&)> currentLineCallback
386 MCAPI
void resetFontData(
bool uploadTextureImmediately);
388 MCAPI
bool supportsString(::std::string
const& str);
390 MCAPI
void tickObfuscatedTextIndex(
float deltaTime,
float obfuscateSwitchTime);
396 MCAPI
static bool containsWideChar(::std::string
const& str);
402 MCAPI
static int const& DEFAULT_FONT_HEIGHT();
404 MCAPI
static int const& DEFAULT_WRAP_HEIGHT();
406 MCAPI static ::Core::PathBuffer<::std::string>
const& NOT_FOUND_PAGE();
408 MCAPI
static int const& NULL_CHAR();
410 MCAPI
static float const& OBFUSCATED_TIME_SWITCH();
412 MCAPI
static int const& PRIVATE_USE_AREA_BEGIN();
414 MCAPI
static int const& PRIVATE_USE_AREA_END();
416 MCAPI
static int const& UNICODE_REPLACEMENT_CHARACTER_CODE();
422 MCAPI
void* $ctor(::std::shared_ptr<::mce::TextureGroup> textureGroup);
434 MCFOLD
void $fetchPage(
int);
436 MCAPI
void $drawCached(
438 ::std::string
const& str,
441 ::mce::Color
const& color,
442 bool ignoreColorFormatting,
444 bool drawColorSymbol,
445 ::mce::MaterialPtr
const* optionalMat,
449 ::mce::Color
const& resetColorOverride,
450 ::mce::Color
const& shaderDarkColor,
455 ::UIActorOffscreenCaptureDescription,
456 ::UIThumbnailMeshOffscreenCaptureDescription,
457 ::UIMeshOffscreenCaptureDescription,
458 ::UIStructureVolumeOffscreenCaptureDescription>
const& offscreenCaptureDescription,
459 bool autoGenNormalsAndTangents
462 MCAPI
int $getLineLength(::std::string
const& str,
float fontSize,
bool showColorSymbol);
464 MCAPI
float $getScaleFactor(
int)
const;
466 MCFOLD ::Vec2 $getTranslationFactor()
const;
468 MCFOLD
void $setTextConstantsInScreenContext(
::ScreenContext&,
int,
float, ::mce::Color
const&,
bool)
const;
470 MCFOLD ::mce::Font::Type $getType(
int glyphSheet)
const;
472 MCAPI ::std::optional<::mce::Font::RenderingParameters> $tryGetRenderingParameters(
476 ::mce::Color
const& textColor,
482 MCFOLD
void $onAppSuspended();
484 MCFOLD
void $onDeviceLost();
486 MCAPI
void $reloadFontTextures(::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const&,
bool);
488 MCAPI
bool $isReloadingTextures();
490 MCFOLD
void $unloadTextures();
492 MCFOLD
void $onLanguageChanged(::std::string
const&);
494 MCAPI
int $_getReplacementCharacter();
496 MCFOLD ::std::string $_remapString(::std::string
const& str)
const;
static MCAPI void ** $vftable()
Definition ScreenContext.h:5
Definition Tessellator.h:5
MCAPI void append(::Tessellator &t, bool linearClampFormat) const
MCAPI void render(::ScreenContext &screenContext, ::Font const &font, ::mce::MaterialPtr const *optionalMat, ::std::variant< ::std::monostate, ::UIActorOffscreenCaptureDescription, ::UIThumbnailMeshOffscreenCaptureDescription, ::UIMeshOffscreenCaptureDescription, ::UIStructureVolumeOffscreenCaptureDescription > const &offscreenCaptureDescription) const