
Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2015
11:39 AM
It seems font height has changed!
font = font_registry.GetDefaultFont()
fontH = font.GetOneLineHeight() ' fontH is 47
After a new round of compatibility testing today, I discovered that on my classic Roku HD N1100 (software 3.1), the GetDefaultFont font height is actually 49, but on my Roku 2 XS (software 6.1) the font height is 47, which is what I've been banking on for a few weeks of development.
Am I missing something, or is this a change that is documented somewhere?
4 REPLIES 4

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2015
12:04 PM
Re: It seems font height has changed!
Why not specify the font size, so you don't have to worry about it?
font = font_registry.GetDefaultFont(47, false, false)
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)

Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2015
12:58 PM
Re: It seems font height has changed!
Oh my gosh, why didn't I know that?! Now I see it in the docs, I guess I just never really learned that part, thanks. 🙂

Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2015
01:53 PM
Re: It seems font height has changed!
So it seems that GetOneLineHeight() automatically adds a certain percent of the font height as a spacer, around 18%-25%. For example:
Font height, One Line Height:
20 . . . . . 25 (25%)
21 . . . . . 26 (24%)
25 . . . . . 30 (20%)
32 . . . . . 39 (22%)
38 . . . . . 45 (18%)
40 . . . . . 47 (18%)
47 . . . . . 56 (19%)
The added space seems to increment by 2s, not sure why or if that's really accurate though.
So in my code, if I want to ensure 47 line height, I need to set the font at 40
Font height, One Line Height:
20 . . . . . 25 (25%)
21 . . . . . 26 (24%)
25 . . . . . 30 (20%)
32 . . . . . 39 (22%)
38 . . . . . 45 (18%)
40 . . . . . 47 (18%)
47 . . . . . 56 (19%)
The added space seems to increment by 2s, not sure why or if that's really accurate though.
So in my code, if I want to ensure 47 line height, I need to set the font at 40
font = font_registry.GetDefaultFont(40, false, false)Will print "47"
fontH = font.GetOneLineHeight()
? fontH

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2015
02:34 PM
Re: It seems font height has changed!
Presumably the difference is character height (including ascenders and descenders) vs. line height. The latter being the character height plus the surrounding padding, so you can accurately measure and layout multiple lines without having the text for each line touching the surrounding lines.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)