Thread: getFontZoom();
View Single Post
  #1  
Old 05-15-2008, 05:18 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
getFontZoom();

Not really something fancy, but still quite useful - especially when dealing with getTextWidth()/getTextHeight().

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

Example:

PHP Code:
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!
__________________
Follow my work on social media post-Graal:Updated august 2025.

Last edited by xXziroXx; 05-16-2008 at 03:22 AM..
Reply With Quote