Renamed the FontServer class to FontManager.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14642 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-02 13:25:39 +00:00
parent d05a172192
commit bdd34c028f
13 changed files with 109 additions and 109 deletions
@@ -6,8 +6,8 @@
* DarkWyrm <bpmagic@columbus.rr.com> * DarkWyrm <bpmagic@columbus.rr.com>
* Axel Dörfler, axeld@pinc-software.de * Axel Dörfler, axeld@pinc-software.de
*/ */
#ifndef FONT_SERVER_H #ifndef FONT_MANAGER_H
#define FONT_SERVER_H #define FONT_MANAGER_H
#include <Font.h> #include <Font.h>
@@ -28,13 +28,13 @@ class ServerFont;
/*! /*!
\class FontServer FontServer.h \class FontManager FontManager.h
\brief Manager for the largest part of the font subsystem \brief Manager for the largest part of the font subsystem
*/ */
class FontServer : public BLocker { class FontManager : public BLocker {
public: public:
FontServer(); FontManager();
~FontServer(); ~FontManager();
status_t InitCheck() { return fInitStatus; } status_t InitCheck() { return fInitStatus; }
@@ -82,6 +82,6 @@ class FontServer : public BLocker {
}; };
extern FT_Library gFreeTypeLibrary; extern FT_Library gFreeTypeLibrary;
extern FontServer *gFontServer; extern FontManager *gFontManager;
#endif /* FONTSERVER_H_ */ #endif /* FONT_MANAGER_H */
+1 -1
View File
@@ -35,7 +35,7 @@
#include <View.h> // for B_FONT_ALL #include <View.h> // for B_FONT_ALL
#include "RGBColor.h" #include "RGBColor.h"
#include "FontServer.h" #include "FontManager.h"
#include "ServerFont.h" #include "ServerFont.h"
#include "PatternHandler.h" #include "PatternHandler.h"
+15 -15
View File
@@ -28,7 +28,7 @@
#include "DecorManager.h" #include "DecorManager.h"
#include "DefaultDecorator.h" #include "DefaultDecorator.h"
#include "Desktop.h" #include "Desktop.h"
#include "FontServer.h" #include "FontManager.h"
#include "HWInterface.h" #include "HWInterface.h"
#include "RegistrarDefs.h" #include "RegistrarDefs.h"
#include "RGBColor.h" #include "RGBColor.h"
@@ -99,14 +99,14 @@ AppServer::AppServer()
sAppServer = this; sAppServer = this;
// Create the font server and scan the proper directories. // Create the font server and scan the proper directories.
gFontServer = new FontServer; gFontManager = new FontManager;
gFontServer->Lock(); gFontManager->Lock();
gFontServer->ScanSystemFolders(); gFontManager->ScanSystemFolders();
if (!gFontServer->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY, if (!gFontManager->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY,
DEFAULT_PLAIN_FONT_STYLE, DEFAULT_PLAIN_FONT_STYLE,
DEFAULT_PLAIN_FONT_SIZE) && DEFAULT_PLAIN_FONT_SIZE) &&
!gFontServer->SetSystemPlain(FALLBACK_PLAIN_FONT_FAMILY, !gFontManager->SetSystemPlain(FALLBACK_PLAIN_FONT_FAMILY,
DEFAULT_PLAIN_FONT_STYLE, DEFAULT_PLAIN_FONT_STYLE,
DEFAULT_PLAIN_FONT_SIZE)) { DEFAULT_PLAIN_FONT_SIZE)) {
printf("Couldn't set plain to %s (fallback: %s), %s %d pt\n", printf("Couldn't set plain to %s (fallback: %s), %s %d pt\n",
@@ -116,10 +116,10 @@ AppServer::AppServer()
DEFAULT_PLAIN_FONT_SIZE); DEFAULT_PLAIN_FONT_SIZE);
} }
if (!gFontServer->SetSystemBold(DEFAULT_BOLD_FONT_FAMILY, if (!gFontManager->SetSystemBold(DEFAULT_BOLD_FONT_FAMILY,
DEFAULT_BOLD_FONT_STYLE, DEFAULT_BOLD_FONT_STYLE,
DEFAULT_BOLD_FONT_SIZE) && DEFAULT_BOLD_FONT_SIZE) &&
!gFontServer->SetSystemBold(FALLBACK_BOLD_FONT_FAMILY, !gFontManager->SetSystemBold(FALLBACK_BOLD_FONT_FAMILY,
DEFAULT_BOLD_FONT_STYLE, DEFAULT_BOLD_FONT_STYLE,
DEFAULT_BOLD_FONT_SIZE)) { DEFAULT_BOLD_FONT_SIZE)) {
printf("Couldn't set bold to %s (fallback: %s), %s %d pt\n", printf("Couldn't set bold to %s (fallback: %s), %s %d pt\n",
@@ -129,10 +129,10 @@ AppServer::AppServer()
DEFAULT_BOLD_FONT_SIZE); DEFAULT_BOLD_FONT_SIZE);
} }
if (!gFontServer->SetSystemFixed(DEFAULT_FIXED_FONT_FAMILY, if (!gFontManager->SetSystemFixed(DEFAULT_FIXED_FONT_FAMILY,
DEFAULT_FIXED_FONT_STYLE, DEFAULT_FIXED_FONT_STYLE,
DEFAULT_FIXED_FONT_SIZE) && DEFAULT_FIXED_FONT_SIZE) &&
!gFontServer->SetSystemFixed(FALLBACK_FIXED_FONT_FAMILY, !gFontManager->SetSystemFixed(FALLBACK_FIXED_FONT_FAMILY,
DEFAULT_FIXED_FONT_STYLE, DEFAULT_FIXED_FONT_STYLE,
DEFAULT_FIXED_FONT_SIZE)) { DEFAULT_FIXED_FONT_SIZE)) {
printf("Couldn't set fixed to %s (fallback: %s), %s %d pt\n", printf("Couldn't set fixed to %s (fallback: %s), %s %d pt\n",
@@ -142,7 +142,7 @@ AppServer::AppServer()
DEFAULT_FIXED_FONT_SIZE); DEFAULT_FIXED_FONT_SIZE);
} }
gFontServer->Unlock(); gFontManager->Unlock();
// Load the GUI colors here and set the global set to the values contained therein. If this // Load the GUI colors here and set the global set to the values contained therein. If this
// is not possible, set colors to the defaults // is not possible, set colors to the defaults
@@ -175,7 +175,7 @@ AppServer::~AppServer()
gScreenManager->Lock(); gScreenManager->Lock();
gScreenManager->Quit(); gScreenManager->Quit();
delete gFontServer; delete gFontManager;
} }
@@ -378,9 +378,9 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
// Attached data: // Attached data:
// 1) port_id reply port // 1) port_id reply port
gFontServer->Lock(); gFontManager->Lock();
bool needsUpdate = gFontServer->FontsNeedUpdated(); bool needsUpdate = gFontManager->FontsNeedUpdated();
gFontServer->Unlock(); gFontManager->Unlock();
// Seeing how the client merely wants an answer, we'll skip the BPortLink // Seeing how the client merely wants an answer, we'll skip the BPortLink
// and all its overhead and just write the code to port. // and all its overhead and just write the code to port.
+2 -2
View File
@@ -16,7 +16,7 @@
#include "ColorUtils.h" #include "ColorUtils.h"
#include "DisplayDriver.h" #include "DisplayDriver.h"
#include "FontServer.h" #include "FontManager.h"
#include "LayerData.h" #include "LayerData.h"
#include "PatternHandler.h" #include "PatternHandler.h"
#include "RGBColor.h" #include "RGBColor.h"
@@ -38,7 +38,7 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
fTruncatedTitle("") fTruncatedTitle("")
{ {
ServerFont font(_look == B_FLOATING_WINDOW_LOOK ? ServerFont font(_look == B_FLOATING_WINDOW_LOOK ?
*gFontServer->GetSystemPlain() : *gFontServer->GetSystemBold()); *gFontManager->GetSystemPlain() : *gFontManager->GetSystemBold());
font.SetFlags(B_FORCE_ANTIALIASING); font.SetFlags(B_FORCE_ANTIALIASING);
font.SetSpacing(B_STRING_SPACING); font.SetSpacing(B_STRING_SPACING);
SetFont(&font); SetFont(&font);
@@ -16,7 +16,7 @@
#include <Path.h> #include <Path.h>
#include <String.h> #include <String.h>
#include <FontServer.h> #include <FontManager.h>
#include <FontFamily.h> #include <FontFamily.h>
#include <ServerFont.h> #include <ServerFont.h>
#include "ServerConfig.h" #include "ServerConfig.h"
@@ -26,7 +26,7 @@
static FTC_Manager ftmanager; static FTC_Manager ftmanager;
FT_Library gFreeTypeLibrary; FT_Library gFreeTypeLibrary;
FontServer *gFontServer = NULL; FontManager *gFontManager = NULL;
//#define PRINT_FONT_LIST //#define PRINT_FONT_LIST
@@ -49,7 +49,7 @@ face_requester(FTC_FaceID face_id, FT_Library library,
//! Does basic set up so that directories can be scanned //! Does basic set up so that directories can be scanned
FontServer::FontServer() FontManager::FontManager()
: BLocker("font server lock"), : BLocker("font server lock"),
fFamilies(20), fFamilies(20),
fPlain(NULL), fPlain(NULL),
@@ -72,7 +72,7 @@ FontServer::FontServer()
//! Frees items allocated in the constructor and shuts down FreeType //! Frees items allocated in the constructor and shuts down FreeType
FontServer::~FontServer() FontManager::~FontManager()
{ {
FTC_Manager_Done(ftmanager); FTC_Manager_Done(ftmanager);
FT_Done_FreeType(gFreeTypeLibrary); FT_Done_FreeType(gFreeTypeLibrary);
@@ -84,7 +84,7 @@ FontServer::~FontServer()
\return The number of unique font families currently available \return The number of unique font families currently available
*/ */
int32 int32
FontServer::CountFamilies(void) FontManager::CountFamilies(void)
{ {
return fFamilies.CountItems(); return fFamilies.CountItems();
} }
@@ -96,7 +96,7 @@ FontServer::CountFamilies(void)
\return The number of font styles currently available for the font family \return The number of font styles currently available for the font family
*/ */
int32 int32
FontServer::CountStyles(const char *familyName) FontManager::CountStyles(const char *familyName)
{ {
FontFamily *family = GetFamily(familyName); FontFamily *family = GetFamily(familyName);
if (family) if (family)
@@ -111,7 +111,7 @@ FontServer::CountStyles(const char *familyName)
\param family The family to remove \param family The family to remove
*/ */
void void
FontServer::RemoveFamily(const char *familyName) FontManager::RemoveFamily(const char *familyName)
{ {
FontFamily *family = GetFamily(familyName); FontFamily *family = GetFamily(familyName);
if (family) { if (family) {
@@ -123,7 +123,7 @@ FontServer::RemoveFamily(const char *familyName)
//! Scans the four default system font folders //! Scans the four default system font folders
void void
FontServer::ScanSystemFolders(void) FontManager::ScanSystemFolders(void)
{ {
ScanDirectory("/boot/beos/etc/fonts/ttfonts/"); ScanDirectory("/boot/beos/etc/fonts/ttfonts/");
@@ -140,7 +140,7 @@ FontServer::ScanSystemFolders(void)
\brief Adds the FontFamily/FontStyle that is represented by this path. \brief Adds the FontFamily/FontStyle that is represented by this path.
*/ */
void void
FontServer::_AddFont(BPath &path) FontManager::_AddFont(BPath &path)
{ {
FT_Face face; FT_Face face;
FT_Error error = FT_New_Face(gFreeTypeLibrary, path.Path(), 0, &face); FT_Error error = FT_New_Face(gFreeTypeLibrary, path.Path(), 0, &face);
@@ -181,7 +181,7 @@ FontServer::_AddFont(BPath &path)
\param directoryPath Path of the folder to scan. \param directoryPath Path of the folder to scan.
*/ */
status_t status_t
FontServer::ScanDirectory(const char *directoryPath) FontManager::ScanDirectory(const char *directoryPath)
{ {
// This bad boy does all the real work. It loads each entry in the // This bad boy does all the real work. It loads each entry in the
// directory. If a valid font file, it adds both the family and the style. // directory. If a valid font file, it adds both the family and the style.
@@ -232,7 +232,7 @@ FontServer::ScanDirectory(const char *directoryPath)
\return An FT_CharMap or NULL if unsuccessful \return An FT_CharMap or NULL if unsuccessful
*/ */
FT_CharMap FT_CharMap
FontServer::_GetSupportedCharmap(const FT_Face& face) FontManager::_GetSupportedCharmap(const FT_Face& face)
{ {
for (int32 i = 0; i < face->num_charmaps; i++) { for (int32 i = 0; i < face->num_charmaps; i++) {
FT_CharMap charmap = face->charmaps[i]; FT_CharMap charmap = face->charmaps[i];
@@ -266,7 +266,7 @@ FontServer::_GetSupportedCharmap(const FT_Face& face)
FontFamily* FontFamily*
FontServer::GetFamilyByIndex(int32 index) const FontManager::GetFamilyByIndex(int32 index) const
{ {
return fFamilies.ItemAt(index); return fFamilies.ItemAt(index);
} }
@@ -278,7 +278,7 @@ FontServer::GetFamilyByIndex(int32 index) const
\return Pointer to the specified family or NULL if not found. \return Pointer to the specified family or NULL if not found.
*/ */
FontFamily* FontFamily*
FontServer::GetFamily(const char* name) const FontManager::GetFamily(const char* name) const
{ {
if (name == NULL) if (name == NULL)
return NULL; return NULL;
@@ -296,7 +296,7 @@ FontServer::GetFamily(const char* name) const
FontFamily* FontFamily*
FontServer::GetFamily(uint16 familyID) const FontManager::GetFamily(uint16 familyID) const
{ {
for (int32 i = 0; i < fFamilies.CountItems(); i++) { for (int32 i = 0; i < fFamilies.CountItems(); i++) {
FontFamily *family = (FontFamily*)fFamilies.ItemAt(i); FontFamily *family = (FontFamily*)fFamilies.ItemAt(i);
@@ -309,7 +309,7 @@ FontServer::GetFamily(uint16 familyID) const
FontStyle* FontStyle*
FontServer::GetStyleByIndex(const char* familyName, int32 index) const FontManager::GetStyleByIndex(const char* familyName, int32 index) const
{ {
FontFamily* family = GetFamily(familyName); FontFamily* family = GetFamily(familyName);
if (family != NULL) if (family != NULL)
@@ -332,7 +332,7 @@ FontServer::GetStyleByIndex(const char* familyName, int32 index) const
\return The FontStyle having those attributes or NULL if not available \return The FontStyle having those attributes or NULL if not available
*/ */
FontStyle* FontStyle*
FontServer::GetStyle(const char* familyName, const char* styleName, uint16 familyID, FontManager::GetStyle(const char* familyName, const char* styleName, uint16 familyID,
uint16 styleID, uint16 face) uint16 styleID, uint16 face)
{ {
FontFamily* family; FontFamily* family;
@@ -367,7 +367,7 @@ FontServer::GetStyle(const char* familyName, const char* styleName, uint16 famil
\return The FontStyle having those attributes or NULL if not available \return The FontStyle having those attributes or NULL if not available
*/ */
FontStyle* FontStyle*
FontServer::GetStyle(uint16 familyID, uint16 styleID) FontManager::GetStyle(uint16 familyID, uint16 styleID)
{ {
FontFamily *family = GetFamily(familyID); FontFamily *family = GetFamily(familyID);
if (family) if (family)
@@ -384,7 +384,7 @@ FontServer::GetStyle(uint16 familyID, uint16 styleID)
Do NOT delete this object. If you access it, make a copy of it. Do NOT delete this object. If you access it, make a copy of it.
*/ */
ServerFont* ServerFont*
FontServer::GetSystemPlain() FontManager::GetSystemPlain()
{ {
return fPlain; return fPlain;
} }
@@ -397,7 +397,7 @@ FontServer::GetSystemPlain()
Do NOT delete this object. If you access it, make a copy of it. Do NOT delete this object. If you access it, make a copy of it.
*/ */
ServerFont* ServerFont*
FontServer::GetSystemBold() FontManager::GetSystemBold()
{ {
return fBold; return fBold;
} }
@@ -410,7 +410,7 @@ FontServer::GetSystemBold()
Do NOT delete this object. If you access it, make a copy of it. Do NOT delete this object. If you access it, make a copy of it.
*/ */
ServerFont* ServerFont*
FontServer::GetSystemFixed() FontManager::GetSystemFixed()
{ {
return fFixed; return fFixed;
} }
@@ -425,7 +425,7 @@ FontServer::GetSystemFixed()
*/ */
bool bool
FontServer::SetSystemPlain(const char* familyName, const char* styleName, float size) FontManager::SetSystemPlain(const char* familyName, const char* styleName, float size)
{ {
FontStyle *style = GetStyle(familyName, styleName); FontStyle *style = GetStyle(familyName, styleName);
if (style == NULL) if (style == NULL)
@@ -447,7 +447,7 @@ FontServer::SetSystemPlain(const char* familyName, const char* styleName, float
*/ */
bool bool
FontServer::SetSystemBold(const char* familyName, const char* styleName, float size) FontManager::SetSystemBold(const char* familyName, const char* styleName, float size)
{ {
FontStyle *style = GetStyle(familyName, styleName); FontStyle *style = GetStyle(familyName, styleName);
if (style == NULL) if (style == NULL)
@@ -469,7 +469,7 @@ FontServer::SetSystemBold(const char* familyName, const char* styleName, float s
*/ */
bool bool
FontServer::SetSystemFixed(const char* familyName, const char* styleName, float size) FontManager::SetSystemFixed(const char* familyName, const char* styleName, float size)
{ {
FontStyle *style = GetStyle(familyName, styleName); FontStyle *style = GetStyle(familyName, styleName);
if (style == NULL) if (style == NULL)
+1 -1
View File
@@ -35,7 +35,7 @@ SharedLibrary libappserver.so :
ServerBitmap.cpp ServerBitmap.cpp
ServerCursor.cpp ServerCursor.cpp
ServerFont.cpp ServerFont.cpp
FontServer.cpp FontManager.cpp
SystemPalette.cpp SystemPalette.cpp
TokenHandler.cpp TokenHandler.cpp
Utils.cpp Utils.cpp
+2 -2
View File
@@ -41,8 +41,8 @@ DrawData::DrawData()
fLineJoinMode(B_BEVEL_JOIN), fLineJoinMode(B_BEVEL_JOIN),
fMiterLimit(B_DEFAULT_MITER_LIMIT) fMiterLimit(B_DEFAULT_MITER_LIMIT)
{ {
if (gFontServer && gFontServer->GetSystemPlain()) if (gFontManager && gFontManager->GetSystemPlain())
fFont = *(gFontServer->GetSystemPlain()); fFont = *(gFontManager->GetSystemPlain());
fUnscaledFontSize = fFont.Size(); fUnscaledFontSize = fFont.Size();
} }
+48 -48
View File
@@ -36,7 +36,7 @@
#include "Desktop.h" #include "Desktop.h"
#include "DecorManager.h" #include "DecorManager.h"
#include "DisplayDriver.h" #include "DisplayDriver.h"
#include "FontServer.h" #include "FontManager.h"
#include "HWInterface.h" #include "HWInterface.h"
#include "LayerData.h" #include "LayerData.h"
#include "OffscreenServerWindow.h" #include "OffscreenServerWindow.h"
@@ -1117,9 +1117,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
// received when the client-side global font list has been // received when the client-side global font list has been
// refreshed // refreshed
gFontServer->Lock(); gFontManager->Lock();
gFontServer->FontsUpdated(); gFontManager->FontsUpdated();
gFontServer->Unlock(); gFontManager->Unlock();
break; break;
} }
case AS_QUERY_FONTS_CHANGED: case AS_QUERY_FONTS_CHANGED:
@@ -1131,9 +1131,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
bool checkonly; bool checkonly;
link.Read<bool>(&checkonly); link.Read<bool>(&checkonly);
gFontServer->Lock(); gFontManager->Lock();
bool needsUpdate = gFontServer->FontsNeedUpdated(); bool needsUpdate = gFontManager->FontsNeedUpdated();
gFontServer->Unlock(); gFontManager->Unlock();
if(checkonly) if(checkonly)
{ {
@@ -1144,9 +1144,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
{ {
if(needsUpdate) if(needsUpdate)
{ {
gFontServer->Lock(); gFontManager->Lock();
gFontServer->ScanSystemFolders(); gFontManager->ScanSystemFolders();
gFontServer->Unlock(); gFontManager->Unlock();
fLink.StartMessage(SERVER_TRUE); fLink.StartMessage(SERVER_TRUE);
fLink.Flush(); fLink.Flush();
} }
@@ -1170,9 +1170,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
int32 index; int32 index;
link.Read<int32>(&index); link.Read<int32>(&index);
gFontServer->Lock(); gFontManager->Lock();
FontFamily *family = gFontServer->GetFamilyByIndex(index); FontFamily *family = gFontManager->GetFamilyByIndex(index);
if (family) { if (family) {
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.AttachString(family->Name()); fLink.AttachString(family->Name());
@@ -1180,7 +1180,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1201,8 +1201,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.ReadString(family, sizeof(font_family)); link.ReadString(family, sizeof(font_family));
link.Read<int32>(&styleIndex); link.Read<int32>(&styleIndex);
gFontServer->Lock(); gFontManager->Lock();
FontStyle *fontStyle = gFontServer->GetStyleByIndex(family, styleIndex); FontStyle *fontStyle = gFontManager->GetStyleByIndex(family, styleIndex);
if (fontStyle != NULL) { if (fontStyle != NULL) {
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.AttachString(fontStyle->Name()); fLink.AttachString(fontStyle->Name());
@@ -1211,7 +1211,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1229,9 +1229,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<uint16>(&familyID); link.Read<uint16>(&familyID);
link.Read<uint16>(&styleID); link.Read<uint16>(&styleID);
gFontServer->Lock(); gFontManager->Lock();
FontStyle *fontStyle = gFontServer->GetStyle(familyID, styleID); FontStyle *fontStyle = gFontManager->GetStyle(familyID, styleID);
if (fontStyle != NULL) { if (fontStyle != NULL) {
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.AttachString(fontStyle->Family()->Name()); fLink.AttachString(fontStyle->Family()->Name());
@@ -1240,7 +1240,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
fLink.Flush(); fLink.Flush();
gFontServer->Unlock(); gFontManager->Unlock();
break; break;
} }
case AS_GET_FONT_DIRECTION: case AS_GET_FONT_DIRECTION:
@@ -1257,9 +1257,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<int32>(&familyID); link.Read<int32>(&familyID);
link.Read<int32>(&styleID); link.Read<int32>(&styleID);
gFontServer->Lock(); gFontManager->Lock();
FontStyle *fontStyle = gFontServer->GetStyle(familyID, styleID); FontStyle *fontStyle = gFontManager->GetStyle(familyID, styleID);
if (fontStyle) { if (fontStyle) {
font_direction direction = fontStyle->Direction(); font_direction direction = fontStyle->Direction();
@@ -1268,7 +1268,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1286,16 +1286,16 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<int32>(&familyID); link.Read<int32>(&familyID);
link.Read<int32>(&styleID); link.Read<int32>(&styleID);
gFontServer->Lock(); gFontManager->Lock();
FontStyle *fontStyle = gFontServer->GetStyle(familyID, styleID); FontStyle *fontStyle = gFontManager->GetStyle(familyID, styleID);
if (fontStyle) { if (fontStyle) {
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.Attach<uint16>((uint16)fontStyle->FileFormat()); fLink.Attach<uint16>((uint16)fontStyle->FileFormat());
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1394,16 +1394,16 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<uint16>(&familyID); link.Read<uint16>(&familyID);
link.Read<uint16>(&styleID); link.Read<uint16>(&styleID);
gFontServer->Lock(); gFontManager->Lock();
FontStyle *fontStyle = gFontServer->GetStyle(familyID, styleID); FontStyle *fontStyle = gFontManager->GetStyle(familyID, styleID);
if (fontStyle != NULL) { if (fontStyle != NULL) {
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.Attach<int32>(fontStyle->TunedCount()); fLink.Attach<int32>(fontStyle->TunedCount());
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1437,16 +1437,16 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<uint16>(&familyID); link.Read<uint16>(&familyID);
link.Read<uint16>(&styleID); link.Read<uint16>(&styleID);
gFontServer->Lock(); gFontManager->Lock();
FontStyle *fontStyle = gFontServer->GetStyle(familyID, styleID); FontStyle *fontStyle = gFontManager->GetStyle(familyID, styleID);
if (fontStyle != NULL) { if (fontStyle != NULL) {
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.Attach<bool>(fontStyle->IsFixedWidth()); fLink.Attach<bool>(fontStyle->IsFixedWidth());
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1476,9 +1476,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
&& link.Read<uint16>(&styleID) == B_OK && link.Read<uint16>(&styleID) == B_OK
&& link.Read<uint16>(&face) == B_OK) { && link.Read<uint16>(&face) == B_OK) {
// get the font and return IDs and face // get the font and return IDs and face
gFontServer->Lock(); gFontManager->Lock();
FontStyle *fontStyle = gFontServer->GetStyle(family, style, FontStyle *fontStyle = gFontManager->GetStyle(family, style,
familyID, styleID, face); familyID, styleID, face);
if (fontStyle != NULL) { if (fontStyle != NULL) {
@@ -1493,7 +1493,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
} else } else
fLink.StartMessage(B_NAME_NOT_FOUND); fLink.StartMessage(B_NAME_NOT_FOUND);
gFontServer->Unlock(); gFontManager->Unlock();
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
@@ -1506,13 +1506,13 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
// Returns: // Returns:
// 1) int32 - # of font families // 1) int32 - # of font families
gFontServer->Lock(); gFontManager->Lock();
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.Attach<int32>(gFontServer->CountFamilies()); fLink.Attach<int32>(gFontManager->CountFamilies());
fLink.Flush(); fLink.Flush();
gFontServer->Unlock(); gFontManager->Unlock();
break; break;
} }
case AS_COUNT_FONT_STYLES: case AS_COUNT_FONT_STYLES:
@@ -1526,16 +1526,16 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
font_family familyName; font_family familyName;
link.ReadString(familyName, sizeof(font_family)); link.ReadString(familyName, sizeof(font_family));
gFontServer->Lock(); gFontManager->Lock();
FontFamily *family = gFontServer->GetFamily(familyName); FontFamily *family = gFontManager->GetFamily(familyName);
if (family != NULL) { if (family != NULL) {
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.Attach<int32>(family->CountStyles()); fLink.Attach<int32>(family->CountStyles());
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1551,18 +1551,18 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
// 4) uint16 - face flags // 4) uint16 - face flags
// 5) uint32 - font flags // 5) uint32 - font flags
gFontServer->Lock(); gFontManager->Lock();
ServerFont *font = NULL; ServerFont *font = NULL;
switch (code) { switch (code) {
case AS_SET_SYSFONT_PLAIN: case AS_SET_SYSFONT_PLAIN:
font = gFontServer->GetSystemPlain(); font = gFontManager->GetSystemPlain();
break; break;
case AS_SET_SYSFONT_BOLD: case AS_SET_SYSFONT_BOLD:
font = gFontServer->GetSystemBold(); font = gFontManager->GetSystemBold();
break; break;
case AS_SET_SYSFONT_FIXED: case AS_SET_SYSFONT_FIXED:
font = gFontServer->GetSystemFixed(); font = gFontManager->GetSystemFixed();
break; break;
} }
@@ -1576,7 +1576,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1593,16 +1593,16 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<uint16>(&styleID); link.Read<uint16>(&styleID);
link.Read<float>(&size); link.Read<float>(&size);
gFontServer->Lock(); gFontManager->Lock();
FontStyle *fontStyle = gFontServer->GetStyle(familyID, styleID); FontStyle *fontStyle = gFontManager->GetStyle(familyID, styleID);
if (fontStyle != NULL) { if (fontStyle != NULL) {
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.Attach<font_height>(fontStyle->GetHeight(size)); fLink.Attach<font_height>(fontStyle->GetHeight(size));
} else } else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
gFontServer->Unlock(); gFontManager->Unlock();
fLink.Flush(); fLink.Flush();
break; break;
} }
+4 -4
View File
@@ -14,7 +14,7 @@
#include <UTF8.h> #include <UTF8.h>
#include "Angle.h" #include "Angle.h"
#include "FontServer.h" #include "FontManager.h"
#include "moreUTF8.h" #include "moreUTF8.h"
#include "truncate_string.h" #include "truncate_string.h"
@@ -267,9 +267,9 @@ ServerFont::SetFamilyAndStyle(uint16 familyID, uint16 styleID)
{ {
FontStyle* style = NULL; FontStyle* style = NULL;
if (gFontServer->Lock()) { if (gFontManager->Lock()) {
style = gFontServer->GetStyle(familyID, styleID); style = gFontManager->GetStyle(familyID, styleID);
gFontServer->Unlock(); gFontManager->Unlock();
} }
if (!style) if (!style)
+1 -1
View File
@@ -25,7 +25,7 @@ StaticLibrary libpainter.a :
# font_support # font_support
# is contained within libagg.a, # is contained within libagg.a,
# but we need a modified version that # but we need a modified version that
# uses the FontServer # uses the FontManager
agg_font_freetype.cpp agg_font_freetype.cpp
AGGTextRenderer.cpp AGGTextRenderer.cpp
+2 -2
View File
@@ -89,8 +89,8 @@ Painter::Painter()
fPatternHandler(new PatternHandler()), fPatternHandler(new PatternHandler()),
fTextRenderer(new AGGTextRenderer()) fTextRenderer(new AGGTextRenderer())
{ {
if (gFontServer && gFontServer->GetSystemPlain()) if (gFontManager && gFontManager->GetSystemPlain())
fFont = *gFontServer->GetSystemPlain(); fFont = *gFontManager->GetSystemPlain();
_UpdateFont(); _UpdateFont();
_UpdateLineWidth(); _UpdateLineWidth();
+1 -1
View File
@@ -12,7 +12,7 @@
#include <Font.h> #include <Font.h>
#include <Rect.h> #include <Rect.h>
#include <FontServer.h> #include <FontManager.h>
#include <ServerFont.h> #include <ServerFont.h>
#include "defines.h" #include "defines.h"
@@ -8,7 +8,7 @@
#include <Bitmap.h> #include <Bitmap.h>
#include <ByteOrder.h> #include <ByteOrder.h>
#include <Entry.h> #include <Entry.h>
#include <FontServer.h> #include <FontManager.h>
#include <Message.h> #include <Message.h>
#include <ServerFont.h> #include <ServerFont.h>
#include <UTF8.h> #include <UTF8.h>