Skip to content

Commit

Permalink
[BUILD] Use fonts from Tongue
Browse files Browse the repository at this point in the history
  • Loading branch information
PeyTy committed Dec 20, 2023
1 parent 72def30 commit 3e94f7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"njraa",
"NTDLL",
"Oleh",
"readdir",
"scanline",
"struct",
"substr",
Expand Down
13 changes: 11 additions & 2 deletions build/assets.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let deps [[String]] = [
fun packFonts(config Config) {
let fs = require('fs')
let chars [{code:Int, x:Int, y:Int, width:Float}] =
JSON.parse(fs.readFileSync('..\\Greentea\\assets\\root\\Windows\\Fonts\\default.json').toString().trim())
JSON.parse(fs.readFileSync('..\\Tongue\\fonts\\bitmap\\ascii.json').toString().trim())

let charSize = 2 + 2 + 8
let size = 256 * charSize // Just ASCII for now
Expand Down Expand Up @@ -72,31 +72,40 @@ fun packAssets(config Config) {
/// Simply list of files, used only in the build process
let assetPath [String] = []
/// Stores list of files in the folder
// TODO Hexa: hl [:ThisPart]
let folders [String:Buffer] = [:] // TODO `= []`?

// Bootloader reads this kernel file
assetName.push('tofita.exe')
assetPath.push(folder + '\\tofita.exe')

// SMP
assetName.push('trapeze.tofita')
assetPath.push(folder + '\\trapeze.bin')

// User mode libraries
for dll in dlls {
// TODO \ not werks in js assetName.push(`C:\Windows\System32\` + dll + '.dll')
// TODO \ not works in js assetName.push(`C:\Windows\System32\` + dll + '.dll')
assetName.push(`C:\\Windows\\System32\\` + dll + '.dll')
assetPath.push(folder + '\\\(dll).64.dll')

assetName.push(`C:\\Windows\\SysWOW64\\` + dll + '.dll')
assetPath.push(folder + '\\\(dll).32.dll')
}

// Fonts
packFonts(config)
assetName.push('ascii.tofita')
assetPath.push(folder + '\\ascii.tofita')
assetName.push('root/Windows/Fonts/ascii.png')
assetPath.push('..\\Tongue\\fonts\\bitmap\\ascii.png')

// TODO Hexa: hl function name cause readability is bad here
fun addFolderRecursive(path) {
if fs.existsSync(path) {
let filesList [String] = []

// Hexa: hl fun() too
fs.readdirSync(path).forEach(fun(file, index) {
let curPath = path + "\\" + file
let assetFullName = curPath.substr('../Greentea/assets/'.length).split('\\').join('/')
Expand Down
2 changes: 1 addition & 1 deletion kernel/gui/text.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fun initText() {
textFontList = textFont.data as! ArrayPointer<ByValue<TextFontList>>

var font = new RamDiskAsset()
getRamDiskAsset(font, "root/Windows/Fonts/default.png")
getRamDiskAsset(font, "root/Windows/Fonts/ascii.png")
textFontBitmap = loadPng32(font)
}

Expand Down

0 comments on commit 3e94f7c

Please sign in to comment.