* 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
+18 -35
View File
@@ -1,33 +1,15 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2005, Haiku, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Decorator.h
// Author: DarkWyrm <[email protected]>
// Stephan Aßmus <[email protected]>
// Description: Base class for window decorators
//
//------------------------------------------------------------------------------
/*
* Copyright 2001-2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <[email protected]>
* Stephan Aßmus <[email protected]>
*/
#ifndef _DECORATOR_H_
#define _DECORATOR_H_
#include <Rect.h>
#include <Region.h>
#include <String.h>
@@ -36,10 +18,12 @@
#include "ColorSet.h"
#include "LayerData.h"
class DesktopSettings;
class DisplayDriver;
class ServerFont;
class BRegion;
typedef enum {
DEC_NONE = 0,
DEC_ZOOM,
@@ -63,10 +47,8 @@ typedef enum {
class Decorator {
public:
Decorator(BRect rect,
int32 wlook,
int32 wfeel,
int32 wflags);
Decorator(DesktopSettings& settings, BRect rect,
int32 look, int32 feel, int32 flags);
virtual ~Decorator();
void SetColors(const ColorSet &cset);
@@ -145,7 +127,7 @@ class Decorator {
virtual void _DrawFrame(BRect r);
virtual void _DrawTab(BRect r);
virtual void _DrawClose(BRect r);
virtual void _DrawTitle(BRect r);
virtual void _DrawZoom(BRect r);
@@ -153,7 +135,7 @@ class Decorator {
virtual void _SetFocus();
virtual void _SetColors();
ColorSet* _colors;
DisplayDriver* _driver;
DrawData _drawdata;
@@ -182,6 +164,7 @@ class Decorator {
// add-on stuff
typedef float get_version(void);
typedef Decorator* create_decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags);
typedef Decorator* create_decorator(DesktopSettings& desktopSettings, BRect rect,
int32 look, int32 feel, int32 flags);
#endif
#endif /* _DECORATOR_H_ */
+26 -20
View File
@@ -10,9 +10,7 @@
#define FONT_MANAGER_H
#include <Font.h>
#include <Locker.h>
#include <OS.h>
#include <Looper.h>
#include <ObjectList.h>
#include <SupportDefs.h>
@@ -31,20 +29,19 @@ class ServerFont;
\class FontManager FontManager.h
\brief Manager for the largest part of the font subsystem
*/
class FontManager : public BLocker {
class FontManager : public BLooper {
public:
FontManager();
~FontManager();
virtual ~FontManager();
status_t InitCheck() { return fInitStatus; }
int32 CountFamilies();
int32 CountStyles(const char *family);
void RemoveFamily(const char *family);
void ScanSystemFolders();
status_t ScanDirectory(const char *path);
virtual void MessageReceived(BMessage* message);
int32 CountFamilies() const;
int32 CountStyles(const char *family) const;
FontFamily* FamilyAt(int32 index) const;
FontFamily* GetFamilyByIndex(int32 index) const;
FontFamily *GetFamily(uint16 familyID) const;
FontFamily *GetFamily(const char *name) const;
@@ -53,14 +50,11 @@ class FontManager : public BLocker {
uint16 styleID = 0xffff, uint16 face = 0);
FontStyle *GetStyle(const char *family, uint16 styleID);
FontStyle *GetStyle(uint16 familyID, uint16 styleID);
FontStyle* FindStyleMatchingFace(uint16 face) const;
ServerFont *GetSystemPlain();
ServerFont *GetSystemBold();
ServerFont *GetSystemFixed();
bool SetSystemPlain(const char *family, const char *style, float size);
bool SetSystemBold(const char *family, const char *style, float size);
bool SetSystemFixed(const char *family, const char *style, float size);
ServerFont* GetFont(const char *family, const char *style, float size);
ServerFont* GetFont(uint16 face, float size);
const ServerFont* DefaultFont() const;
bool FontsNeedUpdated() { return fNeedUpdate; }
/*!
@@ -68,15 +62,27 @@ class FontManager : public BLocker {
*/
void FontsUpdated() { fNeedUpdate = false; }
void AttachUser(uid_t userID);
void DetachUser(uid_t userID);
private:
void _AddFont(BPath &path);
void _SetDefaultFont();
void _ScanSystemFonts();
status_t _AddPath(const char* path);
status_t _AddPath(BEntry& entry);
void _RemoveFamily(const char *family);
status_t _ScanDirectory(BEntry &entry);
void _AddFont(BPath& path);
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
private:
status_t fInitStatus;
BObjectList<node_ref> fFontDirectories;
BObjectList<FontFamily> fFamilies;
ServerFont *fPlain, *fBold, *fFixed;
ServerFont *fDefaultFont;
bool fNeedUpdate;
int32 fNextID;
};
+3 -3
View File
@@ -60,15 +60,15 @@
# define DEFAULT_PLAIN_FONT_FAMILY "Bitstream Vera Sans"
# define FALLBACK_PLAIN_FONT_FAMILY "Swis721 BT"
# define DEFAULT_PLAIN_FONT_STYLE "Roman"
# define DEFAULT_PLAIN_FONT_SIZE 12
# define DEFAULT_PLAIN_FONT_SIZE 12.0f
# define DEFAULT_BOLD_FONT_FAMILY "Bitstream Vera Sans"
# define FALLBACK_BOLD_FONT_FAMILY "Swis721 BT"
# define DEFAULT_BOLD_FONT_STYLE "Bold"
# define DEFAULT_BOLD_FONT_SIZE 12
# define DEFAULT_BOLD_FONT_SIZE 12.0f
# define DEFAULT_FIXED_FONT_FAMILY "Bitstream Vera Sans Mono"
# define FALLBACK_FIXED_FONT_FAMILY "Courier10 BT"
# define DEFAULT_FIXED_FONT_STYLE "Roman"
# define DEFAULT_FIXED_FONT_SIZE 12
# define DEFAULT_FIXED_FONT_SIZE 12.0f
// This is the port capacity for all monitoring objects - ServerApps
// and ServerWindows
#define DEFAULT_MONITOR_PORT_SIZE 30
+6 -7
View File
@@ -5,9 +5,10 @@
* Authors:
* DarkWyrm <[email protected]>
* Jérôme Duval, [email protected]
* Axel Dörfler, [email protected]
*/
#ifndef SERVERFONT_H_
#define SERVERFONT_H_
#ifndef SERVER_FONT_H
#define SERVER_FONT_H
#include <Font.h>
@@ -62,7 +63,8 @@ class ServerFont {
const char* GetFamily() const;
const char* GetPath() const
{ return fStyle->Path(); }
void SetStyle(FontStyle& style);
status_t SetFamilyAndStyle(uint16 familyID,
uint16 styleID);
status_t SetFamilyAndStyle(uint32 fontID);
@@ -151,8 +153,6 @@ class ServerFont {
protected:
friend class FontStyle;
void _SetStyle(FontStyle* style);
FontStyle* fStyle;
edge_info fEdges;
@@ -167,5 +167,4 @@ protected:
uint32 fEncoding;
};
#endif
#endif /* SERVER_FONT_H */