2003-01-01 01:19:48 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2004-09-21 02:46:37 +04:00
|
|
|
// Copyright (c) 2001-2002, Haiku, Inc.
|
2003-01-01 01:19:48 +03:00
|
|
|
//
|
|
|
|
// 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: ServerFont.h
|
|
|
|
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
// Description: Shadow BFont class
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
#ifndef SERVERFONT_H_
|
|
|
|
#define SERVERFONT_H_
|
|
|
|
|
|
|
|
#include <Rect.h>
|
|
|
|
#include <Font.h>
|
2005-01-17 05:04:21 +03:00
|
|
|
#include "FontFamily.h"
|
2003-01-01 01:19:48 +03:00
|
|
|
|
|
|
|
class ServerFont
|
|
|
|
{
|
|
|
|
public:
|
2003-10-05 21:51:13 +04:00
|
|
|
ServerFont(void);
|
2005-01-21 16:11:46 +03:00
|
|
|
ServerFont(FontStyle *style, float size=12.0, float frotation=0.0, float fshear=90.0,
|
2003-01-01 01:19:48 +03:00
|
|
|
uint16 flags=0, uint8 spacing=B_CHAR_SPACING);
|
|
|
|
ServerFont(const ServerFont &font);
|
|
|
|
~ServerFont(void);
|
2005-04-14 04:22:01 +04:00
|
|
|
|
|
|
|
// TODO: make more advanced...
|
|
|
|
status_t InitCheck() const
|
|
|
|
{ return fStyle ? B_OK : B_NO_INIT; }
|
|
|
|
|
|
|
|
|
2005-01-21 16:11:46 +03:00
|
|
|
font_direction Direction(void) const { return fDirection; }
|
|
|
|
uint32 Encoding(void) const { return fEncoding; }
|
|
|
|
edge_info Edges(void) const { return fEdges; }
|
|
|
|
uint32 Flags(void) const { return fFlags; }
|
|
|
|
uint32 Spacing(void) const { return fSpacing; }
|
2004-02-03 03:51:23 +03:00
|
|
|
float Shear(void) const { return fshear; }
|
|
|
|
float Rotation(void) const { return frotation; }
|
2005-01-21 16:11:46 +03:00
|
|
|
float Size(void) const { return fSize; }
|
|
|
|
uint16 Face(void) const { return fFace; }
|
|
|
|
uint32 CountGlyphs(void) { return fStyle->GlyphCount(); }
|
2003-01-01 01:19:48 +03:00
|
|
|
int32 CountTuned(void);
|
|
|
|
font_file_format FileFormat(void);
|
2005-01-21 16:11:46 +03:00
|
|
|
|
2005-02-05 23:10:24 +03:00
|
|
|
status_t SetFamilyAndStyle(const uint16 &familyID,const uint16 &styleID);
|
|
|
|
status_t SetFamilyAndStyle(const uint32 &fontID);
|
2005-01-21 16:11:46 +03:00
|
|
|
void SetDirection(const font_direction &dir) { fDirection=dir; }
|
|
|
|
void SetEdges(const edge_info &info) { fEdges=info; }
|
|
|
|
void SetEncoding(uint32 encoding) { fEncoding=encoding; }
|
|
|
|
void SetFlags(const uint32 &value) { fFlags=value; }
|
|
|
|
void SetSpacing(const uint32 &value) { fSpacing=value; }
|
2003-01-01 01:19:48 +03:00
|
|
|
void SetShear(const float &value) { fshear=value; }
|
2005-01-21 16:11:46 +03:00
|
|
|
void SetSize(const float &value) { fSize=value; }
|
2003-01-01 01:19:48 +03:00
|
|
|
void SetRotation(const float &value) { frotation=value; }
|
2005-01-21 16:11:46 +03:00
|
|
|
void SetFace(const uint32 &value) { fFace=value; }
|
2003-01-01 01:19:48 +03:00
|
|
|
|
2005-03-26 00:02:40 +03:00
|
|
|
bool IsFixedWidth(void) const { return fStyle->IsFixedWidth(); }
|
|
|
|
bool IsScalable(void) const { return fStyle->IsScalable(); }
|
|
|
|
bool HasKerning(void) const { return fStyle->HasKerning(); }
|
|
|
|
bool HasTuned(void) const { return fStyle->HasTuned(); }
|
|
|
|
int32 TunedCount(void) const { return fStyle->TunedCount(); }
|
|
|
|
uint16 GlyphCount(void) const { return fStyle->GlyphCount(); }
|
|
|
|
uint16 CharMapCount(void) const { return fStyle->CharMapCount(); }
|
2005-04-01 11:00:32 +04:00
|
|
|
BShape **GetGlyphShapes(const char charArray[], int32 numChars) const;
|
2005-04-01 13:18:25 +04:00
|
|
|
BPoint *GetEscapements(const char charArray[], int32 numChars,
|
|
|
|
BPoint offsetArray[]) const;
|
2005-03-26 00:02:40 +03:00
|
|
|
|
|
|
|
FT_Face GetFTFace() const { return fStyle->GetFTFace(); };
|
2005-01-17 05:04:21 +03:00
|
|
|
|
|
|
|
const char *GetStyle(void) const;
|
|
|
|
const char *GetFamily(void) const;
|
2005-01-21 16:11:46 +03:00
|
|
|
const char *GetPath(void) const { return fStyle->GetPath(); }
|
|
|
|
uint16 StyleID(void) const { return fStyle->GetID(); }
|
|
|
|
uint16 FamilyID(void) const { return fStyle->Family()->GetID(); }
|
2005-03-30 03:42:52 +04:00
|
|
|
uint32 GetFamilyAndStyle(void) const;
|
2005-01-17 05:04:21 +03:00
|
|
|
|
2003-01-01 01:19:48 +03:00
|
|
|
BRect BoundingBox(void);
|
|
|
|
void Height(font_height *fh);
|
2003-09-15 22:58:49 +04:00
|
|
|
|
2004-02-03 03:51:23 +03:00
|
|
|
ServerFont &operator=(const ServerFont& font);
|
|
|
|
|
2003-01-01 01:19:48 +03:00
|
|
|
protected:
|
2003-06-23 06:54:52 +04:00
|
|
|
friend class FontStyle;
|
2005-01-21 16:11:46 +03:00
|
|
|
FontStyle *fStyle;
|
|
|
|
edge_info fEdges;
|
|
|
|
float fSize, frotation, fshear;
|
|
|
|
BRect fBounds;
|
|
|
|
uint32 fFlags;
|
|
|
|
uint32 fSpacing;
|
|
|
|
uint16 fFace;
|
|
|
|
font_direction fDirection;
|
|
|
|
uint32 fEncoding;
|
2003-01-01 01:19:48 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2005-01-21 16:11:46 +03:00
|
|
|
|