Req More font weight options & capitalise
#1
Couple of font requests
  1. Lighter and bolder weights.

  2. Capitalise the first letter of each word.

Thanks.
Reply
#2
"Capitalise the first letter of each word." would be great!!
Noli illegitimi carborundum


Reply
#3
Quick and dirty try @ https://github.com/mkortstiege/xbmc/tree/capitalize. A win32 testbuild based on master is queued on jenkins and should be on the mirrors later.

Should work like lower- and uppercase with using [CAPITALIZE] and/or with capitalize <style> tag in fonts.xml
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
#4
What exactly do you mean with "lighter and bolder weights"?
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
#5
(2015-03-03, 21:07)mkortstiege Wrote: Quick and dirty try @ https://github.com/mkortstiege/xbmc/tree/capitalize. A win32 testbuild based on master is queued on jenkins and should be on the mirrors later.

Should work like lower- and uppercase with using [CAPITALIZE] and/or with capitalize <style> tag in fonts.xml
Awesome, thanks.
(2015-03-03, 21:08)mkortstiege Wrote: What exactly do you mean with "lighter and bolder weights"?
https://developer.mozilla.org/en-US/docs...t#Examples

I had a poke around GitHub and found the bold code if that helps -

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

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_MulFix( m_face->units_per_EM,
                    m_face->size->metrics.y_scale ) / 24;

  FT_BBox bbox_before, bbox_after;
  FT_Outline_Get_CBox( &slot->outline, &bbox_before );
  FT_Outline_Embolden( &slot->outline, strength );  // 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.x )
    slot->advance.x += dx;

  if ( slot->advance.y )
    slot->advance.y += 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;
}
Reply
#6
(2015-03-03, 21:07)mkortstiege Wrote: Quick and dirty try @ https://github.com/mkortstiege/xbmc/tree/capitalize. A win32 testbuild based on master is queued on jenkins and should be on the mirrors later.

Should work like lower- and uppercase with using [CAPITALIZE] and/or with capitalize <style> tag in fonts.xml

Working as expected except for acronyms.

NYPD becomes Nypd
N.Y.P.D becomes N.y.p.d

Also McCloud becomes Mccloud.

I guess this is converting all the letters (first to upper and the rest to lower) whereas it might be simpler to just convert the first to upper if it isn't already.
Reply
#7
Right. That's what i mean with quick n dirty Wink Will fix and send a PR tomorrow. Will also look into the embolden one you linked.
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
#8
Big Grin
Reply
#9
A few more instances where the first letter gets missed are words following a bracket, slash, hyphen and quote.

Code:
( / - "

(2015-03-03, 22:25)mkortstiege Wrote: Will also look into the embolden one you linked.

Also any luck with this yet?

Thanks.
Reply
#10
Will check why those are missing. No luck on the embolden one yet. I just had a brief look at it and i am still trying to get familiar with the guilib ..
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
#11
Could you please give some examples and what you expect it to become?
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
#12
This is a good example of different weights.

Code:
100   Thin (Hairline)
200   Extra Light (Ultra Light)
300   Light
400   Normal
500   Medium
600   Semi Bold (Demi Bold)
700   Bold
800   Extra Bold (Ultra Bold)
900   Black (Heavy)

Image
Reply
#13
Oh Smile I actually meant the uppercasing one :p
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
#14
Sorry, here you go.

Image

Image

Image

Image

Thanks.
Reply
#15
(2015-03-10, 22:05)ronie Wrote: 2015-03-10 Fonts - ability to capitalize the first letter of each word

skins can now use the [CAPITALIZE] tag to uppercase the first characters of every word in a string.


forum thread: 220249 (thread)
git commit: https://github.com/xbmc/xbmc/commit/4e54...46357ea601
pull request: 6599 (PR)

Also working in the font.xml style field.

Updated the wiki.

eg

Code:
<font>
    <name>LightCap40</name>
    <filename>HelveticaNeue_Lt.ttf</filename>
    <style>capitalize</style>
    <size>40</size>
</font>
Reply

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