Support and General Use > Theming and Appearance Customization

Convert fnt back to bdf

(1/2) > >>

rockbox_dev123:
I already used the search function and didn't find a suitable reply e.g. https://forums.rockbox.org/index.php/topic,53334.msg246236.html#msg246236

I am maintaining a custom build of rockbox which changes the default theme. The fonts that are used, are only available in .fnt format, so the compilation process of rockbox does not detect the .bdf files and generate the .fnt files in the right directory. Because of this I am having to manually insert theme assets into the built rockbox.zip.

I would like to convert the fnt files back to bdf so that the build process converts them back to fnt.

How can I do this?

(I previously tried compiling ttf2bdf and converting the original Roboto* fonts to bdf but the results were terrible. I also tried fnt2bdf from hxtools and didn't have good results.)

bluebrother:
If you don't want to change the fonts I'd try a different approach: instead of converting them back make the build system aware of fnt files in the font folder, and instead of converting them like the bdf files simply copy them.

rockbox_dev123:
Thanks for the suggestion. After wasting lots of time trying to convert the ttf files to bdf and then to fnt only to find they still look terrible I've decided to take your suggestion  :)

wps/wpsbuild.py

--- Code: ---sub copythemefont
{
    my ($font) = @_;
    #copy the font specified by the theme

    mkdir "$tempdir/fonts";
    if (-e "${ROOT}/fonts/${font}")
    {
        #if 'font_foo.fnt' already exists, no need to convert 'font_foo.bdf' to '.fnt'
        #just copy it to the final directory.
        system("cp ${ROOT}/fonts/${font} ${tempdir}/fonts/${font}");
    }
    else
    {
        my $o =~ s/\.fnt/\.bdf/;
        system("$ROOT/tools/convbdf -f -o \"$tempdir/fonts/$_[0]\" \"$ROOT/fonts/$o\" ");
    }
}
--- End code ---

Fingers crossed this will get the job done  ;)

EDIT: updated code

rockbox_dev123:
The code above has done the job of copying the font file during
--- Code: ---make zip
--- End code ---

However, there is a final caveat.

The SBS (what does this stand for? Status Bar Screen?) defines:

--- Code: ---# Additional fonts
%Fl(2,12-Roboto-Bold.fnt)
--- End code ---

These additional fonts are not caught by wps/wpsbuild.py and are not copied or converted.

I will need to come up with a solution for this!

rockbox_dev123:
Solution found.

Inside of the WPSLIST I have defined:


--- Code: ---## This is a hack to include the additional font needed for naranjada.
## As wps/wpslist.py is incapable of including additional fonts
## referenced by a skin's .sbs/.fms/.wps files!
## wpslist.py will combine the Name of "" with ".cfg" and generate:
## .rockbox/themes/.cfg
## rockbox's theme browser doesn't list this file when browsing themes.
<theme>
Name:
Authors:
WPS: no
FMS: no
RWPS: no
SBS: no
RSBS: no

<main>
Font.320x240x(16|24): 12-Roboto-Bold.fnt
</main>
</theme>
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version