Using built-in fonts (HCanonGothic, CanonMonospace) - DSLR Hack development - CHDK Forum supplierdeeply

Using built-in fonts (HCanonGothic, CanonMonospace)

  • 2 Replies
  • 3947 Views
Using built-in fonts (HCanonGothic, CanonMonospace)
« on: 15 / March / 2011, 12:19:39 »
Advertisements
Yesterday I found the character bitmaps and all the necessary infos to use the camera's fonts.

There is a nice mark for us (thank you Canon!) :)
ROM:FF617540: 48 43 61 6e 6f 6e 47 6f 74 68 69 63 00 2f 2f 2f  HCanonGothic.///

The character codes (UTF-8) listed in 32 bit format from 0xFF617550
ROM:FF617550: 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00   ...!..."...#...
ROM:FF617560: 24 00 00 00 25 00 00 00 26 00 00 00 27 00 00 00  $...%...&...'...
...

The bitmap positions (32 bit) start after the character codes at 0xFF619CFC .
ROM:FF619CF0: ef bc 9a 00 ef bc 9f 00 ef bd 9e 00 00 00 00 00  ................
ROM:FF619D00: 0e 00 00 00 38 00 00 00 52 00 00 00 bc 00 00 00  ....8...R.......
...

The character data start after the positions at 0xFF61C4A8 .
ROM:FF61C4A0: c6 bb 06 00 98 bc 06 00 01 00 01 00 0c 00 00 00  ................
...


The structure of the character data:  lW, hW, lH, hH, lCW, hCW, lXO, hXO, lYO, hYO, DT[], PD[]
lW,hW: width of the bitmap (low, high)
lH,hH: height of the bitmap
lCW,hCW: the actual character width
lXO,hXO: X offset of the character bitmap data
lYO,hYO: Y offset of the character bitmap data
DT[]: data bytes of the character bitmap, size: H*round up(W / 8 )
PD[]: padding bytes: 0-4(?) zero byte;



There are 2539 available characters (in 7D). You can see all here: HCanonGothic 7D, HCanonGothic 50D, HCanonGothic 550D
You can find lots of different alphabets and also special icons in it.

Camera'HCanonGothic'Char codesOffsetsBitmapschars
5D20xFF05E9B00xFF05E9C00xFF0611080xFF0638502514
7D0xFF6175400xFF6175500xFF619CFC0xFF61C4A82539
60D0xFF7B1FA80xFF7B1FB80xFF7B46440xFF7B6CD02467
50D0xFF05E1C80xFF05E1D80xFF0608EC0xFF0630002501
600D0xFF89476C0xFF89477C0xFF8971B00xFF899BE42701
550D0xFF661A940xFF661AA40xFF663F840xFF6664642360

There is another font in similar structure but it's fixed width:
ROM:FF688228: 43 61 6e 6f 6e 4d 6f 6e 6f 73 70 61 63 65 00 00  CanonMonospace..

The character codes from 0xFF688238
ROM:FF688238: 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00   ...!..."...#...
ROM:FF688248: 24 00 00 00 25 00 00 00 26 00 00 00 27 00 00 00  $...%...&...'...
...

The bitmap positions start after the character codes at 0xFF6883B8 .
ROM:FF6883B8: 00 00 00 00 82 00 00 00 04 01 00 00 86 01 00 00  ................
...

The character data start after the positions at 0xFF688538 .
ROM:FF688538: 14 00 28 00 14 00 00 00 00 00 00 00 00 00 00 00  ..(.............
...


You can calculate the offset (char index fom the code table multiply by 0x82) and not necessary look up for the code index.

The following 96 characters are available:



We can find the existing routines in the Canon firmware or we can write our own.

« Last Edit: 15 / July / 2011, 06:16:35 by Pelican »

*

Offline a1ex

  • *****
  • 671
  • ML dev
Re: Using built-in fonts (HCanonGothic, CanonMonospace)
« Reply #1 on: 16 / March / 2011, 04:38:29 »
Also here: http://groups.google.com/group/ml-devel/browse_thread/thread/aec4c80eef1cdd6a

"Hello world" code for running on the camera: https://bitbucket.org/hudson/magic-lantern/changeset/cfba492ea84d

Pel, do you know where to find the height of the font? (not for a single char). I've hardcoded it at 40, is it the same for monospace?
« Last Edit: 16 / March / 2011, 04:42:09 by a1ex »

*

Offline Coutts

  • *****
  • 538
  • www.flickr.com/couttsphotog
    • Flickr
Re: Using built-in fonts (HCanonGothic, CanonMonospace)
« Reply #2 on: 06 / April / 2011, 19:38:39 »
so how long until it's implemented as the ML menu font? :D
Canon 5d
Canon 50mm f/1.8
Sigma 24mm f/1.8

Flickr

 

Related Topics