Author Topic: Proportional fonts  (Read 34832 times)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Proportional fonts
« on: September 07, 2013, 11:51:30 AM »
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):
Code: [Select]
        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):
Code: [Select]
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):
Code: [Select]
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)
Code: [Select]
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

Code: [Select]
#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):
Code: [Select]
FONT_EXPAND(x) /* range: -4 ... +3 pixels per character */

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Proportional fonts
« Reply #1 on: September 08, 2013, 10:37:10 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

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Proportional fonts
« Reply #2 on: September 08, 2013, 10:54:46 AM »
You can undo that changeset later if you really want.

stevefal

  • Contributor
  • Hero Member
  • *****
  • Posts: 529
bmp_printf enhancement
« Reply #3 on: September 18, 2013, 03:21:04 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Proportional fonts
« Reply #4 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.

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Proportional fonts
« Reply #5 on: September 19, 2013, 05:11:31 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Proportional fonts
« Reply #6 on: September 19, 2013, 05:14:58 PM »
Did you run "make install" or try the nightly?

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Proportional fonts
« Reply #7 on: September 19, 2013, 05:33:12 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

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Proportional fonts
« Reply #8 on: September 19, 2013, 09:25:03 PM »
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.

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

  • Contributor
  • Hero Member
  • *****
  • Posts: 529
Re: Proportional fonts
« Reply #9 on: September 20, 2013, 03:03:36 AM »
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

  • Contributor
  • Hero Member
  • *****
  • Posts: 1863
  • Have you tried turning it off and on again?
Re: Proportional fonts
« Reply #10 on: September 20, 2013, 03:18:07 AM »
@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

  • Member
  • ***
  • Posts: 118
  • 550D
Re: Proportional fonts
« Reply #11 on: September 20, 2013, 08:59:35 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

  • Hero Member
  • *****
  • Posts: 504
Re: Proportional fonts
« Reply #12 on: September 20, 2013, 01:55:13 PM »
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

  • Freshman
  • **
  • Posts: 70
Re: Proportional fonts
« Reply #13 on: September 20, 2013, 02:18:19 PM »

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

Agree, looks great!!

stevefal

  • Contributor
  • Hero Member
  • *****
  • Posts: 529
Re: Proportional fonts
« Reply #14 on: September 20, 2013, 02:22:42 PM »
Thanks to g3gg0 and a1ex for implementing support for new fonts.
Steve Falcon

SpcCb

  • Member
  • ***
  • Posts: 207
Re: Proportional fonts
« Reply #15 on: September 20, 2013, 04:48:12 PM »
Tested on 5D mkII: good job, it's more clear and a bit bigger (easer to read). 8)

stevefal

  • Contributor
  • Hero Member
  • *****
  • Posts: 529
Re: Proportional fonts
« Reply #16 on: September 21, 2013, 03:20:57 AM »
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

  • Senior
  • ****
  • Posts: 479
  • 5D III and IV
Re: Proportional fonts
« Reply #17 on: September 21, 2013, 06:12:12 AM »
running sep 20th on 5d3 and loving the new fonts!!!!!!! AWESOME!!!!!! Thank you for giving me a brand new 5d3!!!!

britom

  • Member
  • ***
  • Posts: 113
Re: Proportional fonts
« Reply #18 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

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

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Proportional fonts
« Reply #19 on: September 21, 2013, 05:11:28 PM »
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

  • Member
  • ***
  • Posts: 207
Re: Proportional fonts
« Reply #20 on: September 22, 2013, 03:07:03 AM »
(error, sorry)

stevefal

  • Contributor
  • Hero Member
  • *****
  • Posts: 529
Re: Proportional fonts
« Reply #21 on: September 22, 2013, 06:16:58 PM »
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

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Proportional fonts
« Reply #22 on: September 22, 2013, 08:28:39 PM »
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

  • Contributor
  • Hero Member
  • *****
  • Posts: 529
Re: Proportional fonts
« Reply #23 on: September 22, 2013, 10:16:03 PM »
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

  • Contributor
  • Hero Member
  • *****
  • Posts: 529
Re: Proportional fonts
« Reply #24 on: September 24, 2013, 03:38:51 AM »
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