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"
22namespace Core {
class Path; }
27class Font :
public ::std::enable_shared_from_this<::Font> {
41 ::ll::TypedStorage<4, 8, ::Vec2> meshUpperLeft;
42 ::ll::TypedStorage<4, 8, ::Vec2> meshSize;
43 ::ll::TypedStorage<4, 8, ::Vec2> textureUpperLeft;
44 ::ll::TypedStorage<4, 8, ::Vec2> textureBottomRight;
45 ::ll::TypedStorage<4, 4, int> shear;
46 ::ll::TypedStorage<4, 16, ::mce::Color> color;
62 ::ll::TypedStorage<8, 616, ::mce::Mesh> mMesh;
63 ::ll::TypedStorage<8, 32, ::mce::TexturePtr> mTexture;
64 ::ll::TypedStorage<4, 4, int> mSheet;
71 ::ll::TypedStorage<8, 24, ::std::vector<::Font::TextObject::Page>> mPages;
72 ::ll::TypedStorage<4, 16, ::mce::Color> mColor;
73 ::ll::TypedStorage<1, 1, bool> mContainsUnicode;
74 ::ll::TypedStorage<1, 1, bool> mShadow;
81 ::ScreenContext& screenContext,
83 ::mce::MaterialPtr
const* optionalMat,
84 ::OffscreenCaptureDescription
const& offscreenCaptureDescription
92 using TextObjects = ::std::vector<::std::shared_ptr<::Font::TextObject>>;
94 using TextObjectsPtr = ::std::shared_ptr<::std::vector<::std::shared_ptr<::Font::TextObject>>>;
103 ::std::tuple<::std::string, ::mce::Color, float, float, bool, bool>,
104 ::std::shared_ptr<::std::vector<::std::shared_ptr<::Font::TextObject>>>,
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>;
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;
123 ::ll::TypedStorage<8, 16, ::Font::TextObjectCache> mStringCache;
124 ::ll::TypedStorage<4, 4, int> mObfuscatedIndex;
125 ::ll::TypedStorage<4, 4, float> mObfuscatedTextTime;
126 ::ll::TypedStorage<4, 8, ::Vec2> mCaretRenderPosition;
127 ::ll::TypedStorage<4, 8, ::Vec2> mCaretRenderSize;
128 ::ll::TypedStorage<1, 1, bool> mAlwaysUnicode;
129 ::ll::TypedStorage<1, 1, bool> mAutoResetFormat;
130 ::ll::TypedStorage<1, 1, bool> mUseCache;
131 ::ll::TypedStorage<4, 16, ::mce::Color> mCurrentColor;
132 ::ll::TypedStorage<4, 4, int> mFontTexture;
133 ::ll::TypedStorage<4, 16, ::mce::Color> mCaretColor;
134 ::ll::TypedStorage<1, 1, bool> mItalic;
135 ::ll::TypedStorage<1, 1, bool> mBold;
136 ::ll::TypedStorage<1, 1, bool> mStrikethrough;
137 ::ll::TypedStorage<1, 1, bool> mUnderlined;
138 ::ll::TypedStorage<1, 1, bool> mObfuscated;
139 ::ll::TypedStorage<8, 16, ::mce::MaterialPtr> mFontMat;
144 Font& operator=(Font
const&);
152 virtual void switchFontsource(::Core::Path
const& asciiName, ::Core::Path
const& unicodeName) = 0;
154 virtual ::std::pair<::Core::PathBuffer<::std::string>
const&, ::Core::PathBuffer<::std::string>
const&>
155 getFontSources()
const = 0;
157 virtual void fetchPage(
int page);
159 virtual void drawCached(
160 ::ScreenContext& screenContext,
161 ::std::string_view str,
164 ::mce::Color
const& color,
165 bool ignoreColorFormatting,
167 bool drawColorSymbol,
168 ::mce::MaterialPtr
const* optionalMat,
172 ::mce::Color
const& resetColorOverride,
173 ::mce::Color
const& shaderDarkColor,
176 ::OffscreenCaptureDescription
const& offscreenCaptureDescription,
177 bool autoGenNormalsAndTangents
180 virtual bool supportsChar(
int const& character) = 0;
182 virtual int getLineLength(::std::string_view str,
float fontSize,
bool showColorSymbol);
184 virtual float getWrapHeight()
const = 0;
186 virtual float getScaleFactor()
const = 0;
188 virtual float getScaleFactor(
int uniChar)
const;
190 virtual ::Vec2 getTranslationFactor()
const;
192 virtual bool isScreenPixelAligned()
const = 0;
194 virtual bool materialCanBeOverridden()
const = 0;
196 virtual void uploadTextureToGPU() = 0;
198 virtual void setTextConstantsInScreenContext(
199 ::ScreenContext& screenContext,
202 ::mce::Color
const& textColor,
206 virtual ::mce::Font::Type getType(
int glyphSheet)
const;
208 virtual ::std::optional<::mce::Font::RenderingParameters> tryGetRenderingParameters(
209 ::ScreenContext
const& screenContext,
212 ::mce::Color
const& textColor,
218 virtual void onAppSuspended();
220 virtual void onDeviceLost();
223 reloadFontTextures(::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const& resourceLoadManager,
bool blockingLoad);
225 virtual bool isReloadingTextures();
227 virtual void unloadTextures();
229 virtual void onLanguageChanged(::std::string_view languageCode);
231 virtual float buildChar(
232 ::std::vector<::Font::GlyphQuad>& quads,
234 ::mce::Color
const& color,
241 virtual ::mce::MaterialPtr
const& getMaterial(
int sheet,
bool isOddGuiScale)
const = 0;
243 virtual void loadFontData(
bool uploadTextureImmediately) = 0;
245 virtual int _getReplacementCharacter();
247 virtual bool _supportsShadowInSingleDraw() = 0;
249 virtual float _getCharWidth(
int uniChar,
bool forceUnicode) = 0;
251 virtual void _scanUnicodeCharacterSize(
int character,
int sheet,
bool forceUnicode) = 0;
253 virtual ::ResourceLocation _getFontSheetLocation(
int sheet,
bool forceUnicode)
const = 0;
255 virtual ::std::string _remapString(::std::string_view str)
const;
261 MCAPI Font(::Font
const& rhs);
263 MCAPI
explicit Font(::std::shared_ptr<::mce::TextureGroup> textureGroup);
265 MCAPI
bool _chopString(
266 ::std::string& currentLine,
267 ::std::string& activeFormatting,
269 uint& remainingLineCount,
271 bool showColorSymbol,
274 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)>
const currentLineCallback
277 MCAPI
int _drawWordWrap(
278 ::ScreenContext& screenContext,
279 ::std::string_view str,
283 ::mce::Color
const& color,
288 bool showColorSymbol,
289 ::mce::MaterialPtr* optionalMat
292 MCAPI ::std::shared_ptr<::Font::TextObject> _makeTextObject(
293 ::Tessellator& tessellator,
294 ::std::string_view str,
295 ::mce::Color
const& ccolor,
296 bool showColorSymbol,
297 bool ignoreColorFormatting,
302 ::mce::Color
const& resetColorOverride,
306 bool autoGenNormalsAndTangents
309 MCAPI
int _processHeightWrap(
310 ::std::string_view str,
315 bool showColorSymbol,
318 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)> currentLineCallback
321 MCAPI
void calculateTextWidths(::std::string_view text, ::std::vector<int>& widths);
323 MCAPI
void drawShadow(
324 ::ScreenContext& screenContext,
325 ::std::string_view str,
328 ::mce::Color
const& color,
329 bool showColorSymbol,
330 ::mce::MaterialPtr* optionalMat,
334 MCAPI
void drawTransformed(
335 ::ScreenContext& screenContext,
336 ::std::string_view str,
339 ::mce::Color
const& color,
347 MCAPI
void drawWithColorResetOverride(
348 ::ScreenContext& screenContext,
349 ::std::string_view str,
352 ::mce::Color
const& color,
353 ::mce::Color
const& resetColor,
354 bool showColorSymbol,
355 ::mce::MaterialPtr* optionalMat,
361 MCAPI ::std::unordered_set<::ResourceLocation>
const& getGlyphLocations()
const;
363 MCAPI ::std::vector<::ResourceLocation> getReloadFontTextures()
const;
365 MCAPI
int processLinesInBox(
366 ::std::string_view str,
369 bool showColorSymbol,
370 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)> currentLineCallback
373 MCAPI
void resetFontData(
bool uploadTextureImmediately);
375 MCAPI
bool supportsString(::std::string_view str);
381 MCAPI static ::Core::PathBuffer<::std::string>
const& NOT_FOUND_PAGE();
383 MCAPI
static int const& UNICODE_REPLACEMENT_CHARACTER_CODE();
389 MCAPI
void* $ctor(::Font
const& rhs);
391 MCAPI
void* $ctor(::std::shared_ptr<::mce::TextureGroup> textureGroup);
403 MCFOLD
void $fetchPage(
int page);
405 MCAPI
void $drawCached(
406 ::ScreenContext& screenContext,
407 ::std::string_view str,
410 ::mce::Color
const& color,
411 bool ignoreColorFormatting,
413 bool drawColorSymbol,
414 ::mce::MaterialPtr
const* optionalMat,
418 ::mce::Color
const& resetColorOverride,
419 ::mce::Color
const& shaderDarkColor,
422 ::OffscreenCaptureDescription
const& offscreenCaptureDescription,
423 bool autoGenNormalsAndTangents
426 MCAPI
int $getLineLength(::std::string_view str,
float fontSize,
bool showColorSymbol);
428 MCAPI
float $getScaleFactor(
int uniChar)
const;
430 MCFOLD ::Vec2 $getTranslationFactor()
const;
432 MCFOLD
void $setTextConstantsInScreenContext(
433 ::ScreenContext& screenContext,
436 ::mce::Color
const& textColor,
440 MCFOLD ::mce::Font::Type $getType(
int glyphSheet)
const;
442 MCAPI ::std::optional<::mce::Font::RenderingParameters> $tryGetRenderingParameters(
443 ::ScreenContext
const& screenContext,
446 ::mce::Color
const& textColor,
452 MCFOLD
void $onAppSuspended();
454 MCFOLD
void $onDeviceLost();
456 MCAPI
void $reloadFontTextures(
457 ::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const& resourceLoadManager,
461 MCAPI
bool $isReloadingTextures();
463 MCFOLD
void $unloadTextures();
465 MCFOLD
void $onLanguageChanged(::std::string_view languageCode);
467 MCAPI
int $_getReplacementCharacter();
469 MCAPI ::std::string $_remapString(::std::string_view 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 OffscreenCaptureDescription.h:5
Definition RenderingParameters.h:7