Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add support for uppercase/lowercase in the font.xml <style> tag #966

Merged
merged 3 commits into from

6 participants

@jmarshallnz
Owner

Also allows more than one style to be set (they're OR'd internally) using a space separated list.

@HitcherUK

Very welcome addition Jonathan but one question - how does it handle accents?

Thanks.

It handles Australian, New Zealand, English, Scottish, Irish, Canadian (not Quebec though) and US at least :p

It's exactly the same as it's always been basically. The only way to get full accent support is through use of ICU or similar, which I don't think anyone is working on.

OK thanks.

@PatFrost

hi,
very cool, I tested under window work fine, but no accents uppercase in french eg: Quebec :)

but with this subText.ToUpper(std::locale("")); at line 407 and 427 in GUITextLayout.cpp it's ok

sorry for french quote
[quote]
toupper() retourne la version en masjuscules du caractère passé en paramètre.
Le second paramètre de la fonction, locale(""), permet de prendre en charge les caractères spéciaux comme les accents.
Aucun paramètre signifie l'anglais. Une chaîne vide correspondra à la localité utilisée sur la machine,
et vous pouvez forcer l'utilisation d'une localité en entrant le nom de celle-ci.
[quote/]

screenshot: http://imageshack.us/photo/my-images/26/screenshot007w.png/

@jmarshallnz
Owner

Thanks @PatFrost - will investigate further.

@jmarshallnz
Owner

@PatFrost - the problem is that the ctype facet isn't transferred when we set the global locale. So no need to set locale in the ToUpper()'s once this is fixed.

@PatFrost

ah ok :)
but this 44c1ac4
fixe uppercase accent. yes !

@JezzX
Collaborator

Right finally got around to trying this and works as expected I do have a few minor pokes at it.
First is the options to put into are case sensitive and don&#39;t really match what the normal skin code is (they are the same as what it used to be) for example uppercase works but UPPERCASE doesn&#39;t when in the skin we normally use [UNNPERCASE][/UPPERCASE] so might be something to look at to get some uniformity?</p> <p>Also on a side note and probably unrelated to this change font clipping is bad in italics and the font gets cut off <a href="http://img703.imageshack.us/img703/6327/screenshot063ye.png">http://img703.imageshack.us/img703/6327/screenshot063ye.png</a></p>

@JezzX
Collaborator

wow git but royally is screwing up my last comment

@jmarshallnz
Owner

The style tag has always been case-sensitive. Having it so is fine IMO.

@JezzX
Collaborator

yeah it was more of consistency between how its done in the rest of the files but probably not something we want to mess with this late in the game since its always been lower case in that 1 file and upper case in the rest of the uses :)

@jmarshallnz jmarshallnz was assigned
@jmarshallnz jmarshallnz merged commit 0d2cd50 into xbmc:master
@babca

XBMC Frodo looks pretty ugly after this merge, the uppercase feature doesn't work well at least with French, Czech, Slovak, Hungarian...

http://imageshack.us/a/img834/8011/screenshot000m.png
http://imageshack.us/a/img585/6621/screenshot20120924at221.png
http://imageshack.us/a/img802/6621/screenshot20120924at221.png

I hope there is an easy fix for this :-)

@JezzX
Collaborator

Its just the font and always was like it you need to go into Settings\appearance\skin\ and change the "- fonts" to either "arial" or "Default no caps"

@HitcherUK

Is this platform dependant because it works on Windows but not openelec for me?

Windows - https://dl.dropbox.com/u/19745842/Images/screenshot000.jpg

OE - https://dl.dropbox.com/u/19745842/Images/screenshot001.jpg

@babca

Apparently, it is. I'm using Raspberry Pi (OpenELEC ARM), OpenELEC @ i386, OS X and iPad, the same issue across devices. It handles accents fine only on Windows.

"Its just the font" - I don't understand, the default font does contain ÁÍÉĚŠČŘŽÝÁÍÉÚŮ characters... There is an issue in a function converting strings to caps.

If any fix is not planned, thank you for a workaround – "Default no caps" is better than nothing :-)

@HitcherUK

@jmarshallnz Can you confirm platform dependency please?

Thanks.

@jmarshallnz
Owner

While this commit here doesn't have anything to do with it, but 44c1ac4 does.

By the looks there is a difference with Linux (.UTF-8 is appended) but I don't know if that's the problem you're facing.

@HitcherUK

@jmarshallnz just curious as to whether there will be a fix for Frodo as this is currently only works on Windows platforms, and Confluence uses it for the home screen so you might get reports about it.

Windows -

Windows

OpenELEC -

OpenELEC

@jmarshallnz
Owner

I don't have an openelec system so can't really test it there. I dunno if the same thing applies on OSX or not - will try and test it later.

@babca

Yes it applies to OS X too.

@HitcherUK

@jmarshallnz friendly bump as I'd just like to know whether to revert back to using a separate caps only font set.

Thanks.

@jmarshallnz
Owner

See #1887

@HitcherUK

Thanks, missed that one.

@ronie
Collaborator

same issue on linux btw.

@HitcherUK

Another solution would be to use a caps only font for the home items but I'm not sure how easy that will be.

@ronie
Collaborator

isn't that how confluence used to do it, before this change?
if i'm not mistaken it did include an all caps fontfile at one point.

no idea if it contained all charsets for all the languages though.

@HitcherUK

Just checked Eden and you're correct but for Frodo the style of font has changed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 14, 2012
Commits on May 15, 2012
  1. remove FONT_STYLE_BOLD_ITALICS as not required

    Jonathan Marshall authored
  2. allow more than one style to be specified (space separated) in the <s…

    Jonathan Marshall authored
    …tyle> tag of fonts
This page is out of date. Refresh to see the latest.
View
2  xbmc/guilib/GUIFont.cpp
@@ -50,7 +50,7 @@ CGUIFont::CGUIFont(const CStdString& strFontName, uint32_t style, color_t textCo
color_t shadowColor, float lineSpacing, float origHeight, CGUIFontTTFBase *font)
{
m_strFontName = strFontName;
- m_style = style & 3;
+ m_style = style & FONT_STYLE_MASK;
m_textColor = textColor;
m_shadowColor = shadowColor;
m_lineSpacing = lineSpacing;
View
4 xbmc/guilib/GUIFont.h
@@ -49,7 +49,9 @@ class CGUIFontTTFBase;
#define FONT_STYLE_NORMAL 0
#define FONT_STYLE_BOLD 1
#define FONT_STYLE_ITALICS 2
-#define FONT_STYLE_BOLD_ITALICS 3
+#define FONT_STYLE_UPPERCASE 4
+#define FONT_STYLE_LOWERCASE 8
+#define FONT_STYLE_MASK 0xF
class CScrollInfo
{
View
25 xbmc/guilib/GUIFontManager.cpp
@@ -31,6 +31,7 @@
#include "filesystem/SpecialProtocol.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "windowing/WindowingFactory.h"
using namespace std;
@@ -429,16 +430,22 @@ void GUIFontManager::LoadFonts(const TiXmlNode* fontNode)
if (iSize <= 0) iSize = 20;
pNode = fontNode->FirstChild("style");
- if (pNode)
+ if (pNode && pNode->FirstChild())
{
- CStdString style = pNode->FirstChild()->Value();
- iStyle = FONT_STYLE_NORMAL;
- if (style == "bold")
- iStyle = FONT_STYLE_BOLD;
- else if (style == "italics")
- iStyle = FONT_STYLE_ITALICS;
- else if (style == "bolditalics")
- iStyle = FONT_STYLE_BOLD_ITALICS;
+ vector<string> styles = StringUtils::Split(pNode->FirstChild()->ValueStr(), " ");
+ for (vector<string>::iterator i = styles.begin(); i != styles.end(); ++i)
+ {
+ if (*i == "bold")
+ iStyle |= FONT_STYLE_BOLD;
+ else if (*i == "italics")
+ iStyle |= FONT_STYLE_ITALICS;
+ else if (*i == "bolditalics") // backward compatibility
+ iStyle |= (FONT_STYLE_BOLD | FONT_STYLE_ITALICS);
+ else if (*i == "uppercase")
+ iStyle |= FONT_STYLE_UPPERCASE;
+ else if (*i == "lowercase")
+ iStyle |= FONT_STYLE_LOWERCASE;
+ }
}
XMLUtils::GetFloat(fontNode, "linespacing", lineSpacing);
View
2  xbmc/guilib/GUITextLayout.cpp
@@ -332,8 +332,6 @@ void CGUITextLayout::ParseText(const CStdStringW &text, uint32_t defaultStyle, v
// these aren't independent, but that's probably not too much of an issue
// eg [UPPERCASE]Glah[LOWERCASE]FReD[/LOWERCASE]Georeg[/UPPERCASE] will work (lower case >> upper case)
// but [LOWERCASE]Glah[UPPERCASE]FReD[/UPPERCASE]Georeg[/LOWERCASE] won't
-#define FONT_STYLE_UPPERCASE 4
-#define FONT_STYLE_LOWERCASE 8
int startPos = 0;
size_t pos = text.Find(L'[');
View
2  xbmc/settings/GUISettings.cpp
@@ -752,7 +752,7 @@ void CGUISettings::Initialize()
fontStyles.insert(make_pair(738, FONT_STYLE_NORMAL));
fontStyles.insert(make_pair(739, FONT_STYLE_BOLD));
fontStyles.insert(make_pair(740, FONT_STYLE_ITALICS));
- fontStyles.insert(make_pair(741, FONT_STYLE_BOLD_ITALICS));
+ fontStyles.insert(make_pair(741, FONT_STYLE_BOLD | FONT_STYLE_ITALICS));
AddInt(sub, "subtitles.style", 736, FONT_STYLE_BOLD, fontStyles, SPIN_CONTROL_TEXT);
AddInt(sub, "subtitles.color", 737, SUBTITLE_COLOR_START + 1, SUBTITLE_COLOR_START, 1, SUBTITLE_COLOR_END, SPIN_CONTROL_TEXT);
Something went wrong with that request. Please try again.