LLInitParam/LLUI Params enhancement

Specialized param handling for common linden types
And pre-viewer-interesting modernized llinitparam.* (includes llsdparam.cpp update)
This commit is contained in:
Inusaito Sayori
2013-12-02 00:27:50 -05:00
parent 9723a45e72
commit 23958965aa
7 changed files with 1496 additions and 740 deletions

View File

@@ -1046,6 +1046,13 @@ std::string LLFontGL::nameFromFont(const LLFontGL* fontp)
return fontp->getFontDesc().getName();
}
// static
std::string LLFontGL::sizeFromFont(const LLFontGL* fontp)
{
return fontp->getFontDesc().getSize();
}
// static
std::string LLFontGL::nameFromHAlign(LLFontGL::HAlign align)
{
@@ -1162,6 +1169,41 @@ LLFontGL* LLFontGL::getFont(const LLFontDescriptor& desc)
return sFontRegistry->getFont(desc);
}
// static
LLFontGL* LLFontGL::getFontByName(const std::string& name)
{
// check for most common fonts first
if (name == "SANSSERIF")
{
return getFontSansSerif();
}
else if (name == "SANSSERIF_SMALL")
{
return getFontSansSerifSmall();
}
else if (name == "SANSSERIF_BIG")
{
return getFontSansSerifBig();
}
else if (name == "SMALL" || name == "OCRA")
{
// *BUG: Should this be "MONOSPACE"? Do we use "OCRA" anymore?
// Does "SMALL" mean "SERIF"?
return getFontMonospace();
}
else
{
return NULL;
}
}
//static
LLFontGL* LLFontGL::getFontDefault()
{
return getFontSansSerif(); // Fallback to sans serif as default font
}
// static
std::string LLFontGL::getFontPathSystem()
{

View File

@@ -171,7 +171,9 @@ public:
// Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC"
static U8 getStyleFromString(const std::string &style);
static std::string getStringFromStyle(U8 style);
static std::string nameFromFont(const LLFontGL* fontp);
static std::string sizeFromFont(const LLFontGL* fontp);
static std::string nameFromHAlign(LLFontGL::HAlign align);
static LLFontGL::HAlign hAlignFromName(const std::string& name);
@@ -201,6 +203,9 @@ public:
static LLFontGL* getFontSansSerifBold();
static LLFontGL* getFontExtChar();
static LLFontGL* getFont(const LLFontDescriptor& desc);
// Use with legacy names like "SANSSERIF_SMALL" or "OCRA"
static LLFontGL* getFontByName(const std::string& name);
static LLFontGL* getFontDefault(); // default fallback font
static std::string getFontPathLocal();
static std::string getFontPathSystem();