MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / getStringWidth

Function getStringWidth

src/openrct2/drawing/Drawing.String.cpp:785–805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783 }
784
785 int32_t getStringWidth(std::string_view text, FontStyle fontStyle, bool noFormatting)
786 {
787 TextDrawInfo info{};
788 info.fontStyle = fontStyle;
789
790 info.textDrawFlags.set(TextDrawFlag::noDraw);
791 if (LocalisationService_UseTrueTypeFont())
792 {
793 info.textDrawFlags.set(TextDrawFlag::ttf);
794 }
795
796 if (noFormatting)
797 {
798 info.textDrawFlags.set(TextDrawFlag::noFormatting);
799 }
800
801 RenderTarget dummy{};
802 processString(dummy, text, info);
803
804 return info.max.x;
805 }
806
807 /**
808 *

Callers 15

PaintReplayNoticeMethod · 0.85
PaintFPSMethod · 0.85
ChatDrawFunction · 0.85
getStringWidthNewlinedFunction · 0.85
clipStringFunction · 0.85
wrapStringFunction · 0.85
drawStringCentredRawFunction · 0.85
drawNewsTickerFunction · 0.85
shortenPathFunction · 0.85
setupFunction · 0.85
drawTextFunction · 0.85
SetValueMethod · 0.85

Calls 3

processStringFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected