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, 608, ::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;
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;
155 getFontSources()
const = 0;
157 virtual void fetchPage(
int page);
159 virtual void drawCached(
161 ::std::string_view str,
165 bool ignoreColorFormatting,
167 bool drawColorSymbol,
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(
206 virtual ::mce::Font::Type getType(
int glyphSheet)
const;
208 virtual ::std::optional<::mce::Font::RenderingParameters> tryGetRenderingParameters(
219 virtual void onAppSuspended();
221 virtual void onDeviceLost();
226 virtual bool isReloadingTextures();
228 virtual void unloadTextures();
230 virtual void onLanguageChanged(::std::string_view languageCode);
232 virtual float buildChar(
233 ::std::vector<::Font::GlyphQuad>& quads,
242 virtual ::mce::MaterialPtr
const& getMaterial(
int sheet,
bool isOddGuiScale)
const = 0;
244 virtual float getGlyphHeight(
int glyphSheet,
bool isUnicode)
const;
246 virtual void loadFontData(
bool uploadTextureImmediately) = 0;
248 virtual int _getReplacementCharacter();
250 virtual bool _supportsShadowInSingleDraw() = 0;
252 virtual float _getCharWidth(
int uniChar,
bool forceUnicode) = 0;
254 virtual void _scanUnicodeCharacterSize(
int character,
int sheet,
bool forceUnicode) = 0;
256 virtual ::ResourceLocation _getFontSheetLocation(
int sheet,
bool forceUnicode)
const = 0;
258 virtual ::std::string _remapString(::std::string_view str)
const;
260 virtual uchar _getAsciiSheetCount()
const;
262 virtual int _getAsciiGlyphsPerPage()
const;
264 virtual bool _usesLegacyAsciiMapping()
const;
270 MCNAPI
Font(::Font
const& rhs);
272 MCNAPI
explicit Font(::std::shared_ptr<::mce::TextureGroup> textureGroup);
275 ::std::string& currentLine,
276 ::std::string& activeFormatting,
278 uint& remainingLineCount,
280 bool showColorSymbol,
283 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)>
const currentLineCallback,
284 int& outRemainingCharacterCount
289 ::std::string_view str,
298 bool showColorSymbol,
302 MCNAPI
int _getSheet(
int uniChar,
int& replacementC,
bool forceUnicode);
305 _getStringChopAmount(::std::string_view currentLine,
bool showColorSymbol,
float maxWidth,
bool reserveHyphenWidth);
309 ::std::string_view str,
311 bool showColorSymbol,
312 bool ignoreColorFormatting,
321 bool autoGenNormalsAndTangents
325 ::std::string_view str,
330 bool showColorSymbol,
333 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)> currentLineCallback
336 MCAPI
void calculateTextWidths(::std::string_view text, ::std::vector<int>& widths);
342 ::std::string_view str,
346 bool showColorSymbol,
353 ::std::string_view str,
366 ::std::string_view str,
371 bool showColorSymbol,
383 ::std::string_view str,
386 bool showColorSymbol,
387 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)> currentLineCallback
399 ::std::string_view textBeforeBreak,
400 ::std::string_view textAfterBreak,
401 bool languageSupportsHyphenSplitting
416 MCNAPI
void*
$ctor(::Font
const& rhs);
418 MCNAPI
void*
$ctor(::std::shared_ptr<::mce::TextureGroup> textureGroup);
432 MCAPI
void $drawCached(
434 ::std::string_view str,
438 bool ignoreColorFormatting,
440 bool drawColorSymbol,
450 bool autoGenNormalsAndTangents
453 MCNAPI
int $getLineLength(::std::string_view str,
float fontSize,
bool showColorSymbol);
467 MCNAPI ::mce::Font::Type
$getType(
int glyphSheet)
const;
Definition NonOwnerPointer.h:9
Definition PathBuffer.h:8
MCAPI float $getScaleFactor(int uniChar) const
MCAPI::mce::Font::Type $getType(int glyphSheet) const
MCAPI void $onAppSuspended()
MCAPI void $onDeviceLost()
MCAPI::Vec2 $getTranslationFactor() const
static MCAPI ::Core::PathBuffer<::std::string > const & NOT_FOUND_PAGE()
MCAPI int $_getReplacementCharacter()
MCAPI void * $ctor(::std::shared_ptr<::mce::TextureGroup > textureGroup)
MCAPI int $getLineLength(::std::string_view str, float fontSize, bool showColorSymbol)
MCAPI int _drawWordWrap(::ScreenContext &screenContext, ::std::string_view str, float x, float y, float w, ::mce::Color const &color, uint maxLine, float fontSize, bool shadow, bool centered, bool showColorSymbol, ::mce::MaterialPtr *optionalMat)
MCAPI void drawTransformed(::ScreenContext &screenContext, ::std::string_view str, float x, float y, ::mce::Color const &color, float angle, float s, bool centered, float maxWidth, bool shadow)
MCAPI bool containsWideChar(::std::string_view str)
MCAPI bool supportsString(::std::string_view str)
MCAPI float $getGlyphHeight(int glyphSheet, bool isUnicode) const
MCAPI int processLinesInBox(::std::string_view str, float maxWidth, uint maxLines, bool showColorSymbol, ::std::function< bool(::std::string_view const &, ::std::string &, float, uint &)> currentLineCallback)
MCAPI Font(::Font const &rhs)
MCAPI ::std::shared_ptr<::Font::TextObject > _makeTextObject(::Tessellator &tessellator, ::std::string_view str, ::mce::Color const &ccolor, bool showColorSymbol, bool ignoreColorFormatting, int caretPosition, bool shadow, float linePadding, bool isOddGuiScale, ::mce::Color const &resetColorOverride, bool uiMaterial, float outlineWidth, float yCaretOffset, bool autoGenNormalsAndTangents)
MCAPI void resetFontData(bool uploadTextureImmediately)
MCAPI void $onLanguageChanged(::std::string_view languageCode)
MCAPI::std::string $_remapString(::std::string_view str) const
MCAPI void drawWithColorResetOverride(::ScreenContext &screenContext, ::std::string_view str, float x, float y, ::mce::Color const &color, ::mce::Color const &resetColor, bool showColorSymbol, ::mce::MaterialPtr *optionalMat, int caretPosition, float linePadding, float yCaretOffset)
MCAPI void $setTextConstantsInScreenContext(::ScreenContext &screenContext, int glyphSheet, float guiScale, ::mce::Color const &textColor, bool hasShadow) const
MCAPI ::std::vector<::ResourceLocation > getReloadFontTextures() const
MCAPI uchar $_getAsciiSheetCount() const
MCAPI void $fetchPage(int page)
MCAPI int _getStringChopAmount(::std::string_view currentLine, bool showColorSymbol, float maxWidth, bool reserveHyphenWidth)
MCAPI int $_getAsciiGlyphsPerPage() const
static MCAPI bool shouldInsertHyphenAtLineBreak(::std::string_view textBeforeBreak, ::std::string_view textAfterBreak, bool languageSupportsHyphenSplitting)
MCAPI ::std::optional<::mce::Font::RenderingParameters > $tryGetRenderingParameters(::ScreenContext const &screenContext, int glyphSheet, float guiScale, ::mce::Color const &textColor, bool hasShadow, uint textureWidth, uint textureHeight, bool isUnicode) const
MCAPI ::std::unordered_set<::ResourceLocation > const & getGlyphLocations() const
MCAPI void * $ctor(::Font const &rhs)
MCAPI void $reloadFontTextures(::Bedrock::NonOwnerPointer<::ResourceLoadManager > const &resourceLoadManager, bool blockingLoad)
MCAPI bool $isReloadingTextures()
static MCAPI int const & UNICODE_REPLACEMENT_CHARACTER_CODE()
MCAPI void drawShadow(::ScreenContext &screenContext, ::std::string_view str, float x, float y, ::mce::Color const &color, bool showColorSymbol, ::mce::MaterialPtr *optionalMat, float linePadding)
MCAPI void $unloadTextures()
MCAPI bool _chopString(::std::string ¤tLine, ::std::string &activeFormatting, float &totalHeight, uint &remainingLineCount, float maxWidth, bool showColorSymbol, bool centered, float fontSize, ::std::function< bool(::std::string_view const &, ::std::string &, float, uint &)> const currentLineCallback, int &outRemainingCharacterCount)
MCAPI bool $_usesLegacyAsciiMapping() const
static MCAPI void ** $vftable()
MCAPI int _processHeightWrap(::std::string_view str, float startX, float startY, float maxWidth, uint maxLine, bool showColorSymbol, bool centered, float fontSize, ::std::function< bool(::std::string_view const &, ::std::string &, float, uint &)> currentLineCallback)
MCAPI int _getSheet(int uniChar, int &replacementC, bool forceUnicode)
MCAPI Font(::std::shared_ptr<::mce::TextureGroup > textureGroup)
Definition ResourceLoadManager.h:22
Definition ResourceLocation.h:15
Definition ScreenContext.h:5
Definition Tessellator.h:5
Definition MaterialPtr.h:14
Definition TextureGroup.h:7
MCAPI void render(::ScreenContext &screenContext, ::Font const &font, ::mce::MaterialPtr const *optionalMat, ::OffscreenCaptureDescription const &offscreenCaptureDescription) const
Definition OffscreenCaptureDescription.h:5
Definition RenderingParameters.h:7