[feat] 低质量ttf render

This commit is contained in:
2026-06-06 09:00:56 +08:00
Unverified
parent 3d47667c2f
commit 500d302ea9
15 changed files with 914 additions and 17 deletions
+11 -6
View File
@@ -1,5 +1,5 @@
CFLAGS = -Iinclude -Iefi/inc -ffreestanding -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -std=c17 -Wwrite-strings -fcf-protection=none
CXXFLAGS = -Iinclude -Iefi/inc -ffreestanding -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -maccumulate-outgoing-args -std=c++17 -Wwrite-strings -fcf-protection=none
CFLAGS = -Iinclude -Iefi/inc -ffreestanding -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -std=c17 -Wwrite-strings -fcf-protection=none -g
CXXFLAGS = -Iinclude -Iefi/inc -ffreestanding -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -maccumulate-outgoing-args -std=c++17 -Wwrite-strings -fcf-protection=none -g
LDFLAGS = -shared -Bsymbolic -Tefi/gnuefi/elf_x86_64_efi.lds
LDLIBS = --no-undefined
@@ -22,7 +22,8 @@ KERNEL_CPP = kernel/entry.cpp kernel/main.cpp kernel/serial.cpp kernel/fs.cpp \
kernel/interrupt/pic.cpp kernel/interrupt/pit.cpp \
kernel/graphics/layer.cpp \
graphics/context.cpp graphics/draw.cpp \
fonts/pixel_font.cpp
fonts/pixel_font.cpp \
fonts/ttf/ttf.cpp fonts/ttf/ttf_parse.cpp fonts/ttf/ttf_render.cpp
KERNEL_ASM = kernel/scheduler/context_switch.S kernel/interrupt/isr.S kernel/interrupt/idt_helpers.S
KERNEL_OBJ = $(KERNEL_CPP:%.cpp=build/%.o) $(KERNEL_ASM:%.S=build/%.o)
@@ -48,7 +49,7 @@ all: _bd $(EFI_OBJ) $(BOOT_OBJ) $(KERNEL_OBJ)
@echo "Done."
_bd:
@mkdir -p build/graphics build/kernel build/fonts build/kernel/memory \
@mkdir -p build/graphics build/kernel build/fonts build/fonts/ttf build/kernel/memory \
build/kernel/scheduler build/kernel/interrupt build/kernel/graphics \
build/efi/lib build/efi/lib/x86_64 build/efi/lib/runtime build/efi/gnuefi
@@ -99,7 +100,7 @@ build/kernel/scheduler/%.o: kernel/scheduler/%.cpp | _bd
build/kernel/scheduler/%.o: kernel/scheduler/%.S | _bd
@echo "Compile AS $<"
@gcc -Iinclude -Iefi/inc -ffreestanding -fno-stack-protector -fno-stack-check \
-fshort-wchar -mno-red-zone -fcf-protection=none -c $< -o $@
-fshort-wchar -mno-red-zone -fcf-protection=none -g -c $< -o $@
build/kernel/interrupt/%.o: kernel/interrupt/%.cpp | _bd
@echo "Compile CPP $<"
@@ -108,7 +109,7 @@ build/kernel/interrupt/%.o: kernel/interrupt/%.cpp | _bd
build/kernel/interrupt/%.o: kernel/interrupt/%.S | _bd
@echo "Compile AS $<"
@gcc -Iinclude -Iefi/inc -ffreestanding -fno-stack-protector -fno-stack-check \
-fshort-wchar -mno-red-zone -fcf-protection=none -c $< -o $@
-fshort-wchar -mno-red-zone -fcf-protection=none -g -c $< -o $@
build/graphics/%.o: graphics/%.cpp | _bd
@echo "Compile CPP $<"
@@ -118,6 +119,10 @@ build/fonts/%.o: fonts/%.cpp | _bd
@echo "Compile CPP $<"
@g++ $(KERNEL_CXXFLAGS) -c $< -o $@
build/fonts/ttf/%.o: fonts/ttf/%.cpp | _bd
@echo "Compile CPP $<"
@g++ $(KERNEL_CXXFLAGS) -c $< -o $@
vdir: all
@mkdir -p vdir/EFI/BOOT vdir/sys
@cp build/BOOTX64.EFI vdir/EFI/BOOT