Jump to content

[HELP]Custom Font


FuriouZ

Recommended Posts

Hello how i can add custom font to speedomeeter?

myFont = dxCreateFont( "myFont.ttf", 20 ) 
  
g_GuiLabel = { } 
  
function GuiShow() 
    if g_Settings.Visible then 
        g_GuiLabel.Speed:visible(true) 
        g_GuiLabel.Unit:visible(true) 
    end 
end 
addEventHandler("onClientScreenFadedIn", root, GuiShow) 
  
  
function GuiHide() 
    g_GuiLabel.Speed:visible(false) 
    g_GuiLabel.Unit:visible(false) 
end 
addEventHandler("onClientScreenFadedOut", root, GuiHide) 
  
  
function GuiInitialize() 
    local screenWidth, screenHeight = guiGetScreenSize() 
  
    g_GuiLabel.Speed = dxText:create("0", screenWidth-72, screenHeight - 36, false, "myFont", 2, "right") 
    g_GuiLabel.Speed:type("stroke", 3, 0, 0, 0, 255) 
     
    g_GuiLabel.Unit = dxText:create("", screenWidth-64, screenHeight - 28, false, "myFont", 1, "left") 
    g_GuiLabel.Unit:type("stroke", 2, 0, 0, 0, 255) 
     
    GuiHide() 
end 
GuiInitialize() 
  

Link to comment
Guest Guest4401

try

myFont = dxCreateFont( "myFont.ttf", 20 ) 
  
g_GuiLabel = { } 
  
function GuiShow() 
    if g_Settings.Visible then 
        g_GuiLabel.Speed:visible(true) 
        g_GuiLabel.Unit:visible(true) 
    end 
end 
addEventHandler("onClientScreenFadedIn", root, GuiShow) 
  
  
function GuiHide() 
    g_GuiLabel.Speed:visible(false) 
    g_GuiLabel.Unit:visible(false) 
end 
addEventHandler("onClientScreenFadedOut", root, GuiHide) 
  
  
function GuiInitialize() 
    local screenWidth, screenHeight = guiGetScreenSize() 
  
    g_GuiLabel.Speed = dxText:create("0", screenWidth-72, screenHeight - 36, false, myFont, 2, "right") 
    g_GuiLabel.Speed:type("stroke", 3, 0, 0, 0, 255) 
    
    g_GuiLabel.Unit = dxText:create("", screenWidth-64, screenHeight - 28, false, myFont, 1, "left") 
    g_GuiLabel.Unit:type("stroke", 2, 0, 0, 0, 255) 
    
    GuiHide() 
end 
GuiInitialize() 
  

Link to comment

@TheVenom,

I've worked on my drift script (

) recently and added custom font support for the textlib. Here is the function I modified:
function dxText:font(font) 
    if not validFonts[font] and ( type( font ) == "nil" or type( font ) == "string" ) then return self.strFont end 
    self.strFont = font 
    return true 
end 

Simply replace the old one with this.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...