R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
TextUtils.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** r-type
4** File description:
5** TextUtils - Common text calculation utilities
6*/
7
8#pragma once
9
10#include <string>
11
12namespace UI {
13 namespace TextUtils {
27 inline int EstimateTextWidth(const std::string &text, int fontSize) {
28 return static_cast<int>(text.size() * static_cast<size_t>(fontSize) * 55 / 100);
29 }
30 } // namespace TextUtils
31} // namespace UI
int EstimateTextWidth(const std::string &text, int fontSize)
Estimate the width of text in pixels.
Definition TextUtils.hpp:27
Definition IButton.hpp:13