I think I found the problem.
It comes from Control._GetFontOffset to calculate the font size to 2D GUI. Thoug, it adds a rectangle inside DOM, and the DOM has it own CSS that changes the result from this calculation.
If you wanna try, just run this code in your console:
const font = " 65px Arial";
var text = document.createElement("span");
text.innerHTML = "Hg";
text.style.font = font;
var block = document.createElement("div");
block.style.display = "inline-block";
block.style.width = "1px";
block.style.height = "0px";
block.style.verticalAlign = "bottom";
var div = document.createElement("div");
div.style.whiteSpace = "nowrap";
div.appendChild(text);
div.appendChild(block);
document.body.appendChild(div);
var fontAscent = 0;
var fontHeight = 0;
try {
fontHeight = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
block.style.verticalAlign = "baseline";
fontAscent = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
} finally {
document.body.removeChild(div);
}
var result = { ascent: fontAscent, height: fontHeight, descent: fontHeight - fontAscent };
console.log(result);
The result on my old project is:
Object { ascent: 59, height: 74.5, descent: 15.5 }
On my new project is:
Object { ascent: 14, height: 20.5, descent: 6.5 }
I am going to find a fix for that and create a pull request