Bitbucket discussion here: https://bitbucket.org/hudson/magic-lantern/pull-request/222/added-rbf-font-support/diff
Source code here: https://bitbucket.org/g3gg0/magic-lantern-rbf
If you don't see major issues (like significant slowdown, much higher memory usage, completely unreadable fonts on some displays, or everybody likes the old fonts), I'd say it can be merged (and g3gg0 said the same).
History:
[aug26] stevefal suggests (http://www.magiclantern.fm/forum/index.php?topic=7889.msg70467#msg70467) (once again) to use proportional fonts.
[sep03] g3gg0 ported RBF font format from CHDK.
[sep07] proportional fonts are already usable (of course, ther's still a bunch of things to fine-tune)
Screenshots (may change, since stevefal is still fine-tuning the fonts)
(http://a1ex.magiclantern.fm/bleeding-edge/newfont.png)
New printing API:
Centered text (example from spotmeter):
bmp_printf(
fnt | FONT_ALIGN_CENTER,
xcb, ycb,
"#%02x%02x%02x",
R,G,B
);
Right-aligned text, clipped if it exceeds some maximum width (example from module name in Modules tab):
int fg = COLOR_GRAY(40);
int bg = COLOR_BLACK;
int fnt = SHADOW_FONT(FONT(FONT_MED, fg, bg));
bmp_printf(fnt | FONT_ALIGN_RIGHT | FONT_TEXT_WIDTH(300), 690, info->y+5, name);
Justified text with manual line breaking (example from module README):
big_bmp_printf(FONT_MED | FONT_ALIGN_JUSTIFIED | FONT_TEXT_WIDTH(690), 10, 60, "%s", desc);
Special characters (ISO, small 1/ or f/, degree symbol)
bmp_printf( font, x, y,"T=%d"SYM_DEGREE"C", EFIC_CELSIUS);
-bmp_printf(..., "ISO %d 1/%d f/%d.%d %dK", iso, shutter, aperture, kelvin)
+bmp_printf(..., SYM_ISO"%d "SYM_1_SLASH"%d "SYM_F_SLASH"%d.%d %dK", iso, shutter, aperture, kelvin
#define SYM_DOTS "\x7F"
#define SYM_ISO "\x80"
#define SYM_F_SLASH "\x81"
#define SYM_1_SLASH "\x82"
#define SYM_DEGREE "\x83"
#define SYM_MICRO "\x84" /* maybe not needed */
#define SYM_PLUSMINUS "\x85"
#define SYM_LV "\x86"
#define SYM_BULLET "\x87"
#define SYM_EM_DASH "\x88"
Expanded/condensed text (not yet implemented):
FONT_EXPAND(x) /* range: -4 ... +3 pixels per character */
Quote from: a1ex on September 07, 2013, 11:51:30 AM
Bitbucket discussion here
You suggested to "drop that codepage stuff, since I don't see localization anytime soon (maintenance nightmare)". I dunno about the string localization discussion, as some of the ideas in the respective thread seem very practical and reasonable to me - but barring that way for the future now when a new feature like proportional fonts is introduced, is adding codepages really that much of an overhead in itself?
You can undo that changeset later if you really want.
Idea to have bmp_printf return the height & width of string printed, in order to help horizontal and vertical arrangement of of elements without hard-coded offsets.
Likewise bmp_printf_get_size, in order to compute string sizes offscreen, before printing - for centering etc.
This should be handy when proportional fonts are introduced. When used, it will aide swapping fonts without lots of manual fix-ups. It should also help implement layout changes without as much trial and error.
Code is now in the main repo.
Please look for redraw issues (like unreadable text or things looking funny) and post screenshots.
Quote from: a1ex on September 19, 2013, 09:58:38 AM
Code is now in the main repo.
Please look for redraw issues (like unreadable text or things looking funny) and post screenshots.
I compiled but during camera boot there is some unreadable message about fonts.. I suppose I need new stuff for the ML directory. I have never generated that other stuff like data, docs, etc.
Is there a thread explaining this procedure?
Did you run "make install" or try the nightly?
Quote from: a1ex on September 19, 2013, 05:14:58 PM
Did you run "make install" or try the nightly?
Thanks, I got it working with the ML structure files from nightly!
I still need to learn the make install stuff! :o
Quote from: a1ex on September 19, 2013, 09:58:38 AM
Code is now in the main repo.
Great work, looks good and as a space saver solves the char counting in the menu :-)
One suggestion: If you've got access to the Canon font, any messages which are usually short on the lv screen should also be in the Canon font for a more coherent experience.
Quote from: RenatoPhoto on September 19, 2013, 05:11:31 PM
I compiled but during camera boot there is some unreadable message about fonts..
You just need to copy the "fonts" dir from the source root to the card to ml/fonts
Now that we're fairly settled on the small(23), medium(28) and large(32) sizes, I'll go through and refine all of them. Here's the first:
Argand Normal 32 v.51 http://popspring.com/mldrop/argnor32.rbf
- Improved 389aABghWXKPRUIryzijkn<>+-^™
- Added '×' symbol to use instead of 'x' in dimensions
@stevefal - Thanks for your work! The new fonts are looking really good on the 50D :)
Quote from: Andy600 on September 20, 2013, 03:18:07 AM
@stevefal - Thanks for your work! The new fonts are looking really good on the 50D :)
With the new fonts it feels like having Magic Lantern 3.0 :D
Fonts look classy. Love em! THANKS!!!!!!!!!!!!! 8)
Quote from: glubber
With the new fonts it feels like having Magic Lantern 3.0 :D
Agree, looks great!!
Thanks to g3gg0 and a1ex for implementing support for new fonts.
Tested on 5D mkII: good job, it's more clear and a bit bigger (easer to read). 8)
Updates:
Argand Normal 32 v.52 http://popspring.com/mldrop/argnor32.rbf
- Improved cge%$
- Added mm cm
- Removed long dash
Argand Normal 28 v.52 http://popspring.com/mldrop/argnor28.rbf
- Improved mm cm PBZ:"$'!()abdpqyglv02345
- Added '×'
running sep 20th on 5d3 and loving the new fonts!!!!!!! AWESOME!!!!!! Thank you for giving me a brand new 5d3!!!!
tried on my 7d... works and looks great, but had to disable all modules, and when i enable the raw_rec module it shows a memory error in the debug menu: Last error: 4 at libtcc.c:222, task module_task
maybe there is something on the memory refactoring thing that needs to be ported or fixed for the 7d
I'm getting the same error as britom on my 60D, it also doesn't seem to matter which modules are loaded, load any module and this happens. Though everything seems to work fine. (compiled myself from changeset 4b3129d)
(error, sorry)
Updates:
Argand Normal 32 v.53 http://popspring.com/mldrop/argnor32.rbf
Argand Normal 28 v.53 http://popspring.com/mldrop/argnor28.rbf
replaced mm and cm symbols with small 'c' and 'm' characters with tight spacing, combinable to create small mm, cm, and m symbols in bottombar etc.
Quote from: britom on September 21, 2013, 08:07:35 AM
tried on my 7d... works and looks great, but had to disable all modules, and when i enable the raw_rec module it shows a memory error in the debug menu: Last error: 4 at libtcc.c:222, task module_task
Same thing on my 60d - and in addition live view craps out after some time with an err 80 which might be a hardware problem on my side, but then again it might not and ml is to blame (I didn't try reverting to an older build yet to debug).
Updates:
Argand Normal 32 v.54 http://popspring.com/mldrop/argnor32.rbf
Argand Normal 28 v.54 http://popspring.com/mldrop/argnor28.rbf
- tapered f/, 1/
- kerning revelation
Argand Normal 23 v.53 http://popspring.com/mldrop/argnor23.rbf
- complete revision
- new stroke contrast
- new kerning
New font for menu title:
Argand Normal 36 v.50 http://popspring.com/mldrop/argnor36.rbf
Note that all four fonts have been updated relative to the current build.
Quote from: stevefal on September 24, 2013, 03:38:51 AM
New font for menu title
... I just have to mention it again: Great work, stevefal, as far as I remember something about typography creating these is a really difficult job and they look excellent :-) !
Glad you're liking them :)
The small font (help text) is very difficult to read on the 1100D:
(https://bitbucket.org/dmilligan/magic-lantern/downloads/1100D_screenshot.jpg)
(I had to photograph the screen b/c screenshot was crashing the camera)
Bummer. Looks like nearest-neighbor reductions and single-pixel strokes getting lost. The new stroke contrast is what makes the font nice at 720x480. Not sure which solution is best:
- Tweak the font so all horizontal strokes are only on every other line. Yuck.
- Have no stroke contrast - 2 pixels horizontal and vertical. Yuck again. That's why it looked clunky before.
- Have an alternate 2x2 font for low-res cameras
- I assume that rendering the font using interpolation is out of the question because it would require an alpha channel to render correctly against dynamic backgrounds.
- Vertical bolding might work - render once and again with a 1-pixel vertical offset. This will ensure that every horizontal stroke is seen, but with some artifacts. In all cases though, text rendering should be on either all even or all odd lines, since each produces a different decimated result. For example, look at "e" in menuitems 1 versus 2, and in help1 vs help2.
For 1100D, you can design the font at half resolution (in both directions) and then double all the pixels. This is the cleanest solution IMO.
Going along with that, isn't the cleanest to create an 11 pixel font and render it 1:1 on 1100D?
The proportional fonts make the menus so much quicker to read. Really nice when you're under pressure and shooting in changing circumstances. It's more than just eye-candy.
(Canon 5d3)
Quote from: stevefal on September 27, 2013, 10:08:09 AM
Going along with that, isn't the cleanest to create an 11 pixel font and render it 1:1 on 1100D?
Yes, this will use less RAM too. Caveat: if we do that, *all* fonts should be re-designed for half res (not only the small ones), because I'd like to keep only one font drawing routine (either normal or with pixel doubling).
I'm not exactly clear what you mean. Are you saying design a set of 4 new fonts for only 1100D, and only it has special font rendering code?
Yes, design them at half resolution (half size), and ML code will draw them by doubling the pixels.
Or, design them with doubled pixels from the beginning, and this will work with existing code.
Your choice.
This will render at half-size without missing strokes. It is not a doubled font, but any rendered string will be self-consistent and readable regardless of original position at 480p. This is meant only for 1100D or other 240p displays.
Argand Half 22 v.50 http://popspring.com/mldrop/arghlf22.rbf
(http://i.imgur.com/Ol5PxA5.gif)
Cool idea, like the animation.
A doubled font should look exactly the same regardless of the exact offset IMO, but this trick works well too.
Looks great!
(https://bitbucket.org/dmilligan/magic-lantern/downloads/1100D_ss_2.jpg)
QuoteA doubled font should look exactly the same regardless of the exact offset IMO...
That's right. I started one, but to draw it manually is very laborious because every single boundary needs to be a multiple of two - cells, strokes, gaps, kerning. The rbf editor doesn't have any tools to make that convenient, besides the grid.
But given that this is a replacement and uses standard rendering, the font can be revised with perfect doubling, and it will still work, only better.
@dmilligan, you can see that the two help lines start on different fields. That's why one looks tall and one short. If you move either line one pixel higher or lower, both lines will look the same.
I imagine, especially it's very easy to have 5 pixels instead of 4 and not notice it.
Can you design the font at half size? I can try to double the pixels from code.
Do you mean double it in ML, or in RBF editor? If you could halve a font in RBF-editor, we could halve the font I just made, I could go in and do fix-up, then we could double it again.
And that process could work for all the fonts. Fix-up is way, way, way easier than starting from scratch.
Got it, going to try.
If so, keep in mind that halving can have four outcomes, depending on whether the font starts offset 0, +1H, +1V or +1H+1V. Ideally I could pick any of the four to start with, because they look quite different. For example, I would cherry-pick from #1 and #2 below:
(http://i.imgur.com/hiZk2I6.png)
OK, here are the 4 versions:
http://a1ex.magiclantern.fm/bleeding-edge/arg11.zip
and also 4 versions of Argand 16 downsampled from 32:
http://a1ex.magiclantern.fm/bleeding-edge/arg16.zip
and also 4 versions of Terminus 10 downsampled from 20 (e.g. for console and other things that are best monospaced):
http://a1ex.magiclantern.fm/bleeding-edge/ter10.zip
Great, the fix-up was quick. Not many pixels to start with!
Argand Normal 11 v.50 - http://popspring.com/mldrop/argnor11.rbf
This 11 pixel font is of course usable as well :)
Now if you can double it, it will be the new Argand Half 22 v.51
It's 1:30am here, so I'm going to stop for now and pick this up later. I can do all of them eventually.
Update:
Argand Normal 11 v.51 - http://popspring.com/mldrop/argnor11.rbf
tweaked 'e'
Quote from: stevefal on September 28, 2013, 10:40:11 AM
It's 1:30am here, so I'm going to stop for now and pick this up later.
Just 1:30? Where's you're dedication and loyalty, man :-p ... no, really, thanks again and great work, don't overdo it, this must have been a lot of work and the new fonts arriving a few days or weeks sooner or later aren't critical, though very nice :-)
One question: Do these fonts have hintings, i.e. should we write things like "The A has too much space next to the v"?
Doubled:
http://a1ex.magiclantern.fm/bleeding-edge/arghlf22.rbf (Argand Half 22 v.51)
This font file format doesn't have kerning support (hinting is something else). A kerning table would take 128x128 = 16K of RAM for O(1) lookup; if you store an array of (char1,char2,kerning) it may take less space, but printing may slow down a bit. Worth the extra trouble?
Edit: you can already try the new font in the 1100D nightly build.
A kerning table would enable improvements, but i don't personally think it's worth it. I've tuned each font's fixed kerning at least as much as character spacing accounts for area to the right of each figure, within the cell. For example, a 'B' has more space to the right than 'W' or 'C'. Tuning discreet pairs or groups would be a lot of work.
QuoteDo these fonts have hintings, i.e. should we write things like "The A has too much space next to the v"?
That's an example of a case that requires for more advanced kerning. The v could have less space on both sides, but not always, or vv would look like w. There are lots of examples like this.
QuoteOK, here are the 4 versions:
Can you make downsampled 28 and 36 too?
New:
Argand Normal 16 v.50: http://popspring.com/mldrop/argnor16.rbf
This should be suitable for doubling for Argand Half 32 v.50 (agrhlf32.rbf).
New:
Terminus Normal 10 v.50: http://popspring.com/mldrop/ternor10.rbf
This should be suitable for doubling for Terminus Half 20 v.50 (terhlf20.rbf).
It is not totally faithful to the Terminus style - not enough pixels. Also some characters are wider than others, but the cells are still monospaced. You'll have to see if it's ok.
i am just changing top/bottom bars and miss the infinity symbol.
can you add the it too?
http://www.decodeunicode.org/de/u+221e
thanks
Updates with infinity symbol:
Argand Normal 11 v.52: http://popspring.com/mldrop/argnor11.rbf
Argand Normal 16 v.51: http://popspring.com/mldrop/argnor16.rbf
Argand Normal 23 v.54: http://popspring.com/mldrop/argnor23.rbf
Argand Normal 28 v.55: http://popspring.com/mldrop/argnor28.rbf
Argand Normal 32 v.55: http://popspring.com/mldrop/argnor32.rbf
Argand Normal 36 v.51: http://popspring.com/mldrop/argnor36.rbf
Argand Half 22 v.52: http://popspring.com/mldrop/arghlf22.rbf
Added ETTR and DR symbols:
Argand Normal 28 v.56 (https://bitbucket.org/hudson/magic-lantern/src/c308b64db725eff41f6ca14c094d9b69cb4c788b/data/fonts/argnor28.rbf?at=unified)
@a1ex, can you please generate the downsampled 28 and 36 fonts, so I can complete all the work for low-res displays?
Also, could you allocate up to row a0 in all Argand font files so I have room to create more icons? I use empty cells for proposals and for iterating characters/icons in progress. We can trim things down as necessary when things wind down (hah, do things ever wind down?)