2005-08-24 15:08:32 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
2005-11-03 13:10:28 +00:00
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
* Jérôme Duval, jerome.duval@free.fr
|
2005-11-03 17:03:36 +00:00
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
2005-08-24 15:08:32 +00:00
|
|
|
*/
|
2005-11-03 17:03:36 +00:00
|
|
|
#ifndef SERVER_FONT_H
|
|
|
|
#define SERVER_FONT_H
|
2002-12-31 22:19:48 +00:00
|
|
|
|
2005-11-03 13:10:28 +00:00
|
|
|
|
2002-12-31 22:19:48 +00:00
|
|
|
#include <Font.h>
|
2005-06-03 19:50:30 +00:00
|
|
|
#include <Rect.h>
|
|
|
|
|
2005-01-17 02:04:21 +00:00
|
|
|
#include "FontFamily.h"
|
2002-12-31 22:19:48 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
class BShape;
|
|
|
|
class BString;
|
|
|
|
|
2005-11-03 13:10:28 +00:00
|
|
|
|
2005-05-12 15:09:30 +00:00
|
|
|
class ServerFont {
|
|
|
|
public:
|
|
|
|
ServerFont();
|
2005-11-03 13:10:28 +00:00
|
|
|
ServerFont(FontStyle& style,
|
2005-05-12 15:09:30 +00:00
|
|
|
float size = 12.0,
|
|
|
|
float fRotation = 0.0,
|
|
|
|
float fShear = 90.0,
|
|
|
|
uint16 flags = 0,
|
|
|
|
uint8 spacing = B_CHAR_SPACING);
|
|
|
|
ServerFont(const ServerFont& font);
|
|
|
|
virtual ~ServerFont();
|
2005-04-14 00:22:01 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
ServerFont &operator=(const ServerFont& font);
|
|
|
|
|
2005-05-12 15:09:30 +00:00
|
|
|
font_direction Direction() const
|
|
|
|
{ return fDirection; }
|
|
|
|
uint32 Encoding() const
|
|
|
|
{ return fEncoding; }
|
|
|
|
edge_info Edges() const
|
|
|
|
{ return fEdges; }
|
|
|
|
uint32 Flags() const
|
|
|
|
{ return fFlags; }
|
|
|
|
uint32 Spacing() const
|
|
|
|
{ return fSpacing; }
|
|
|
|
float Shear() const
|
|
|
|
{ return fShear; }
|
|
|
|
float Rotation() const
|
|
|
|
{ return fRotation; }
|
|
|
|
float Size() const
|
|
|
|
{ return fSize; }
|
|
|
|
uint16 Face() const
|
|
|
|
{ return fFace; }
|
|
|
|
uint32 CountGlyphs()
|
|
|
|
{ return fStyle->GlyphCount(); }
|
|
|
|
int32 CountTuned();
|
|
|
|
|
|
|
|
font_file_format FileFormat();
|
2005-06-03 19:50:30 +00:00
|
|
|
|
2005-11-09 20:10:40 +00:00
|
|
|
const char* Style() const;
|
|
|
|
const char* Family() const;
|
|
|
|
const char* Path() const
|
2005-10-31 23:21:36 +00:00
|
|
|
{ return fStyle->Path(); }
|
2005-11-03 17:03:36 +00:00
|
|
|
|
ServerFont:
* fixed weird pointer conversion in SetStyle()
* fixed a potential mix up in operator=() in case the
other ServerFont has fStyle == NULL
ServerWindow:
* the WindowLayer fTopLayer cannot be deleted by
client request, just for safety reasons
* the link is flushed if there is no drawing engine,
but this case is theoretical only
* deleting the ServerWindow object syncs with the
client, so that when BBitmaps are deleted, they
can be sure there are no pending messages (which
would be executed in a nother thread)
* there is no timeout anymore when sending messages
to the client, which made absolutely no sense
AGGTextRenderer:
* renamed fFontManager to fFontCache, because that's
what it really is
* fLastFamilyAndStyle defaulted to the system plain
font and therefor that font was never loaded when
the font never changed meanwhile
DrawingMode:
* I'm not quite sure but I think there was the
potential of a division by zero, at least I
had crashes with "divide error"
HWInterface:
* fix update when the cursor shape changed in
double buffered mode
ViewLayer:
* since the top layer is never really deleted
before its time has come, it is not necessary
to set it to NULL in the ViewLayer destructor
ViewLayer/WindowLayer:
* added a function to collect the view tokens
that are affected by an update session
EventDispatcher:
* use the importance of the message for the timeout
in _SendMessage()
* drop mouse moved events in the server if we're
lagging behind more than 5 ms (Axel, maybe review)
View:
* there were some problems with the locking
of the BWindow looper in RemoveSelf(), since
this is called from the window destructor,
also of BWindows from BBitmaps, which have
never been run (this might need review), at
least I seem to have solved the crashing
problems introduced by actually deleting the
view hirarchy in the BWindow destructor
* fixed _Draw() for being used non-recursively,
temporarily disabled DrawAfterChildren, which
didn't work yet anyways (because views cannot
draw over children in the server yet)
Window:
* small cleanup when deleting shortcuts
* sync with the server when having send
AS_DELETE_WINDOW (see ServerWindow above)
* fixed locking in Begin/EndViewTransaction()
* removed folding of _UPDATE_ messages, since
there is only one ever in the queue
* set the fInTransaction flag during an update,
I plan to use this in BView later to
flush the link when drawing outside of an
update
* BView::_Draw() is now called by view token,
this gives the next leap forward in speed,
the overhead because of drawing clean views
was considerable
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-01-08 22:04:52 +00:00
|
|
|
void SetStyle(FontStyle* style);
|
2005-06-03 19:50:30 +00:00
|
|
|
status_t SetFamilyAndStyle(uint16 familyID,
|
|
|
|
uint16 styleID);
|
|
|
|
status_t SetFamilyAndStyle(uint32 fontID);
|
|
|
|
|
|
|
|
uint16 StyleID() const
|
2005-10-31 23:21:36 +00:00
|
|
|
{ return fStyle->ID(); }
|
2005-06-03 19:50:30 +00:00
|
|
|
uint16 FamilyID() const
|
2005-10-31 23:21:36 +00:00
|
|
|
{ return fStyle->Family()->ID(); }
|
2005-06-03 19:50:30 +00:00
|
|
|
uint32 GetFamilyAndStyle() const;
|
|
|
|
|
2005-11-09 20:10:40 +00:00
|
|
|
void SetDirection(font_direction dir)
|
2005-05-12 15:09:30 +00:00
|
|
|
{ fDirection = dir; }
|
2005-11-09 20:10:40 +00:00
|
|
|
void SetEdges(edge_info info)
|
2005-05-12 15:09:30 +00:00
|
|
|
{ fEdges = info; }
|
|
|
|
void SetEncoding(uint32 encoding)
|
|
|
|
{ fEncoding = encoding; }
|
2005-11-09 20:10:40 +00:00
|
|
|
void SetFlags(uint32 value)
|
2005-05-12 15:09:30 +00:00
|
|
|
{ fFlags = value; }
|
2005-11-09 20:10:40 +00:00
|
|
|
void SetSpacing(uint32 value)
|
2005-05-12 15:09:30 +00:00
|
|
|
{ fSpacing = value; }
|
2005-11-09 20:10:40 +00:00
|
|
|
void SetShear(float value)
|
2005-05-12 15:09:30 +00:00
|
|
|
{ fShear = value; }
|
2005-11-09 20:10:40 +00:00
|
|
|
void SetSize(float value)
|
2005-05-12 15:09:30 +00:00
|
|
|
{ fSize = value; }
|
2005-11-09 20:10:40 +00:00
|
|
|
void SetRotation(float value)
|
2005-05-12 15:09:30 +00:00
|
|
|
{ fRotation = value; }
|
2005-11-09 20:10:40 +00:00
|
|
|
void SetFace(uint32 face);
|
|
|
|
|
2005-05-12 15:09:30 +00:00
|
|
|
bool IsFixedWidth() const
|
|
|
|
{ return fStyle->IsFixedWidth(); }
|
|
|
|
bool IsScalable() const
|
|
|
|
{ return fStyle->IsScalable(); }
|
|
|
|
bool HasKerning() const
|
|
|
|
{ return fStyle->HasKerning(); }
|
|
|
|
bool HasTuned() const
|
|
|
|
{ return fStyle->HasTuned(); }
|
|
|
|
int32 TunedCount() const
|
|
|
|
{ return fStyle->TunedCount(); }
|
|
|
|
uint16 GlyphCount() const
|
|
|
|
{ return fStyle->GlyphCount(); }
|
|
|
|
uint16 CharMapCount() const
|
|
|
|
{ return fStyle->CharMapCount(); }
|
2005-06-03 19:50:30 +00:00
|
|
|
|
2005-05-12 15:09:30 +00:00
|
|
|
BShape** GetGlyphShapes(const char charArray[],
|
2005-08-24 14:50:41 +00:00
|
|
|
int32 numChars) const;
|
2005-05-12 15:09:30 +00:00
|
|
|
|
2005-07-19 15:22:55 +00:00
|
|
|
void GetHasGlyphs(const char charArray[],
|
2005-08-24 14:50:41 +00:00
|
|
|
int32 numChars, bool hasArray[]) const;
|
|
|
|
|
|
|
|
void GetEdges(const char charArray[],
|
|
|
|
int32 numChars, edge_info edgeArray[]) const;
|
2005-07-19 15:22:55 +00:00
|
|
|
|
2005-05-12 15:09:30 +00:00
|
|
|
BPoint* GetEscapements(const char charArray[],
|
|
|
|
int32 numChars,
|
|
|
|
BPoint offsetArray[]) const;
|
|
|
|
bool GetEscapements(const char charArray[],
|
|
|
|
int32 numChars,
|
2005-11-02 13:14:03 +00:00
|
|
|
int32 numBytes,
|
2005-05-12 15:09:30 +00:00
|
|
|
float widthArray[],
|
|
|
|
escapement_delta delta) const;
|
2005-05-20 17:36:55 +00:00
|
|
|
|
2005-08-25 15:21:34 +00:00
|
|
|
bool GetBoundingBoxesAsString(const char charArray[],
|
2005-08-30 14:53:42 +00:00
|
|
|
int32 numChars, BRect rectArray[], bool string_escapement,
|
2005-08-25 15:21:34 +00:00
|
|
|
font_metric_mode mode, escapement_delta delta);
|
|
|
|
|
2005-08-26 15:03:36 +00:00
|
|
|
bool GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[],
|
2005-08-25 15:21:34 +00:00
|
|
|
int32 numStrings, BRect rectArray[],
|
|
|
|
font_metric_mode mode, escapement_delta deltaArray[]);
|
|
|
|
|
2005-05-20 23:51:33 +00:00
|
|
|
float StringWidth(const char* string, int32 numBytes) const;
|
2005-05-20 17:36:55 +00:00
|
|
|
|
2005-10-28 09:52:26 +00:00
|
|
|
bool Lock() const { return fStyle->Lock(); }
|
|
|
|
void Unlock() const { fStyle->Unlock(); }
|
|
|
|
|
2005-05-12 15:09:30 +00:00
|
|
|
FT_Face GetFTFace() const
|
2005-11-03 13:10:28 +00:00
|
|
|
{ return fStyle->FreeTypeFace(); };
|
2005-01-17 02:04:21 +00:00
|
|
|
|
2005-05-12 15:09:30 +00:00
|
|
|
BRect BoundingBox();
|
2005-11-03 13:10:28 +00:00
|
|
|
void GetHeight(font_height& height) const;
|
2005-06-03 19:50:30 +00:00
|
|
|
|
|
|
|
void TruncateString(BString* inOut,
|
|
|
|
uint32 mode,
|
|
|
|
float width) const;
|
2005-05-12 15:09:30 +00:00
|
|
|
|
2002-12-31 22:19:48 +00:00
|
|
|
protected:
|
2003-06-23 02:54:52 +00:00
|
|
|
friend class FontStyle;
|
2005-05-12 15:09:30 +00:00
|
|
|
|
|
|
|
FontStyle* fStyle;
|
|
|
|
edge_info fEdges;
|
|
|
|
float fSize;
|
|
|
|
float fRotation;
|
|
|
|
float fShear;
|
|
|
|
BRect fBounds;
|
|
|
|
uint32 fFlags;
|
|
|
|
uint32 fSpacing;
|
|
|
|
font_direction fDirection;
|
2005-06-03 19:50:30 +00:00
|
|
|
uint16 fFace;
|
2005-05-12 15:09:30 +00:00
|
|
|
uint32 fEncoding;
|
2002-12-31 22:19:48 +00:00
|
|
|
};
|
|
|
|
|
2005-11-03 17:03:36 +00:00
|
|
|
#endif /* SERVER_FONT_H */
|