PaPP v2 indicatore: fallback robusto a TextGetSize per la larghezza del box
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
e8bf23f987
commit
ff8aa9fcfb
@@ -444,8 +444,11 @@ int OnCalculate(const int rates_total,
|
|||||||
int TxtW(string s,int fs,bool bold)
|
int TxtW(string s,int fs,bool bold)
|
||||||
{
|
{
|
||||||
TextSetFont(bold?"Consolas Bold":"Consolas",-fs*10);
|
TextSetFont(bold?"Consolas Bold":"Consolas",-fs*10);
|
||||||
uint w=0,h=0; TextGetSize(s,w,h);
|
uint w=0,h=0;
|
||||||
return (int)w;
|
bool ok=TextGetSize(s,w,h);
|
||||||
|
int est=(int)MathCeil(StringLen(s)*fs*0.62); // fallback se TextGetSize non disponibile
|
||||||
|
if(!ok || (int)w<=0) return est;
|
||||||
|
return MathMax((int)w,est); // mai meno della stima
|
||||||
}
|
}
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
void DrawInfo()
|
void DrawInfo()
|
||||||
|
|||||||
Reference in New Issue
Block a user