About font renderers..

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
mystran

About font renderers..

Post by mystran »

I was looking at status of various projects, and noticed Clicker website says it uses Candy's font renderer, and I'm wondering, why aren't you people using Freetype, which need not depend on much of anything? Assuming ofcourse that Candy's doesn't do full truetype.

Since there is a free set of acceptable looking sans, serif and monospace fonts in truetype format (http://www.gnome.org/fonts/) available since a few years now, you might want to consider. Since the above gives you full basic set of system fonts, and having Truetype rendering out of box lets users use their own fonts, the only complication I can see is dealing with variable width fonts.

As it is, dealing with variable width fonts isn't terribly complicated, and freetype site has a nice tutorial for doing it with kerning and all. You people should take a look.

Disclaimer: I haven't tried running freetype under my own OS yet (I'm missing a few more things before I can write a video-server), but my experience from using it for a small X toolkit experiment is that it is relatively easy to hack into a anything.

Oh, about the vera fonts: They are designed to work nicely in small sizes when anti-aliased without hinting (or at least they do), so they work fine without the legally difficult opcodes, but the downside is that they don't have proper hinting to display small fonts nicely without anti-aliasing.


I'm sure you all knew this, just reminding you, 'cos it shouldn't be hard to get proper truetype rendering these days. ;)
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:About font renderers..

Post by distantvoices »

sure I know about freetype. have not yet found the time to incorporate it into my os. Need to do lots of reworking in the gui/uilib stuff.

Stay SAfe :-)
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
mystran

Re:About font renderers..

Post by mystran »

FYI, I took a look at porting Freetype to new OS.

The system dependant code is in src/base/ftsystem.c, which is a total of 303 lines long (and even that is mostly comments). Just just malloc wrappers, and simple stream-system for reading font files.

In addition to that, certain amount of OS independent standard library functions are used. They are listed in /include/freetype/config/ftstdlib.h which groups all the ISO C includes into once place, and lists defines with ft_ prefix for all the required functions, making life easy. Almost all of it is rather trivial, with sprintf, qsort, and setjmp/longjmp being the hardest to code.

I'd say that even without C library available, wrapping it would take a day or two at most. And even most kernels contain over half of the required standard library functions.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:About font renderers..

Post by Pype.Clicker »

mystran wrote: I was looking at status of various projects, and noticed Clicker website says it uses Candy's font renderer, and I'm wondering, why aren't you people using Freetype, which need not depend on much of anything? Assuming ofcourse that Candy's doesn't do full truetype.
No, candy's renderer doesn't do truetypes at all. And for the very simple reason that he kindly wrote it on request with the goal of being extremely simple.

TrueType fonts are significantly trickier to render. I mean by there you need floating math, more memory (a cache of rendered characters for given resolutions would most definitely speedup the drawing, for instance), and more processing power (rendering on QEMU may be overkill, f.i.)

That doesn't imply TTF are evils and do not belong an OS. That just means Clicker's support for graphical mode is still too young to support these (not speaking about the still-under-development support for usermode).

The question i was facing was "if there's a kernel panic while in graphical mode, can we afford using freetype ?" -- and my answer was "no: we need something KISS for that purpose".
Yet, at the time of writing, if there's a kernel panic in graphical Clicker, all you get is the screen turning to green or to red and being shifted on the right by some resolution-dependent amount, and there's noone to render fonts anyway :P
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:About font renderers..

Post by Candy »

mystran wrote: I was looking at status of various projects, and noticed Clicker website says it uses Candy's font renderer, and I'm wondering, why aren't you people using Freetype, which need not depend on much of anything? Assuming ofcourse that Candy's doesn't do full truetype.
Not even close to truetype rendering. I made it because I have a genuine preference for code that has my copyrights on it so I can't blame anybody else for bugs, and I get to understand it better. Also, imho, TrueType is a kind of really bloated format, especially including the hints. It's completely sufficient for any case, which is why I don't like it. I'd like a polygon-based format that you can prerender for display etc. One that's quick to display, not able to do all.

It's mainly the complexity I'm against. Complexity allows for tiny bugs you don't notice except for some very awkward conditions and it allows (commonly) for some form of scripting, which again commonly results in exploits being created. Just keep the complexity out of my stuff, I'll be happy then.
mystran

Re:About font renderers..

Post by mystran »

Actually, unless you are willing to accept antialiasing of small fonts, and the fuzzyness that comes with that, or really ugly fontshapes, you either need:

- hand-crafter bitmap fonts, which can't be scaled
- proper hinting

The principal reason fonts look good on systems where they look good (like Windows), is that they are properly hinted.

Vera is surprisingly readable with anti-aliasing instead of hinting, though. AFAIK, that's because hinting can't be officially part of the open desktops like Gnome (even if everybody compiles with it enabled anyway, to get Windows fonts look right), because of the patent trouble.

I don't necessarily disagree; truetype isn't the simplest possible format. But proper hinting is a good thing.

And sure you can do prerendering, at least for scripts where letter shape doesn't vary based on previous characters. ;)
mystran

Re:About font renderers..

Post by mystran »

I want to add that I do intend to have a really simple bitmap based font renderer as well, exactly for the purpose of drawing things like kernel panics on screen when the graphics code has crashed, and all I have is hopefully some linear framebuffer address and the screen width.
LongHorn

Re:About font renderers..

Post by LongHorn »

The true type fonts shall be rendered at first by any rendering engines then store the image in a bitmap format and use those fonts just like anyother bitmap fonts by that way you will have a nice looking font. This will be a temporary solution for those who are interested in truetype fonts.
If somebody could do this plz post it here. Now i am using some pd font posted by pype.
@pype: You posted font with capital letters(font 8x8) and i need corresponding small letters also.
mystran

Re:About font renderers..

Post by mystran »

Storing bitmapped versions of truetype fonts is like eating dried fruit. Sure, they are edible, but if you can have the original, what's the point.
LongHorn

Re:About font renderers..

Post by LongHorn »

Not a big deal just a temporary solution for those who are not just yet ready to incorporate freetype into their kernel. It needs a lot more services which have not yet been explored by most of us. I think so. I don't want to get trouble. I have a lot of things to worry about then adding true type support.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:About font renderers..

Post by Pype.Clicker »

LongHorn wrote: @pype: You posted font with capital letters(font 8x8) and i need corresponding small letters also.
they aren't there so far ... i mean, that font initially included pacman and ghosts, but no lowercase, nor symbols i saw no use for such as "@" or "=" ... I heard your prayer and will come with a more complete charset when spare time will come back.
mystran

Re:About font renderers..

Post by mystran »

There's 8x8 fonts in rather trivial format in linux console packages, if you just need some font. Pick a one you like, so you can deal with a real font later.. :)
Post Reply