* Removing fonts now works as expected.
* removing a font family or style now always goes through the font manager. * removed FreeType "cache" remains (it wasn't used, anyway, and won't be used by us). * renamed SharedObject to ReferenceCounting as that's what it does. * the default fonts weren't deleted on shutdown. * added temporary work-around for waiting until a newly created entry is complete (just waits a moment...) - this will be fixed once Haiku supports this in a better way. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14833 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include "SharedObject.h"
|
||||
#include "ReferenceCounting.h"
|
||||
#include "HashTable.h"
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class FontKey : public Hashable {
|
||||
FontStyle objects help abstract a lot of the font engine details while
|
||||
still offering plenty of information the style in question.
|
||||
*/
|
||||
class FontStyle : public SharedObject, public Hashable, public BLocker {
|
||||
class FontStyle : public ReferenceCounting, public Hashable, public BLocker {
|
||||
public:
|
||||
FontStyle(node_ref& nodeRef, const char* path, FT_Face face);
|
||||
virtual ~FontStyle();
|
||||
@@ -189,8 +189,7 @@ class FontFamily {
|
||||
const char* Name() const;
|
||||
|
||||
bool AddStyle(FontStyle* style);
|
||||
bool RemoveStyle(const char* style, bool deleteSelfIfEmpty = true);
|
||||
bool RemoveStyle(FontStyle* style, bool deleteSelfIfEmpty = true);
|
||||
bool RemoveStyle(FontStyle* style);
|
||||
|
||||
FontStyle* GetStyle(const char* style) const;
|
||||
FontStyle* GetStyleMatchingFace(uint16 face) const;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_CACHE_H
|
||||
|
||||
class BPath;
|
||||
|
||||
@@ -56,6 +55,9 @@ class FontManager : public BLooper {
|
||||
FontStyle *GetStyle(uint16 familyID, uint16 styleID) const;
|
||||
FontStyle* FindStyleMatchingFace(uint16 face) const;
|
||||
|
||||
void RemoveStyle(FontStyle* style);
|
||||
// this call must not be used by anything else than class FontStyle
|
||||
|
||||
const ServerFont* DefaultPlainFont() const;
|
||||
const ServerFont* DefaultBoldFont() const;
|
||||
const ServerFont* DefaultFixedFont() const;
|
||||
@@ -78,8 +80,9 @@ class FontManager : public BLooper {
|
||||
status_t _AddPath(const char* path);
|
||||
status_t _AddPath(BEntry& entry, font_directory** _newDirectory = NULL);
|
||||
|
||||
void _RemoveStyle(font_directory& directory, FontStyle* style);
|
||||
void _RemoveStyle(dev_t device, uint64 directory, uint64 node);
|
||||
FontFamily* _FindFamily(const char* family) const;
|
||||
void _RemoveFamily(const char* family);
|
||||
|
||||
void _ScanFontsIfNecessary();
|
||||
void _ScanFonts();
|
||||
|
||||
+13
-13
@@ -6,26 +6,26 @@
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef SHARED_OBJECT_H
|
||||
#define SHARED_OBJECT_H
|
||||
#ifndef REFERENCE_COUNTING_H
|
||||
#define REFERENCE_COUNTING_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
/*!
|
||||
\class SharedObject SharedObject.h
|
||||
\brief Base class for shared objects
|
||||
|
||||
SharedObjects track dependencies upon a particular object. In this way, is is
|
||||
possible to ensure that a shared resource is not deleted if something else
|
||||
\class ReferenceCounting ReferenceCounting.h
|
||||
\brief Base class for reference counting objects
|
||||
|
||||
ReferenceCounting objects track dependencies upon a particular object. In this way,
|
||||
it is possible to ensure that a shared resource is not deleted if something else
|
||||
needs it. How the dependency tracking is done largely depends on the child class.
|
||||
*/
|
||||
class SharedObject {
|
||||
class ReferenceCounting {
|
||||
public:
|
||||
SharedObject()
|
||||
ReferenceCounting()
|
||||
: fReferenceCount(1) {}
|
||||
virtual ~SharedObject() {}
|
||||
virtual ~ReferenceCounting() {}
|
||||
|
||||
inline void Acquire();
|
||||
inline bool Release();
|
||||
@@ -36,13 +36,13 @@ class SharedObject {
|
||||
|
||||
|
||||
inline void
|
||||
SharedObject::Acquire()
|
||||
ReferenceCounting::Acquire()
|
||||
{
|
||||
atomic_add(&fReferenceCount, 1);
|
||||
}
|
||||
|
||||
inline bool
|
||||
SharedObject::Release()
|
||||
ReferenceCounting::Release()
|
||||
{
|
||||
if (atomic_add(&fReferenceCount, -1) == 1) {
|
||||
delete this;
|
||||
@@ -52,4 +52,4 @@ SharedObject::Release()
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* SHARED_OBJECT_H */
|
||||
#endif /* REFERENCE_COUNTING_H */
|
||||
Reference in New Issue
Block a user