Page 1 of 7

Font library (Rasterworks)

Posted: Sun Jul 19, 2015 12:44 pm
by hidnplayr
For the development of a native KolibriOS web browser, I'm in need of a proper font library.

Minimum requirements:
  • Function to draw text in 24bpp image buffer (but preferably, also support for 32bpp)
    Function that provides text width (in pixels) of a given string (to compute line wraps).
    UTF-8 text support.
    One or more Unicode font(s) with at least Latin and Cyrillic characters. It must fit on the floppy, so preferably less then 100 kilobyte.
    The font must be scalable.
    Support for regular, bold and italic typeface, underline and strike-through.
    The library must be a native KolibriOS library (MS COFF), with open source code (GPL) written in FASM.
    Acceptable speed. (At least, ten times faster then the truetype library written in C.)
Rewards:
  • 100 Euro sponsored by myself. (Preferred delivery via PayPal, but open for discussion.)
    Eternal fame.

Re: Wanted: Font library

Posted: Sun Jul 19, 2015 1:06 pm
by Pathoswithin
Are you going to develop web browser? Soon, the system fonts might fit most of requirements...

Re: Wanted: Font library

Posted: Sun Jul 19, 2015 1:22 pm
by hidnplayr
Pathoswithin wrote:Are you going to develop web browser? Soon, the system fonts might fit most of requirements...
I have been developing it on and off for some time now.
You can find some screenshots here. I have some free time coming up and would like to get this project to the 'usable' state.

It is important for me that drawing text happens fast, in the off-screen buffer. (A library with the font loaded in shared memory.)
Putting this in kernel is not a good idea IMHO.

PS: 'most' of the requirements is not enough to earn my money :wink:

Re: Wanted: Font library

Posted: Mon Jul 20, 2015 10:39 am
by Pathoswithin
Its not about money, its about what you can use (not many programmers here, you know), I am doing it anyway:
1. Fast 32bpp buffer output.
2. Integer scaling.
3. ClearType for not scaled.
+
4. About those raster unicode fonts, what format they have?
5. I think, I can manage free scaling, bold and italic program effects as outer library.

Re: Wanted: Font library

Posted: Mon Jul 20, 2015 11:16 am
by hidnplayr
this free font is distributed in BDF format.
According to wikipedia, it's a font format by adobe.
Of course, it can be converted to whatever format suits best.

This font is not 'scalable' and thus comes in many sizes (which can not all fit on the floppy).
But I think that one font size + your AEB scaling algorithm will give acceptable results.

Forum user Seppe has done some work on unicode rasterfonts as well, but the resulting font files are too big for the main image..
viewtopic.php?f=23&t=2771

Re: Wanted: Font library

Posted: Tue Jul 21, 2015 2:15 pm
by Pathoswithin
I wander, what format those urf have? Under HEX looks like there are some service symbols, so their size is far from minimal. BDF format is very similar to our, the only problem is to restore right char order. How many unicode symbols you need? Can Seppe provide some developments to recompile BDF/urf?

Re: Wanted: Font library

Posted: Tue Jul 21, 2015 4:48 pm
by hidnplayr
Urf format (1 and 2) specifications can be found on his ftp folder.

Re: Wanted: Font library

Posted: Tue Jul 21, 2015 9:02 pm
by Pathoswithin
I found it, at last. Now I can... Oh shi
Looks like Seppe knows how to make things... more complex, and more violent. BDF than.
So, there is nothing better than uw-ttyp0? Final decision? Which size than? Current system font is 9 x(5+1), x2 will be 18 x(10+2). So we need something intermediate, but these have different proportions: 12 x(5+1) — 18 x(8+1)

Re: Wanted: Font library

Posted: Tue Jul 21, 2015 9:42 pm
by hidnplayr
Advantage of uw-ttyp0 is that it's readily available in easy to convert format. Disadvantage is that it's monospaced (harder to read) and not every unicode character is available.

What I had in mind is some basic bitmap font (lets say 12 pixels in height) that can be scaled using AEB (be it on the fly, or pre-buffered).
I could also ask Seppe for the raw bitmaps he captured from an open truetype font.

Re: Wanted: Font library

Posted: Wed Jul 22, 2015 12:06 am
by Leency
For me 12 is too small.
Maybe 14 or 16 height?

Here is an example of 16 height fonts.

Re: Wanted: Font library

Posted: Wed Jul 22, 2015 12:16 am
by hidnplayr
Well, it all depends how good a 12 scales to a 14 or 16..
Your example looks too high (or maybe just too fat) for me, but I must admit, my default font in browser is "Times new roman" at size 16.

Re: Wanted: Font library

Posted: Thu Jul 23, 2015 8:26 pm
by Pathoswithin
So, you need Unicode font with characters from cp1251 and cp1252? Some characters will be about № 2xxx, right? So there will gaps in the font anyway? I need to imagine the font map. And, which characters should be 128 — 255?

Re: Wanted: Font library

Posted: Thu Jul 23, 2015 8:46 pm
by hidnplayr
Latest Unicode revisions have more then 100 000 characters, it would be insane to implement all of them, don't you think?
We must make a selection of most needed characters, so there must indeed be gaps in the font, and preferably not just kilobytes of 0's ;)
Codepoints 128 to 255 in unicode are called the "latin supplement block" (https://en.wikipedia.org/wiki/Latin-1_S ... e_block%29)

EDIT: What I want is probably more accurately described as "Latin and Cyrillic unicode blocks". eg "rows" 00, 01 and 04.
See https://en.wikipedia.org/wiki/Unicode#S ... ed_subsets

Re: Wanted: Font library

Posted: Thu Jul 23, 2015 9:16 pm
by Pathoswithin
So 128 to 255 will be same as ISO-8859-1? And what about "General Punctuation (2000–206F)" (presents in cp1251 and cp1252)?

Re: Wanted: Font library

Posted: Thu Jul 23, 2015 9:50 pm
by hidnplayr
Pathoswithin: The whole point of Unicode is assigning an unique code to every possible character. This certain region may resemble ISO-8859-1 but it is not exactly the same.
Better to forget all about codepages and think unicode instead: http://unicode.org/charts/

What about "general punctuation"? Do we need it?