Added basic support for changing font schemes

master
Kadah_Coba 2011-08-20 19:20:42 -07:00
parent 63aa3751b5
commit d26472736f
6 changed files with 255 additions and 21 deletions

View File

@ -169,6 +169,7 @@ void init_llui()
LLFontGL::initClass(96.f, 1.f, 1.f,
gDirUtilp->getAppRODataDir(),
LLUI::getXUIPaths(),
"fonts.xml",
false ); // don't create gl textures
LLFloaterView::Params fvparams;

View File

@ -799,7 +799,7 @@ const LLFontDescriptor& LLFontGL::getFontDesc() const
}
// static
void LLFontGL::initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::string& app_dir, const std::vector<std::string>& xui_paths, bool create_gl_textures)
void LLFontGL::initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::string& app_dir, const std::vector<std::string>& xui_paths, const std::string& fonts_file, bool create_gl_textures)
{
sVertDPI = (F32)llfloor(screen_dpi * y_scale);
sHorizDPI = (F32)llfloor(screen_dpi * x_scale);
@ -811,7 +811,12 @@ void LLFontGL::initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::st
if (!sFontRegistry)
{
sFontRegistry = new LLFontRegistry(xui_paths, create_gl_textures);
sFontRegistry->parseFontInfo("fonts.xml");
// Allow the user to pick the fonts
if (!sFontRegistry->parseFontInfo(fonts_file))
{
// fall back to default if specifed font settings file is not found -KC
sFontRegistry->parseFontInfo("fonts.xml");
}
}
else
{

View File

@ -150,7 +150,7 @@ public:
const LLFontDescriptor& getFontDesc() const;
static void initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::string& app_dir, const std::vector<std::string>& xui_paths, bool create_gl_textures = true);
static void initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::string& app_dir, const std::vector<std::string>& xui_paths, const std::string& fonts_file, bool create_gl_textures = true);
// Load sans-serif, sans-serif-small, etc.
// Slow, requires multiple seconds to load fonts.

View File

@ -15083,5 +15083,16 @@ Change of this parameter will affect the layout of buttons in notification toast
<integer>1</integer>
</map>
<key>PhoenixFontSettingsFile</key>
<map>
<key>Comment</key>
<string>Line spacing on chat</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<integer>fonts.xml</integer>
</map>
</map>
</llsd>

View File

@ -1526,7 +1526,8 @@ LLViewerWindow::LLViewerWindow(
mDisplayScale.mV[VX],
mDisplayScale.mV[VY],
gDirUtilp->getAppRODataDir(),
LLUI::getXUIPaths());
LLUI::getXUIPaths(),
gSavedSettings.getString("PhoenixFontSettingsFile"));
// Create container for all sub-views
LLView::Params rvp;
@ -4577,7 +4578,8 @@ void LLViewerWindow::initFonts(F32 zoom_factor)
mDisplayScale.mV[VX] * zoom_factor,
mDisplayScale.mV[VY] * zoom_factor,
gDirUtilp->getAppRODataDir(),
LLUI::getXUIPaths());
LLUI::getXUIPaths(),
gSavedSettings.getString("PhoenixFontSettingsFile"));
// Force font reloads, which can be very slow
LLFontGL::loadDefaultFonts();
}

View File

@ -1,25 +1,37 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
border="true"
follows="left|top|right|bottom"
height="448"
label="Graphics"
follows="all"
height="440"
label="UI-Pref"
layout="topleft"
left="102"
left="1"
name="Display panel"
top="1"
width="517">
width="535">
<tab_container
label="Firestorm Prefs"
layout="topleft"
follows="all"
top="5"
bottom="-10"
left="1"
right="-1"
name="tabs"
tab_min_width="50"
tab_position="top" >
<!--General-->
<panel
top_pad="5"
bottom="-1"
left="1"
right="-1"
follows="all"
label="User Interface"
name="UI Prefs Panel" >
<panel
border="false"
follows="top|left"
height="432"
label="User Interface"
layout="topleft"
left="5"
name="UI Prefs Panel"
top="16"
width="485">
<text
type="string"
left="5"
@ -147,7 +159,7 @@
<text
type="string"
left="5"
top_pad="60"
top_pad="30"
length="1"
follows="left|top"
height="12"
@ -572,5 +584,208 @@
%
</text>
</panel>
<!--Font-->
<panel
top_pad="5"
bottom="-1"
left="1"
right="-1"
follows="all"
label="Font"
name="UI-font-tab" >
<text
type="string"
length="1"
follows="left|top"
height="16"
layout="topleft"
left="10"
name="tooltip_textbox"
top_pad="10"
width="120">
Font Scheme:
</text>
<combo_box
height="23"
layout="topleft"
follows="left|top"
control_name="PhoenixFontSettingsFile"
left_pad="5"
name="Tooltipdelay"
width="160">
<combo_box.item
label="Deja Vu"
name="tt_item1"
value="fonts.xml" />
<combo_box.item
label="Ubuntu Font Family"
name="tt_item2"
value="fonts_ubuntu.xml" />
<combo_box.item
label="Liberation"
name="tt_item3"
value="fonts_liberation.xml" />
<combo_box.item
label="Driod Sans"
name="tt_item4"
value="fonts_driod.xml" />
</combo_box>
<text
name="tooltip_textbox"
top_delta="5"
left_pad="5"
height="16"
width="120"
layout="topleft"
follows="left|top"
type="string"
length="1">
(Requires restart)
</text>
<!-- disabled for now, needs code support
<text
type="string"
length="1"
follows="left|top"
height="16"
layout="topleft"
left="10"
name="tooltip_textbox"
top_pad="15"
width="120">
Chat Line spacing:
</text>
<spinner
top_delta="-5"
left_pad="5"
height="18"
width="90"
control_name="PhoenixFontChatLineSpacing"
layout="topleft"
follows="left|top"
increment="0.01"
decimal_digits="2"
initial_val="1"
min_val="1"
max_val="1.75"
name="chat_line_spacing_slider" />
<text
name="tooltip_textbox"
top_pad="15"
left="10"
height="16"
width="120"
layout="topleft"
follows="left|top"
type="string"
length="1">
Small Font Size:
</text>
<spinner
name="chat_line_spacing_slider"
top_delta="-5"
left_pad="5"
height="18"
width="40"
layout="topleft"
follows="left|top"
control_name="PhoenixFontSizeSmall"
increment="1"
decimal_digits="0"
initial_val="10"
min_val="6"
max_val="14" />
<text
name="tooltip_textbox"
top_delta="5"
left_pad="3"
height="16"
width="80"
layout="topleft"
follows="left|top"
type="string"
length="1">
pt (defualt 10)
</text>
-->
<!-- not a live preview
<text
name="tooltip_textbox"
top_pad="15"
left="10"
height="24"
width="480"
layout="topleft"
follows="left|top"
type="string"
length="1"
font="SansSerifHuge">
The quick brown fox jumps over the lazy dog.
</text>
<text
name="tooltip_textbox"
top_pad="5"
left="10"
height="18"
width="480"
layout="topleft"
follows="left|top"
type="string"
length="1"
font="SansSerifLarge">
The quick brown fox jumps over the lazy dog.
</text>
<text
name="tooltip_textbox"
top_pad="5"
left="10"
height="16"
width="480"
layout="topleft"
follows="left|top"
type="string"
length="1"
font="SansSerifMedium">
The quick brown fox jumps over the lazy dog.
</text>
<text
name="tooltip_textbox"
top_pad="5"
left="10"
height="16"
width="480"
layout="topleft"
follows="left|top"
type="string"
length="1"
font="SansSerifSmall">
The quick brown fox jumps over the lazy dog.
</text>
<text
name="tooltip_textbox"
top_pad="8"
left="10"
height="12"
width="480"
layout="topleft"
follows="left|top"
type="string"
length="1"
font="Monospace">
The quick brown fox jumps over the lazy dog.
</text>
-->
</panel>
</tab_container>
</panel>