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