OSDev.org
https://forum.osdev.org/

Can I embed freetypes 2 in the kernel?
https://forum.osdev.org/viewtopic.php?f=1&t=36737
Page 1 of 1

Author:  mrjbom [ Sat May 02, 2020 1:26 pm ]
Post subject:  Can I embed freetypes 2 in the kernel?

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.

Author:  klange [ Sat May 02, 2020 6:20 pm ]
Post subject:  Re: Can I embed freetypes 2 in the kernel?

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).

Author:  nullplan [ Sat May 02, 2020 10:07 pm ]
Post subject:  Re: Can I embed freetypes 2 in the kernel?

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.

Author:  klange [ Sun May 03, 2020 12:30 am ]
Post subject:  Re: Can I embed freetypes 2 in the kernel?

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).

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/