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_view
const&, ::std::string&,
float, uint&)>
const;
112 using StringCacheStoredKey = ::std::tuple<::std::string, ::mce::Color, float, float, bool, bool>;
114 using StringCacheLookupKey = ::std::tuple<::std::string_view, ::mce::Color, float, float, bool, bool>;
116 using StringCache = ::std::map<
117 ::std::tuple<::std::string, ::mce::Color, float, float, bool, bool>,
118 ::std::vector<::std::shared_ptr<::Font::TextObject>>,
124 ::ll::TypedStorage<4, 512, ::mce::Color[32]> mColors;
125 ::ll::TypedStorage<4, 4, float> mScalarOverride;
126 ::ll::TypedStorage<8, 24, ::std::vector<::std::tuple<int, int, float>>> mScaleOverrideCharacter;
127 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::mce::TextureGroup>> mTextureGroup;
132 ::std::tuple<::std::string, ::mce::Color, float, float, bool, bool>,
133 ::std::vector<::std::shared_ptr<::Font::TextObject>>,
136 ::ll::TypedStorage<4, 4, int> mObfuscatedIndex;
137 ::ll::TypedStorage<4, 4, float> mObfuscatedTextTime;
138 ::ll::TypedStorage<4, 8, ::Vec2> mCaretRenderPosition;
139 ::ll::TypedStorage<4, 8, ::Vec2> mCaretRenderSize;
140 ::ll::TypedStorage<1, 1, bool> mAlwaysUnicode;
141 ::ll::TypedStorage<1, 1, bool> mAutoResetFormat;
142 ::ll::TypedStorage<1, 1, bool> mUseCache;
143 ::ll::TypedStorage<4, 16, ::mce::Color> mCurrentColor;
144 ::ll::TypedStorage<4, 4, int> mFontTexture;
145 ::ll::TypedStorage<4, 16, ::mce::Color> mCaretColor;
146 ::ll::TypedStorage<1, 1, bool> mItalic;
147 ::ll::TypedStorage<1, 1, bool> mBold;
148 ::ll::TypedStorage<1, 1, bool> mStrikethrough;
149 ::ll::TypedStorage<1, 1, bool> mUnderlined;
150 ::ll::TypedStorage<1, 1, bool> mObfuscated;
151 ::ll::TypedStorage<8, 16, ::mce::MaterialPtr> mFontMat;
163 virtual void switchFontsource(::Core::Path
const& asciiName, ::Core::Path
const& unicodeName) = 0;
165 virtual ::std::pair<::Core::PathBuffer<::std::string>
const&, ::Core::PathBuffer<::std::string>
const&>
166 getFontSources()
const = 0;
168 virtual void fetchPage(
int page);
170 virtual void drawCached(
171 ::ScreenContext& screenContext,
172 ::std::string_view str,
175 ::mce::Color
const& color,
176 bool ignoreColorFormatting,
178 bool drawColorSymbol,
179 ::mce::MaterialPtr
const* optionalMat,
183 ::mce::Color
const& resetColorOverride,
184 ::mce::Color
const& shaderDarkColor,
189 ::UIActorOffscreenCaptureDescription,
190 ::UIThumbnailMeshOffscreenCaptureDescription,
191 ::UIMeshOffscreenCaptureDescription,
192 ::UIStructureVolumeOffscreenCaptureDescription>
const& offscreenCaptureDescription,
193 bool autoGenNormalsAndTangents
196 virtual bool supportsChar(
int const& character) = 0;
198 virtual int getLineLength(::std::string_view str,
float fontSize,
bool showColorSymbol);
200 virtual float getWrapHeight()
const = 0;
202 virtual float getScaleFactor()
const = 0;
204 virtual float getScaleFactor(
int c)
const;
206 virtual ::Vec2 getTranslationFactor()
const;
208 virtual bool isScreenPixelAligned()
const = 0;
210 virtual bool materialCanBeOverridden()
const = 0;
212 virtual void uploadTextureToGPU() = 0;
214 virtual void setTextConstantsInScreenContext(
215 ::ScreenContext& screenContext,
218 ::mce::Color
const& textColor,
222 virtual ::mce::Font::Type getType(
int glyphSheet)
const;
224 virtual ::std::optional<::mce::Font::RenderingParameters> tryGetRenderingParameters(
225 ::ScreenContext
const& screenContext,
228 ::mce::Color
const& textColor,
234 virtual void onAppSuspended();
236 virtual void onDeviceLost();
239 reloadFontTextures(::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const& resourceLoadManager,
bool blockingLoad);
241 virtual bool isReloadingTextures();
243 virtual void unloadTextures();
245 virtual void onLanguageChanged(::std::string_view languageCode);
247 virtual float buildChar(
248 ::std::vector<::Font::GlyphQuad>& quads,
250 ::mce::Color
const& color,
257 virtual ::mce::MaterialPtr
const& getMaterial(
int sheet,
bool isOddGuiScale)
const = 0;
259 virtual void loadFontData(
bool uploadTextureImmediately) = 0;
261 virtual int _getReplacementCharacter();
263 virtual bool _supportsShadowInSingleDraw() = 0;
265 virtual float _getCharWidth(
int uniChar,
bool forceUnicode) = 0;
267 virtual void _scanUnicodeCharacterSize(
int character,
int sheet,
bool forceUnicode) = 0;
269 virtual ::ResourceLocation _getFontSheetLocation(
int sheet,
bool forceUnicode)
const = 0;
271 virtual ::std::string _remapString(::std::string_view str)
const;
277 MCAPI
explicit Font(::std::shared_ptr<::mce::TextureGroup> textureGroup);
279 MCAPI
bool _chopString(
280 ::std::string& currentLine,
281 ::std::string& activeFormatting,
283 uint& remainingLineCount,
285 bool showColorSymbol,
288 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)> currentLineCallback
291 MCAPI
void _drawTextSegment(
292 ::ScreenContext& screenContext,
293 ::std::string_view str,
296 ::mce::Color
const& color,
299 bool showColorSymbol,
300 ::mce::MaterialPtr* optionalMat
303 MCAPI
int _drawWordWrap(
304 ::ScreenContext& screenContext,
305 ::std::string_view str,
309 ::mce::Color
const& color,
314 bool showColorSymbol,
315 ::mce::MaterialPtr* optionalMat
318 MCAPI
int _getStringChopAmount(::std::string_view currentLine,
bool showColorSymbol,
float maxWidth);
320 MCAPI ::std::shared_ptr<::Font::TextObject> _makeTextObject(
321 ::Tessellator& tessellator,
322 ::std::string_view str,
323 ::mce::Color
const& ccolor,
324 bool showColorSymbol,
325 bool ignoreColorFormatting,
330 ::mce::Color
const& resetColorOverride,
334 bool autoGenNormalsAndTangents
337 MCAPI
int _processHeightWrap(
338 ::std::string_view str,
343 bool showColorSymbol,
346 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)> currentLineCallback
349 MCAPI
void calculateTextWidths(::std::string_view text, ::std::vector<int>& widths);
351 MCAPI
void drawShadow(
352 ::ScreenContext& screenContext,
353 ::std::string_view str,
356 ::mce::Color
const& color,
357 bool showColorSymbol,
358 ::mce::MaterialPtr* optionalMat,
362 MCAPI
void drawTransformed(
363 ::ScreenContext& screenContext,
364 ::std::string_view str,
367 ::mce::Color
const& color,
375 MCAPI ::std::unordered_set<::ResourceLocation>
const& getGlyphLocations()
const;
377 MCAPI ::std::vector<::ResourceLocation> getReloadFontTextures()
const;
379 MCAPI
bool hasFormattingCodes(::std::string_view str)
const;
381 MCAPI
void resetFontData(
bool uploadTextureImmediately);
383 MCAPI
bool supportsString(::std::string_view str);
385 MCAPI
void tickObfuscatedTextIndex(
float deltaTime,
float obfuscateSwitchTime);
391 MCAPI
static bool containsWideChar(::std::string_view str);
397 MCAPI static ::Core::PathBuffer<::std::string>
const& NOT_FOUND_PAGE();
399 MCAPI
static int const& UNICODE_REPLACEMENT_CHARACTER_CODE();
405 MCAPI
void* $ctor(::std::shared_ptr<::mce::TextureGroup> textureGroup);
417 MCFOLD
void $fetchPage(
int page);
419 MCAPI
void $drawCached(
420 ::ScreenContext& screenContext,
421 ::std::string_view str,
424 ::mce::Color
const& color,
425 bool ignoreColorFormatting,
427 bool drawColorSymbol,
428 ::mce::MaterialPtr
const* optionalMat,
432 ::mce::Color
const& resetColorOverride,
433 ::mce::Color
const& shaderDarkColor,
438 ::UIActorOffscreenCaptureDescription,
439 ::UIThumbnailMeshOffscreenCaptureDescription,
440 ::UIMeshOffscreenCaptureDescription,
441 ::UIStructureVolumeOffscreenCaptureDescription>
const& offscreenCaptureDescription,
442 bool autoGenNormalsAndTangents
445 MCAPI
int $getLineLength(::std::string_view str,
float fontSize,
bool showColorSymbol);
447 MCAPI
float $getScaleFactor(
int c)
const;
449 MCFOLD ::Vec2 $getTranslationFactor()
const;
451 MCFOLD
void $setTextConstantsInScreenContext(
452 ::ScreenContext& screenContext,
455 ::mce::Color
const& textColor,
459 MCFOLD ::mce::Font::Type $getType(
int glyphSheet)
const;
461 MCAPI ::std::optional<::mce::Font::RenderingParameters> $tryGetRenderingParameters(
462 ::ScreenContext
const& screenContext,
465 ::mce::Color
const& textColor,
471 MCFOLD
void $onAppSuspended();
473 MCFOLD
void $onDeviceLost();
475 MCAPI
void $reloadFontTextures(
476 ::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const& resourceLoadManager,
480 MCAPI
bool $isReloadingTextures();
482 MCFOLD
void $unloadTextures();
484 MCFOLD
void $onLanguageChanged(::std::string_view languageCode);
486 MCAPI
int $_getReplacementCharacter();
488 MCAPI ::std::string $_remapString(::std::string_view str)
const;
static MCAPI void ** $vftable()
Definition ResourceLoadManager.h:19
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:5
Definition UIThumbnailMeshOffscreenCaptureDescription.h:5
Definition RenderingParameters.h:7