Another utility for RBF fonts - General Discussion and Assistance - CHDK Forum  

Another utility for RBF fonts

  • 2 Replies
  • 4671 Views
*

Offline srsa_4c

  • ******
  • 4451
Another utility for RBF fonts
« on: 04 / April / 2016, 16:45:30 »
Advertisements
I intended to update the "well known" REB font editor originally. Spent many hours converting its PyQt3-based code to PyQt4, and slowly managed to start it with half-broken GUI. Then I stumbled into problems that made me give up with the conversion - first, image handling significantly changed in PyQt4, second, the maintained fork of the imaging library it used (PIL) also changed a little - enough to screw up the font rasterization parts of the code.
Though that editor is open source, there was no information about making a Windows executable from the source. I found out the probable reason: the Windows release of PyQt v3 was not open source, and it is no longer available.

I then started to make a utility that could provide similar functionality (and more...). It's written in Lazarus / Free Pascal and compiled for Win32 (I'm using it with Wine).
It does not look like the other editor and there's no documentation for it at this time.
Source is available on request (I'll publish that once it gets in a better shape).

***

RBF FontMaker

The program needs the included freetype-6.dll in order to function. Other win32 freetype dlls can also be used (if compiled by gcc), but the name must match.

Bugs:
Probably.

Issues:
- On Windows, don't try to use the freetype import method on the Windows Fonts folder. It will likely not work. If you need a font from there, copy it elsewhere.
- Glyphs of some fonts are cropped incorrectly and may not show up at all.
- The "sys" import method only allows 8 bit fonts for now. Size of fonts imported via this method depends on the system's DPI setting.
- The listview control that shows the RBF characters is ugly and buggy - changing row height could only be done by changing its font height.
- Font glyphs are not cached, drawing a big amount of them (such as preview on the "Font table" tab) takes time.
- When importing bitmap fonts, do not adjust "points" on the Freetype import tab.
- There's no 'undo'.

This is very likely not a "final" release. Let's call it "freeware" for now.

Virustotal links for the included binaries:
dll https://www.virustotal.com/en/file/ac47df645b722abb665f4b4afc1eeb158096eaca665b7fe19f6ea249306b1fc6/analysis/1459730896/
exe https://www.virustotal.com/en/file/b04d17f5c12e96cdee3223801ccee95ebb78142640bc0d841d1b40b483f0bb79/analysis/1461347345/


edit:
links
« Last Edit: 22 / April / 2016, 14:03:18 by srsa_4c »

*

Offline srsa_4c

  • ******
  • 4451
Re: Another utility for RBF fonts
« Reply #1 on: 04 / April / 2016, 16:56:09 »
Workflow for making a CHDK built-in font

Import (Freetype) -> [select unicode monospace font] -> <Open>
adjust 'points', enable create unicode font, enable use custom set of characters (paste char code list in edit box)
<Import!>
review generated bitmaps, verify width and height (a CHDK built-in font has to fit in 8x16 pixels)
if wrong size -> back to "Freetype import" tab, adjust settings, <Import!>
if too ugly -> adjust size, <Import!> -> some vector fonts are just too ugly when rasterized at 1 bit bitdepth

if monospace font has few wider and/or missing glyphs -> adjust them (Character Editor tab)
a _single glyph_ can be copied to clipboard and later pasted to replace one or more selected chars (Font table tab -> Font settings tab -> Operation on selected chars -> ...)

if there were wider glyphs, font needs fixing:
Font table tab -> Font settings tab -> Font width limit (8) -> Font operation -> Make fixed width font
followed by
Font table tab -> Font settings tab -> Font operation -> Optimize storage if possible

if font is higher than 16 pixels:
Font table tab -> Font settings tab -> Font operation -> Decrease height by 1 (only do this if Font table tab -> Font properties shows unused row(s) at bottom)

Font table tab -> Font properties should now show
font height 16, char length 16 bytes

File -> Save as -> new8x16unicode.rbf in this example

rbf2chdkfont new8x16unicode.rbf out.txt

out.txt can be used to replace the old content of orig_font_data[] array in font_8x16_uni.h

"char code list" is comprised of the content of tables in lib/font/codepages.h (cp_common, cp_win_1250, cp_win_1251, cp_win_1252, cp_win_1253, cp_win_1254, cp_win_1257)
its format is: decimal or hexadecimal numbers separated by whitespace and/or newline chars

Attached is:
- chdkallchars.txt: the content of this file can be used as the "custom set" mentioned above
- chdkfont2rbf.7z: rbf2chdkfont.c and chdkfont2rbf.c command line utilities
chdkfont2rbf.c also needs lib/font/font_8x16_uni.h
compilation:
gcc -o rbf2chdkfont.exe rbf2chdkfont.c
gcc -o chdkfont2rbf.exe chdkfont2rbf.c
I'm not including executables as the potential user has to be able to compile CHDK too.
« Last Edit: 04 / April / 2016, 17:01:49 by srsa_4c »

*

Offline srsa_4c

  • ******
  • 4451
Re: Another utility for RBF fonts
« Reply #2 on: 05 / April / 2016, 16:48:41 »
rbffm updated (first post).

The vertical placement / cropping problems (when importing vector fonts using FreeType) should be gone.

edit:
Updated again. Added a few statistics-like features, 8 bit RBF files will no longer include the nonstandard character-ID table at their end.
« Last Edit: 22 / April / 2016, 14:03:47 by srsa_4c »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal