PDA

View Full Version : getFontZoom();


xXziroXx
05-15-2008, 06:18 PM
Not really something fancy, but still quite useful - especially when dealing with getTextWidth()/getTextHeight().


function getFontZoom() return int(profile.fontSize/16) @ "." @ ((profile.fontSize%16)/16).substring(2);



Example:


new GuiTextCtrl("MyGuiTextCtrl") {
useOwnProfile = true;
profile.fontSize = 31;
temp.size = getFontZoom(profile.fontSize);
text = "[" @ temp.size @ "]";

x = getTextWidth(temp.size, profile.fontFace, profile.fontStyle, text);
y = getTextHeight(temp.size, profile.fontFace, profile.fontStyle);
}

function getFontZoom(size) return int(size/16) @ "." @ ((size%16)/16).substring(2);


Work's pixel perfectly! :)

Tigairius
05-15-2008, 06:40 PM
Oh, neat! I thought this was going to be a feature request :p