This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#8961 - Anti-Aliased Fonts
|
DetailsScorche had confirmed in http://forums.rockbox.org/index.php?topic=16612.0 that it was OK to post this patch.
The primary bug that I have noticed is that the line selector's height appears to be bigger than it should be. Thomas Martitz (kugel.) and I had spent a day testing convfnt (where the problem is) and could find a completely working solution. Another bug is some fonts (such as http://rbthemes.com/fonts/saved/Matttsro_15.aa.fnt) have issues with some characters, such as G and J in Matttsro. In case there's any confusion, anti-alias_fonts.patch is added to the build to allow AA fonts to be used, while convttf is the program to convert the fonts (with Makefile_convttf being used to compile convttf). |
This task depends upon
There're indeed some glitches. For example, FreeSans has some issues with the slash.
Some times glitches disappear with changing the font size.
But, the important thing: I couldn't find any backdraw regarding non-anti-aliased fonts. I couldn't notice any slow downs or something. Also, the rendering of AAF feels like being equally fast.
PS: I remember jott told, that he optimized the the font rendering of the classic fonts a bit too with this patch.
But it does't work well for most Japanese fonts.
I fixed the problems for converting 2byte fonts and so on.
It has been able to deal with most fonts.
I add a usage for ttc(true type collection) then.(A TTC file is a collection of TTFs)
Additional part of Usage:
-c N Character separation in pixel.Insert space between characters
-r N Row separation in pixel.Insert space between lines.
following option is for TTC fonts.
-tt Display the True Type Collection tables available in the font
-t N Index of internal font index of true type collection.
It must be start from 0.(default N=0).
-ta Convert all fonts in ttc
"-o output-file" specified is ignored when "-ta" is specified.
Could anybody polish out the source and usage?
I altered the method of deciding the width of the character for some fonts.
(I use "face->glyph->bitmap.pitch" instead of "face->glyph->metrics.horiAdvance >> 6" for some free fonts.)
But I apologize its influencing some font and
altered the "method of deciding the width" AS SAME AS FORMER.
But I 'll pick out other method sometime soon for Both fonts.
I compiled it using Makefile attached in the first post. The resulting fonts are 10x bigger than the ones which I get with the very first converter. Also, they show nothing (no glyphs) on my target and pixel garbage on the sim.
Do I need to compile it in some special way?
I want to try it recently. What font are you converting? Please tell me one of them.
You don't need any special way.
(I downloaded it form ftp://ftp.mplayerhq.hu/MPlayer/contrib/fonts/arialuni.ttf.bz2)
Please try to use otf2bdf if you could. Arialuni has 38911 glyphs.
Third version I upload output 38906.(Because that throw away some fonts which has zero-width)
First version seems output 51031 gyphs but output many many empty glyph and can't output all-glyphs.
I sent you mail desription of them.
"make -f Makefile_convttf"
then
"./convttf Vera.ttf"
The resulting file is ~20KB big with the first version of the converter, the filesize using your versions is above 200KB.
on my platform,
1st version version output those file
comic_15_[4bpp].fnt 55.71KB
arialuni_15_[4bpp].fnt 8.74MB
arial_15_[4bpp].fnt 179.05KB
and 3rd version output those file
comic_15_[4bpp].fnt 248.39KB
arialuni_15_[4bpp].fnt 6.58MB
arial_15_[4bpp].fnt 442.18KB
(I don't have Vera.ttf font and File Size according to each platform maybe)
Because of the difference in each file size between 1st and 3rd version
is that 1st version losses some glyph always. I will prove that.
You can see the fact through following action.
I just added SAME outputting-log-code to both versions.(1st and 3rd)
to prove it.
(off course, you need to rename those file into convttf.c to build them yourself)
These program output log files like following that.
example.
------------------------------------------------
Filename:arialuni_15_[4bpp].log (add ".log" to fnt base name)
contents:
code=0 size = 120
code=1 size = 240
code=2 size = 360
------------------------------------------------
for confirming if whether the font is created correctly.
example.:
------------------------------------------------
Filename:arialuni_15_[4bpp].log.txt (add ".log" to input file)
contents:(it'll be encoded in UTF8)
Code=0x20(32) Character=" " FontBitSize=48
Code=0x21(33) Character="!" FontBitSize=96
Code=0x22(34) Character=""" FontBitSize=156
------------------------------------------------
(of. Code means character code)
and read "*.log.txt" Log2CheckFile created .
You can see how 1st version lost glyph.
While you test that, need to change your "default code page" to "UTF-8".
By the way you can describe "-s" and "-l" options
if you want to font size more decrease.
If you only use English character and don't need any Greek and special symbol and foreign character,
I recommend that you use 3rd version and describe "-s 32 -l 255" options at first
You may decrease font size.
I can effort to explain the further cause if you need and will fix any bug found.
The problem is, that the fonts I get with your converter don't work.
All of fonts don't work don't they? Could you try it on your device?
from "-O -ansi -Wall -g"
to "-O -Wall -g"
I don't change "anti-alias_fonts.patch"
It's based on the 10th August version, which yields best results imo.
Whick, it would be very nice, if you could also look into the height deciding too. The fonts vary very much in the line height. The glyphs seem to be equally high, but the line height varies (i.e. the selection bar is bigger). This means, with e.g. FreeSans (13px) I get 10 lines on a certain theme, while Nimbus Sans L (13px) only gives 8. There's a noticeable space between the lines using Nimbus Sans L, while the space between the lines is almost non-existing using FreeSans.
I think really so. But you'd better stop modifying the height.
Please read attached text-files encoded in UTF8 and find following line.by your editor and each font.
Don't fogot to set "default codepage" or "encoding setting" of your editor to "UTF8".
Code=0x162(354) Character="Ţ"
Code=0x164(356) Character="Ť"
Code=0x174(372) Character="Ŵ"
Code=0x160(352) Character="Š"
Code=0x192(402) Character="ƒ"
Umlaut letters and some simbolic characters need enough height.
By the way,did you make your Vera.fnt from Vera.ttf as same as
being able to be downloaded from following site?
http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/
It doesn't seems too high for me but comic.fnt seems too high!
A way to modify the height is
finding max top line and min bottom line of selected fonts dynamically
(only if "-s" or "-l" options are described?)
Other way is describe "-r" option and set munus value though I didn't try to set munus value.
Ah, "min bottom line" and "min bottom" line isn't correctly expression. But I expect you of understanding it.
I'll try to delete noticeable and extra space in this Text-file.
"export_font.header.height = (face->size->metrics.ascender - face->size->metrics.descender + (2 << 6)) >> 6;"
I think this coce " + (2 << 6)" to create space is not necessary still now.
That's why users can describe "-r" option for now if the space increasing between lines IS necessary.
I delete above code to create space and modify usage-string (for default output filename).
Could you modify usage more naturally please.
But this modification is quite not enough, you know.
Kugel, I think I 've done. Do you mind if I ask to confirm it?
I altered the way of diciding height of each characters selected by -s, -l option.
and fixed bug about line height.
You can see it if you compare outputs from these command line.
(A) ./convttf -s 32 -l 128 -o comic_alnum_15.fnt comic.ttf
gotten with this version.( options to create alphabet , number ,and some symbolic characters)
(B) ./convttf -o comic_15.fnt comic.ttf
gotten with this version
(C) ./convttf -o comic_old_15.fnt comic.ttf
gotten with old version
(D) ./convttf -r -4 -o comic_minus_15.fnt comic.ttf
gotten with this version
"-r 4" option adds 2 extra space(pixelline) at the bottom
and adds 2 extra space(pixelline) at the top
"-r -4" option CUTS 2 pixelline from fonts area from the top
and cuts 2 pixelline from fonts area from the bottom.
> I can't compile atm. I cannot confirm until sunday.
no matter when if you will do.
Attached is a screenshot of the text input plugin, the problem is really obvious here.
mpegplayer flips the display for portrait targets. Thus, font rendering is also flipped. The issue is, that mpegplayer re-implements the font drawing so it's flipped (it's not using the internal function). Of course it only reimplemented mono-font rendering.
This means: alpha font rendering needs to be re-implemented for the mpegplayer too.
cc -O -ansi -Wall -g convttf.c -o convttf `freetype-config --libs` `freetype-config --cflags`
/tmp/cctYDAcX.o: In function `convttf':
/home/###/Projects/rockbox/tools/convttf/convttf.c:605: undefined reference to `floor'
collect2: ld returned 1 exit status
make: *** [convttf] Error 1