Proportional fonts

Started by a1ex, September 07, 2013, 11:51:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

a1ex

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 (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)


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 */


Marsu42

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?

a1ex

You can undo that changeset later if you really want.

stevefal

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.
Steve Falcon

a1ex

Code is now in the main repo.

Please look for redraw issues (like unreadable text or things looking funny) and post screenshots.

RenatoPhoto

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?
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

a1ex

Did you run "make install" or try the nightly?

RenatoPhoto

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
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

Marsu42

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

stevefal

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
Steve Falcon

Andy600

@stevefal - Thanks for your work! The new fonts are looking really good on the 50D  :)
Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

glubber

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
EOS 550D // Sigma 18-200 // Sigma 18-70 // Canon 10-18 STM

Stedda

Fonts look classy. Love em! THANKS!!!!!!!!!!!!!  8)
5D Mark III -- 7D   SOLD -- EOS M 22mm 18-55mm STM -- Fuji X-T1 18-55 F2.8-F4 & 35 F1.4
Canon Glass   100L F2.8 IS -- 70-200L F4 -- 135L F2 -- 85 F1.8 -- 17-40L --  40 F2.8 -- 35 F2 IS  Sigma Glass  120-300 F2.8 OS -- 50 F1.4 -- 85 F1.4  Tamron Glass   24-70 2.8 VC   600EX-RT X3

LucaBrasi


Quote from: glubber
With the new fonts it feels like having Magic Lantern 3.0  :D

Agree, looks great!!

stevefal

Thanks to g3gg0 and a1ex for implementing support for new fonts.
Steve Falcon

SpcCb

Tested on 5D mkII: good job, it's more clear and a bit bigger (easer to read). 8)

stevefal

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 '×'
Steve Falcon

hjfilmspeed

running sep 20th on 5d3 and loving the new fonts!!!!!!! AWESOME!!!!!! Thank you for giving me a brand new 5d3!!!!

britom

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
7D Builds with RAW support: http://bit.ly/14Llzda

dmilligan

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)

SpcCb


stevefal

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.
Steve Falcon

Marsu42

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).

stevefal

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
Steve Falcon

stevefal

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.
Steve Falcon