2006-03-18 19:42:14 +03:00
|
|
|
/*
|
2007-08-02 23:10:38 +04:00
|
|
|
* Copyright 2001-2007, Haiku.
|
2006-03-18 19:42:14 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
* Jérôme Duval, jerome.duval@free.fr
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
2007-08-02 23:10:38 +04:00
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
2006-03-18 19:42:14 +03:00
|
|
|
*/
|
|
|
|
#ifndef SERVER_FONT_H
|
|
|
|
#define SERVER_FONT_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <Font.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
|
|
|
|
#include "FontFamily.h"
|
2007-08-02 23:10:38 +04:00
|
|
|
#include "Transformable.h"
|
2006-03-18 19:42:14 +03:00
|
|
|
|
|
|
|
class BShape;
|
|
|
|
class BString;
|
|
|
|
|
|
|
|
|
|
|
|
class ServerFont {
|
|
|
|
public:
|
|
|
|
ServerFont();
|
|
|
|
ServerFont(FontStyle& style,
|
|
|
|
float size = 12.0,
|
2006-12-18 08:22:13 +03:00
|
|
|
float rotation = 0.0,
|
|
|
|
float shear = 90.0,
|
|
|
|
float falseBoldWidth = 0.0,
|
2006-03-18 19:42:14 +03:00
|
|
|
uint16 flags = 0,
|
|
|
|
uint8 spacing = B_CHAR_SPACING);
|
|
|
|
ServerFont(const ServerFont& font);
|
|
|
|
virtual ~ServerFont();
|
|
|
|
|
|
|
|
ServerFont &operator=(const ServerFont& font);
|
|
|
|
|
|
|
|
font_direction Direction() const
|
|
|
|
{ return fDirection; }
|
|
|
|
uint32 Encoding() const
|
|
|
|
{ return fEncoding; }
|
|
|
|
uint32 Flags() const
|
|
|
|
{ return fFlags; }
|
|
|
|
uint32 Spacing() const
|
|
|
|
{ return fSpacing; }
|
|
|
|
float Shear() const
|
|
|
|
{ return fShear; }
|
|
|
|
float Rotation() const
|
|
|
|
{ return fRotation; }
|
2006-12-18 08:22:13 +03:00
|
|
|
float FalseBoldWidth() const
|
|
|
|
{ return fFalseBoldWidth; }
|
2006-03-18 19:42:14 +03:00
|
|
|
float Size() const
|
|
|
|
{ return fSize; }
|
|
|
|
uint16 Face() const
|
|
|
|
{ return fFace; }
|
|
|
|
uint32 CountGlyphs()
|
|
|
|
{ return fStyle->GlyphCount(); }
|
|
|
|
int32 CountTuned();
|
|
|
|
|
|
|
|
font_file_format FileFormat();
|
|
|
|
|
|
|
|
const char* Style() const;
|
|
|
|
const char* Family() const;
|
|
|
|
const char* Path() const
|
|
|
|
{ return fStyle->Path(); }
|
|
|
|
|
|
|
|
void SetStyle(FontStyle* style);
|
|
|
|
status_t SetFamilyAndStyle(uint16 familyID,
|
|
|
|
uint16 styleID);
|
|
|
|
status_t SetFamilyAndStyle(uint32 fontID);
|
|
|
|
|
|
|
|
uint16 StyleID() const
|
|
|
|
{ return fStyle->ID(); }
|
|
|
|
uint16 FamilyID() const
|
|
|
|
{ return fStyle->Family()->ID(); }
|
|
|
|
uint32 GetFamilyAndStyle() const;
|
|
|
|
|
|
|
|
void SetDirection(font_direction dir)
|
|
|
|
{ fDirection = dir; }
|
|
|
|
void SetEncoding(uint32 encoding)
|
|
|
|
{ fEncoding = encoding; }
|
|
|
|
void SetFlags(uint32 value)
|
|
|
|
{ fFlags = value; }
|
|
|
|
void SetSpacing(uint32 value)
|
|
|
|
{ fSpacing = value; }
|
|
|
|
void SetShear(float value)
|
|
|
|
{ fShear = value; }
|
|
|
|
void SetSize(float value)
|
|
|
|
{ fSize = value; }
|
|
|
|
void SetRotation(float value)
|
|
|
|
{ fRotation = value; }
|
2006-12-18 08:22:13 +03:00
|
|
|
void SetFalseBoldWidth(float value)
|
|
|
|
{ fFalseBoldWidth = value; }
|
2006-03-18 19:42:14 +03:00
|
|
|
void SetFace(uint32 face);
|
|
|
|
|
|
|
|
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(); }
|
|
|
|
|
|
|
|
|
2007-07-18 00:48:54 +04:00
|
|
|
FT_Face GetTransformedFace(bool rotate,
|
|
|
|
bool shear) const;
|
2006-03-18 19:42:14 +03:00
|
|
|
void PutTransformedFace(FT_Face face) const;
|
|
|
|
|
|
|
|
status_t GetGlyphShapes(const char charArray[],
|
|
|
|
int32 numChars, BShape *shapeArray[]) const;
|
|
|
|
|
|
|
|
status_t GetHasGlyphs(const char charArray[],
|
2007-08-11 17:34:09 +04:00
|
|
|
int32 numBytes, bool hasArray[]) const;
|
2006-03-18 19:42:14 +03:00
|
|
|
|
2007-08-11 17:34:09 +04:00
|
|
|
status_t GetEdges(const char charArray[], int32 numBytes,
|
2007-07-18 00:48:54 +04:00
|
|
|
edge_info edgeArray[]) const;
|
2006-03-18 19:42:14 +03:00
|
|
|
|
|
|
|
status_t GetEscapements(const char charArray[],
|
2007-08-11 17:34:09 +04:00
|
|
|
int32 numBytes, escapement_delta delta,
|
2006-03-18 19:42:14 +03:00
|
|
|
BPoint escapementArray[],
|
|
|
|
BPoint offsetArray[]) const;
|
|
|
|
|
|
|
|
status_t GetEscapements(const char charArray[],
|
2007-08-11 17:34:09 +04:00
|
|
|
int32 numBytes, escapement_delta delta,
|
2006-03-18 19:42:14 +03:00
|
|
|
float widthArray[]) const;
|
|
|
|
|
2007-08-02 23:10:38 +04:00
|
|
|
status_t GetBoundingBoxes(const char charArray[],
|
2007-08-11 17:34:09 +04:00
|
|
|
int32 numBytes, BRect rectArray[],
|
2007-07-18 00:48:54 +04:00
|
|
|
bool stringEscapement,
|
|
|
|
font_metric_mode mode,
|
2007-08-02 23:10:38 +04:00
|
|
|
escapement_delta delta,
|
|
|
|
bool asString);
|
2006-03-18 19:42:14 +03:00
|
|
|
|
|
|
|
status_t GetBoundingBoxesForStrings(char *charArray[],
|
|
|
|
int32 lengthArray[], int32 numStrings,
|
|
|
|
BRect rectArray[], font_metric_mode mode,
|
|
|
|
escapement_delta deltaArray[]);
|
|
|
|
|
2007-07-18 00:48:54 +04:00
|
|
|
float StringWidth(const char *string,
|
2007-08-11 17:34:09 +04:00
|
|
|
int32 numBytes,
|
2007-08-02 23:10:38 +04:00
|
|
|
const escapement_delta* delta = NULL) const;
|
2006-03-18 19:42:14 +03:00
|
|
|
|
|
|
|
bool Lock() const { return fStyle->Lock(); }
|
|
|
|
void Unlock() const { fStyle->Unlock(); }
|
|
|
|
|
2007-08-11 17:34:09 +04:00
|
|
|
// FT_Face GetFTFace() const
|
|
|
|
// { return fStyle->FreeTypeFace(); };
|
2006-03-18 19:42:14 +03:00
|
|
|
|
|
|
|
BRect BoundingBox();
|
|
|
|
void GetHeight(font_height& height) const;
|
|
|
|
|
|
|
|
void TruncateString(BString* inOut,
|
|
|
|
uint32 mode,
|
|
|
|
float width) const;
|
|
|
|
|
2007-08-02 23:10:38 +04:00
|
|
|
Transformable EmbeddedTransformation() const;
|
|
|
|
|
2006-03-18 19:42:14 +03:00
|
|
|
protected:
|
|
|
|
friend class FontStyle;
|
|
|
|
|
|
|
|
FontStyle* fStyle;
|
|
|
|
float fSize;
|
|
|
|
float fRotation;
|
|
|
|
float fShear;
|
2006-12-18 08:22:13 +03:00
|
|
|
float fFalseBoldWidth;
|
2006-03-18 19:42:14 +03:00
|
|
|
BRect fBounds;
|
|
|
|
uint32 fFlags;
|
|
|
|
uint32 fSpacing;
|
|
|
|
font_direction fDirection;
|
|
|
|
uint16 fFace;
|
|
|
|
uint32 fEncoding;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* SERVER_FONT_H */
|