Req More font weight options & capitalise
#16
I'm late to the party and not sure if it's in any way related, but underlining text would be a welcome addition too as far as I'm concerned. Especially if it could be used for a button's focused state.
Reply
#17
(2015-03-20, 22:20)Jeroen Wrote: I'm late to the party and not sure if it's in any way related, but underlining text would be a welcome addition too as far as I'm concerned. Especially if it could be used for a button's focused state.

+1
Arctic Fuse 2 - Alpha now available. Support me on Ko-fi.
Reply
#18
Fonts are not my best friends but i will check. No promises though.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#19
Cheers!
Reply
#20
@mkortstiege

I've been reading up on embolden and I think we could achieve the following bold strengths by adjusting the fraction value in line 937.

m_face->size->metrics.y_scale ) / 24;

Code:
Strength      Value
--------      -----
Medium        / 8
Semi bold     / 16
Bold          / 24
Extra bold    / 32
Black         / 40

I can't compile myself but if you could fire off a test build using one of those values we could at least prove the idea.

Thanks.
Reply
#21
As requested here's some test code for Confluence.

Change line 153 in MyVideoNav.xml to -

Code:
<label>[CAPITALIZE]20367[/CAPITALIZE]</label>

Then navigate to the side menu and you'll see '20367' instead of 'Hide Watched'.

Thanks.
Reply
#22
(2015-04-12, 12:15)Hitcher Wrote: As requested here's some test code for Confluence.

Change line 153 in MyVideoNav.xml to -

Code:
<label>[CAPITALIZE]20367[/CAPITALIZE]</label>

Then navigate to the side menu and you'll see '20367' instead of 'Hide Watched'.

Thanks.

You have to use $LOCALIZE. AFAIK labels never supported style tags (upper/lower/..) without localizing the id.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#23
What if you try with $LOCALIZE ?
Reply
#24
Brain fart moment. I was trying to use [LOCALIZE]21429[/LOCALIZE] instead of $LOCALIZE[21429] for some unknown reason.

This works as expected -

Code:
<label>[CAPITALIZE]$LOCALIZE[20367][/CAPITALIZE]</label>

Sorry.
Reply
#25
Big Grin
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#26
Capitalize is capitalising the letter after an apostrophe, e.g. They're becomes They'Re

This is on the latest nightly.
 
Reply
#27
Hm, should work since a regular apostrophe is handle via sd::ispunct. See http://en.cppreference.com/w/cpp/string/byte/ispunct

https://github.com/xbmc/xbmc/blob/master...s.cpp#L392 is what handles this.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#28
Sorry. Misread that post. Will PR a fix later today.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#29
For the past week I've been compiling Kodi using different strength values in the Embolden code (see below) to get an idea of which ones to use for the various weight options and here are the results.

watch gallery


Code:
-24   Thin (Hairline)
-36   Extra Light (Ultra Light)
-48   Light
N/A   Normal
48    Medium
36    Semi Bold
24    Bold
18    Extra Bold
12    Heavy

The value is found at the end of the /* some reasonable strength */ code (the default for bold being 24) with negative values giving the thinner fonts.

https://github.com/xbmc/xbmc/blob/c096e7...ontTTF.cpp

PHP Code:
// Embolden code - original taken from freetype2 (ftsynth.c)
void CGUIFontTTFBase::EmboldenGlyph(FT_GlyphSlot slot)
{
  if ( 
slot->format != FT_GLYPH_FORMAT_OUTLINE )
    return;

  
/* some reasonable strength */
  
FT_Pos strength FT_MulFixm_face->units_per_EM,
                    
m_face->size->metrics.y_scale ) / 24;

  
FT_BBox bbox_beforebbox_after;
  
FT_Outline_Get_CBox( &slot->outline, &bbox_before );
  
FT_Outline_Embolden( &slot->outlinestrength );  // ignore error
  
FT_Outline_Get_CBox( &slot->outline, &bbox_after );

  
FT_Pos dx bbox_after.xMax bbox_before.xMax;
  
FT_Pos dy bbox_after.yMax bbox_before.yMax;

  if ( 
slot->advance.)
    
slot->advance.+= dx;

  if ( 
slot->advance.)
    
slot->advance.+= dy;

  
slot->metrics.width        += dx;
  
slot->metrics.height       += dy;
  
slot->metrics.horiBearingY += dy;
  
slot->metrics.horiAdvance  += dx;
  
slot->metrics.vertBearingX -= dx 2;
  
slot->metrics.vertBearingY += dy;
  
slot->metrics.vertAdvance  += dy;


The screenshots above show how even the standard Arial font can be made to look using each value. This unfortunately is as far as my knowledge goes so hopefully a dev can now step in and add the various font weights to Kodi's core. All being well this would allow me to remove my Bold / Light font hack from my Fire TV skin as well allow me to use Arial for foreign languages without compromising the over look.

Thanks.
Reply
#30
OK had a go myself -- even though I don't know C++ -- using the capitalize commit as a base but get nothing when trying to use it. Huh

Anyone have any pointers as to what I'm doing wrong or missing?

https://github.com/HitcherUK/xbmc/commit...037d6098c0

Thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
More font weight options & capitalise0