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, 632, ::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;
151 virtual void switchFontsource(::Core::Path
const& asciiName, ::Core::Path
const& unicodeName) = 0;
153 virtual ::std::pair<::Core::PathBuffer<::std::string>
const&, ::Core::PathBuffer<::std::string>
const&>
154 getFontSources()
const = 0;
156 virtual void fetchPage(
int page);
158 virtual void drawCached(
159 ::ScreenContext& screenContext,
160 ::std::string_view str,
163 ::mce::Color
const& color,
164 bool ignoreColorFormatting,
166 bool drawColorSymbol,
167 ::mce::MaterialPtr
const* optionalMat,
171 ::mce::Color
const& resetColorOverride,
172 ::mce::Color
const& shaderDarkColor,
175 ::OffscreenCaptureDescription
const& offscreenCaptureDescription,
176 bool autoGenNormalsAndTangents
179 virtual bool supportsChar(
int const& character) = 0;
181 virtual int getLineLength(::std::string_view str,
float fontSize,
bool showColorSymbol);
183 virtual float getWrapHeight()
const = 0;
185 virtual float getScaleFactor()
const = 0;
187 virtual float getScaleFactor(
int c)
const;
189 virtual ::Vec2 getTranslationFactor()
const;
191 virtual bool isScreenPixelAligned()
const = 0;
193 virtual bool materialCanBeOverridden()
const = 0;
195 virtual void uploadTextureToGPU() = 0;
197 virtual void setTextConstantsInScreenContext(
198 ::ScreenContext& screenContext,
201 ::mce::Color
const& textColor,
205 virtual ::mce::Font::Type getType(
int glyphSheet)
const;
207 virtual ::std::optional<::mce::Font::RenderingParameters> tryGetRenderingParameters(
208 ::ScreenContext
const& screenContext,
211 ::mce::Color
const& textColor,
217 virtual void onAppSuspended();
219 virtual void onDeviceLost();
222 reloadFontTextures(::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const& resourceLoadManager,
bool blockingLoad);
224 virtual bool isReloadingTextures();
226 virtual void unloadTextures();
228 virtual void onLanguageChanged(::std::string_view languageCode);
230 virtual float buildChar(
231 ::std::vector<::Font::GlyphQuad>& quads,
233 ::mce::Color
const& color,
240 virtual ::mce::MaterialPtr
const& getMaterial(
int sheet,
bool isOddGuiScale)
const = 0;
242 virtual void loadFontData(
bool uploadTextureImmediately) = 0;
244 virtual int _getReplacementCharacter();
246 virtual bool _supportsShadowInSingleDraw() = 0;
248 virtual float _getCharWidth(
int uniChar,
bool forceUnicode) = 0;
250 virtual void _scanUnicodeCharacterSize(
int character,
int sheet,
bool forceUnicode) = 0;
252 virtual ::ResourceLocation _getFontSheetLocation(
int sheet,
bool forceUnicode)
const = 0;
254 virtual ::std::string _remapString(::std::string_view str)
const;
260 MCAPI
explicit Font(::std::shared_ptr<::mce::TextureGroup> textureGroup);
262 MCAPI
bool _chopString(
263 ::std::string& currentLine,
264 ::std::string& activeFormatting,
266 uint& remainingLineCount,
268 bool showColorSymbol,
271 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)>
const currentLineCallback
274 MCAPI
int _drawWordWrap(
275 ::ScreenContext& screenContext,
276 ::std::string_view str,
280 ::mce::Color
const& color,
285 bool showColorSymbol,
286 ::mce::MaterialPtr* optionalMat
289 MCAPI ::std::shared_ptr<::Font::TextObject> _makeTextObject(
290 ::Tessellator& tessellator,
291 ::std::string_view str,
292 ::mce::Color
const& ccolor,
293 bool showColorSymbol,
294 bool ignoreColorFormatting,
299 ::mce::Color
const& resetColorOverride,
303 bool autoGenNormalsAndTangents
306 MCAPI
int _processHeightWrap(
307 ::std::string_view str,
312 bool showColorSymbol,
315 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)> currentLineCallback
318 MCAPI
void calculateTextWidths(::std::string_view text, ::std::vector<int>& widths);
320 MCAPI
void drawShadow(
321 ::ScreenContext& screenContext,
322 ::std::string_view str,
325 ::mce::Color
const& color,
326 bool showColorSymbol,
327 ::mce::MaterialPtr* optionalMat,
331 MCAPI
void drawTransformed(
332 ::ScreenContext& screenContext,
333 ::std::string_view str,
336 ::mce::Color
const& color,
344 MCAPI
void drawWithColorResetOverride(
345 ::ScreenContext& screenContext,
346 ::std::string_view str,
349 ::mce::Color
const& color,
350 ::mce::Color
const& resetColor,
351 bool showColorSymbol,
352 ::mce::MaterialPtr* optionalMat,
358 MCAPI ::std::unordered_set<::ResourceLocation>
const& getGlyphLocations()
const;
360 MCAPI ::std::vector<::ResourceLocation> getReloadFontTextures()
const;
362 MCAPI
int processLinesInBox(
363 ::std::string_view str,
366 bool showColorSymbol,
367 ::std::function<
bool(::std::string_view
const&, ::std::string&,
float, uint&)> currentLineCallback
370 MCAPI
void resetFontData(
bool uploadTextureImmediately);
372 MCAPI
bool supportsString(::std::string_view str);
378 MCAPI static ::Core::PathBuffer<::std::string>
const& NOT_FOUND_PAGE();
380 MCAPI
static int const& UNICODE_REPLACEMENT_CHARACTER_CODE();
386 MCAPI
void* $ctor(::std::shared_ptr<::mce::TextureGroup> textureGroup);
398 MCFOLD
void $fetchPage(
int page);
400 MCAPI
void $drawCached(
401 ::ScreenContext& screenContext,
402 ::std::string_view str,
405 ::mce::Color
const& color,
406 bool ignoreColorFormatting,
408 bool drawColorSymbol,
409 ::mce::MaterialPtr
const* optionalMat,
413 ::mce::Color
const& resetColorOverride,
414 ::mce::Color
const& shaderDarkColor,
417 ::OffscreenCaptureDescription
const& offscreenCaptureDescription,
418 bool autoGenNormalsAndTangents
421 MCAPI
int $getLineLength(::std::string_view str,
float fontSize,
bool showColorSymbol);
423 MCAPI
float $getScaleFactor(
int c)
const;
425 MCFOLD ::Vec2 $getTranslationFactor()
const;
427 MCFOLD
void $setTextConstantsInScreenContext(
428 ::ScreenContext& screenContext,
431 ::mce::Color
const& textColor,
435 MCFOLD ::mce::Font::Type $getType(
int glyphSheet)
const;
437 MCAPI ::std::optional<::mce::Font::RenderingParameters> $tryGetRenderingParameters(
438 ::ScreenContext
const& screenContext,
441 ::mce::Color
const& textColor,
447 MCFOLD
void $onAppSuspended();
449 MCFOLD
void $onDeviceLost();
451 MCAPI
void $reloadFontTextures(
452 ::Bedrock::NonOwnerPointer<::ResourceLoadManager>
const& resourceLoadManager,
456 MCAPI
bool $isReloadingTextures();
458 MCFOLD
void $unloadTextures();
460 MCFOLD
void $onLanguageChanged(::std::string_view languageCode);
462 MCAPI
int $_getReplacementCharacter();
464 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