Try something like that @mmqp :
/*
Set/Restore Font face,size,weight
*/
procedure GfxSetFont(facename, size, weight) {
local old, var;
var = "font"+GetChartID();
old = StaticVarGetText(var);
StaticVarSetText(var, (facename+","+size+","+weight)+":"+old);
GfxSelectFont(facename, size, weight);
}
function GfxGetFont() {
local current, var;
var = "font"+GetChartID();
current = StaticVarGetText(var);
if (current == "") font = "";
else font = StrExtract(current, 0, ':');
return font;
}
procedure GfxRestoreFont() {
local stack, var, font, size, weight, start, len;
var = "font"+GetChartID();
stack = StaticVarGetText(var);
if (stack != "") {
// remove current
start = StrFind(stack,":");
len = StrLen(stack);
stack = StrRight(stack, len-start);
StaticVarSetText(var, stack);
// restore font
if (stack != "") {
font = StrExtract(stack, 0);
size = StrToNum(StrExtract(stack, 1));
weight = StrToNum(StrExtract(stack, 2));
GfxSelectFont(font, size, weight);
}
}
}
// Tests
GfxSetFont("Tahoma", 15, 500);
GfxDrawText("Cool !", 20, 20, 200, 60);
font = GfxGetFont();
if (font != ("Tahoma,15,500")) {
PopupWindow("Gfx Font Error 1", "");
}
GfxSetFont("Arial", 12, 300);
GfxDrawText("Cool !", 20, 70, 200, 130);
font = GfxGetFont();
if (font != ("Arial,12,300")) {
PopupWindow("Gfx Font Error 2", "");
}
GfxRestoreFont();
GfxDrawText("Cool !", 20, 140, 200, 200);
font = GfxGetFont();
if (font != ("Tahoma,15,500")) {
PopupWindow("Gfx Font Error 3", "");
}
Regards