Better font handling
This commit is contained in:
+16
-12
@@ -187,13 +187,17 @@
|
||||
|
||||
-- Font importing system
|
||||
local fonts = {}; do
|
||||
local font_dir = library.directory .. "/fonts/"
|
||||
|
||||
function Register_Font(Name, Weight, Style, Asset)
|
||||
if not isfile(Asset.Id) then
|
||||
writefile(Asset.Id, Asset.Font)
|
||||
end
|
||||
|
||||
if isfile(Name .. ".font") then
|
||||
delfile(Name .. ".font")
|
||||
local font_path = font_dir .. Name .. ".font"
|
||||
|
||||
if isfile(font_path) then
|
||||
delfile(font_path)
|
||||
end
|
||||
|
||||
local Data = {
|
||||
@@ -208,29 +212,29 @@
|
||||
},
|
||||
}
|
||||
|
||||
writefile(Name .. ".font", game:GetService("HttpService"):JSONEncode(Data))
|
||||
writefile(font_path, game:GetService("HttpService"):JSONEncode(Data))
|
||||
|
||||
return getcustomasset(Name .. ".font");
|
||||
return getcustomasset(font_path);
|
||||
end
|
||||
|
||||
local TahomaBold = Register_Font("TahomaBold", 200, "Normal", {
|
||||
Id = "TahomaBold.ttf",
|
||||
Font = game:HttpGet("https://raw.githubusercontent.com/tulontop/mirrorhack/refs/heads/main/fonts/tahomabold.ttf"),
|
||||
Id = font_dir .. "TahomaBold.ttf",
|
||||
Font = game:HttpGet("https://git.nfa.re/tul/mirrorhack/raw/branch/main/UI/fonts/tahomabold.ttf"),
|
||||
})
|
||||
|
||||
local Tahoma = Register_Font("Tahoma", 200, "Normal", {
|
||||
Id = "Tahoma.ttf",
|
||||
Font = game:HttpGet("https://raw.githubusercontent.com/tulontop/mirrorhack/refs/heads/main/fonts/tahoma.ttf"),
|
||||
Id = font_dir .. "Tahoma.ttf",
|
||||
Font = game:HttpGet("https://git.nfa.re/tul/mirrorhack/raw/branch/main/UI/fonts/tahoma.ttf"),
|
||||
})
|
||||
|
||||
local SmallestPixel = Register_Font("SmallestPixel", 200, "normal", {
|
||||
Id = "SmallestPixel.ttf",
|
||||
Font = game:HttpGet("https://raw.githubusercontent.com/tulontop/mirrorhack/refs/heads/main/fonts/smallestpixel.ttf"),
|
||||
Id = font_dir .. "SmallestPixel.ttf",
|
||||
Font = game:HttpGet("https://git.nfa.re/tul/mirrorhack/raw/branch/main/UI/fonts/smallestpixel.ttf"),
|
||||
})
|
||||
|
||||
local ProggyClean = Register_Font("ProggyClean", 200, "normal", {
|
||||
Id = "ProggyClean.ttf",
|
||||
Font = game:HttpGet("https://raw.githubusercontent.com/tulontop/mirrorhack/refs/heads/main/fonts/proggyclean.ttf"),
|
||||
Id = font_dir .. "ProggyClean.ttf",
|
||||
Font = game:HttpGet("https://git.nfa.re/tul/mirrorhack/raw/branch/main/UI/fonts/proggyclean.ttf"),
|
||||
})
|
||||
|
||||
fonts = {
|
||||
|
||||
Reference in New Issue
Block a user