* the FontManager is now a looper (but doesn't do anything useful yet).

* moved the system default font functionality into the DesktopSettings class.
* ServerFont::SetStyle() is now a public method.
* Improved font fallback routines: they will never end up without a font if
  there is at least one font installed.
* fixed some minor bugs in the DecorManager.
* Decorator now get a DesktopSettings object passed - dunno if that's a good
  idea (since we'll have to open the DesktopSettings header), but it works
  for now (and something like this is probably needed anyway).
* a clean ServerFont is now set to the system default font - and not to the
  (user chosen) desktop default font anymore (since the font manager doesn't
  know about that one).
* Improved font directory scanning in the font manager a bit, it's now using
  find_directory() instead of hard-coded paths.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14666 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-03 17:03:36 +00:00
parent c0ebc619bf
commit 05bd1efe5b
20 changed files with 557 additions and 489 deletions
+119
View File
@@ -11,6 +11,8 @@
#include "DesktopSettings.h"
#include "DesktopSettingsPrivate.h"
#include "Desktop.h"
#include "FontManager.h"
#include "ServerConfig.h"
DesktopSettings::Private::Private()
@@ -30,6 +32,17 @@ DesktopSettings::Private::~Private()
void
DesktopSettings::Private::_SetDefaults()
{
_SetFont(fPlainFont, DEFAULT_PLAIN_FONT_FAMILY, DEFAULT_PLAIN_FONT_STYLE,
DEFAULT_PLAIN_FONT_SIZE, FALLBACK_PLAIN_FONT_FAMILY, DEFAULT_PLAIN_FONT_STYLE,
B_REGULAR_FACE);
_SetFont(fBoldFont, DEFAULT_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE,
DEFAULT_BOLD_FONT_SIZE, FALLBACK_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE,
B_BOLD_FACE);
_SetFont(fFixedFont, DEFAULT_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE,
DEFAULT_FIXED_FONT_SIZE, FALLBACK_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE,
B_REGULAR_FACE);
fFixedFont.SetSpacing(B_FIXED_SPACING);
fMouseMode = B_NORMAL_MOUSE;
// init scrollbar info
@@ -54,6 +67,28 @@ DesktopSettings::Private::_SetDefaults()
}
void
DesktopSettings::Private::_SetFont(ServerFont &font, const char *familyName,
const char *styleName, float size, const char *fallbackFamily,
const char *fallbackStyle, uint16 fallbackFace)
{
BAutolock locker(gFontManager);
// try to find a matching font
FontStyle* style = gFontManager->GetStyle(familyName, styleName);
if (style == NULL) {
style = gFontManager->GetStyle(fallbackFamily, fallbackStyle);
if (style == NULL) {
style = gFontManager->FindStyleMatchingFace(fallbackFace);
}
}
if (style != NULL)
font.SetStyle(*style);
}
status_t
DesktopSettings::Private::_Load()
{
@@ -69,6 +104,48 @@ DesktopSettings::Private::Save()
}
void
DesktopSettings::Private::SetDefaultPlainFont(const ServerFont &font)
{
fPlainFont = font;
}
const ServerFont &
DesktopSettings::Private::DefaultPlainFont() const
{
return fPlainFont;
}
void
DesktopSettings::Private::SetDefaultBoldFont(const ServerFont &font)
{
fBoldFont = font;
}
const ServerFont &
DesktopSettings::Private::DefaultBoldFont() const
{
return fBoldFont;
}
void
DesktopSettings::Private::SetDefaultFixedFont(const ServerFont &font)
{
fFixedFont = font;
}
const ServerFont &
DesktopSettings::Private::DefaultFixedFont() const
{
return fFixedFont;
}
void
DesktopSettings::Private::SetScrollBarInfo(const scroll_bar_info& info)
{
@@ -174,6 +251,48 @@ DesktopSettings::~DesktopSettings()
}
void
DesktopSettings::SetDefaultPlainFont(const ServerFont &font)
{
fSettings->SetDefaultPlainFont(font);
}
void
DesktopSettings::GetDefaultPlainFont(ServerFont &font) const
{
font = fSettings->DefaultPlainFont();
}
void
DesktopSettings::SetDefaultBoldFont(const ServerFont &font)
{
fSettings->SetDefaultBoldFont(font);
}
void
DesktopSettings::GetDefaultBoldFont(ServerFont &font) const
{
font = fSettings->DefaultBoldFont();
}
void
DesktopSettings::SetDefaultFixedFont(const ServerFont &font)
{
fSettings->SetDefaultFixedFont(font);
}
void
DesktopSettings::GetDefaultFixedFont(ServerFont &font) const
{
font = fSettings->DefaultFixedFont();
}
void
DesktopSettings::SetScrollBarInfo(const scroll_bar_info& info)
{