Can I embed freetypes 2 in the kernel?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
mrjbom
Member
Member
Posts: 317
Joined: Sun Jul 21, 2019 7:34 am

Can I embed freetypes 2 in the kernel?

Post by mrjbom »

Hi.
I asked myself this question: is it possible to add freetypes 2 to the core? What dependencies are there? Has anyone done this?
Thanks.
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: Can I embed freetypes 2 in the kernel?

Post by klange »

There's no reason you couldn't embed freetype2 in your kernel... if you implemented all of the libc functions it depends on. Freetype can be built with no other dependencies than the standard library. But the real question isn't can you, but why would you want to? Why do you need TrueType text support in your kernel? Even the most ardent of monolithic kernel advocates would be hesitant to suggest having that kind of text rendering in the kernel. There's also security concerns if a user can control the fonts involved - TrueType hinting vulnerabilities were the cause of many a hack and jailbreak for everything from iOS (actually with freetype2, and several times) to the original Xbox (with Microsoft's own text rendering libraries).
nullplan
Member
Member
Posts: 1792
Joined: Wed Aug 30, 2017 8:24 am

Re: Can I embed freetypes 2 in the kernel?

Post by nullplan »

I'm a monolithic kernel guy, and I think putting freetype into your kernel is silly. Taking on that much complexity into the piece of software that is hardest to debug is bound to give you problems in the long run. I personally put my debug messages on serial console, because polling drivers for it are easy to write and very self-contained. For the screen, I shall provide access to the frame buffer with a device file, and access to input devices with event device files. This way, I get around having any virtual terminal support in my kernel, I will only provide pseudo-terminals (which are mostly about storing data), and the actual terminals can be emulated by user space. So the entire complexity of font rendering lands in userspace, where it belongs.
Carpe diem!
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: Can I embed freetypes 2 in the kernel?

Post by klange »

nullplan wrote:For the screen, I shall provide access to the frame buffer with a device file, and access to input devices with event device files. This way, I get around having any virtual terminal support in my kernel, I will only provide pseudo-terminals (which are mostly about storing data), and the actual terminals can be emulated by user space. So the entire complexity of font rendering lands in userspace, where it belongs.
Yep! I do the same. No terminal emulator in the kernel. The generic video driver has a little bitmap font renderer for visual crash messages, but all other text from the kernel is over serial (or can be redirected to a file, including a PTY, for debugging).
Post Reply