* ServerFont now also adopts the FontStyle's face and direction on

construction.
* ServerFont::SetStyle() now adopts the style's face and direction, too.
* Started a more sane handling of ServerFont::SetFace() (at least there's
  a to-do comment :-)).
* Minor cleanup (GetStyle() -> Style(), GetFamily() -> Family(),
  GetPath() -> Path()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14809 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-09 20:10:40 +00:00
parent 4e7d1d4b6a
commit 90dfa70739
3 changed files with 29 additions and 21 deletions
+11 -14
View File
@@ -56,12 +56,11 @@ class ServerFont {
{ return fStyle->GlyphCount(); } { return fStyle->GlyphCount(); }
int32 CountTuned(); int32 CountTuned();
font_file_format FileFormat(); font_file_format FileFormat();
const char* GetStyle() const; const char* Style() const;
const char* GetFamily() const; const char* Family() const;
const char* GetPath() const const char* Path() const
{ return fStyle->Path(); } { return fStyle->Path(); }
void SetStyle(FontStyle& style); void SetStyle(FontStyle& style);
@@ -75,25 +74,23 @@ class ServerFont {
{ return fStyle->Family()->ID(); } { return fStyle->Family()->ID(); }
uint32 GetFamilyAndStyle() const; uint32 GetFamilyAndStyle() const;
void SetDirection(font_direction dir)
void SetDirection(const font_direction& dir)
{ fDirection = dir; } { fDirection = dir; }
void SetEdges(const edge_info& info) void SetEdges(edge_info info)
{ fEdges = info; } { fEdges = info; }
void SetEncoding(uint32 encoding) void SetEncoding(uint32 encoding)
{ fEncoding = encoding; } { fEncoding = encoding; }
void SetFlags(const uint32& value) void SetFlags(uint32 value)
{ fFlags = value; } { fFlags = value; }
void SetSpacing(const uint32& value) void SetSpacing(uint32 value)
{ fSpacing = value; } { fSpacing = value; }
void SetShear(const float& value) void SetShear(float value)
{ fShear = value; } { fShear = value; }
void SetSize(const float& value) void SetSize(float value)
{ fSize = value; } { fSize = value; }
void SetRotation(const float& value) void SetRotation(float value)
{ fRotation = value; } { fRotation = value; }
void SetFace(const uint32& value) void SetFace(uint32 face);
{ fFace = value; }
bool IsFixedWidth() const bool IsFixedWidth() const
{ return fStyle->IsFixedWidth(); } { return fStyle->IsFixedWidth(); }
+2 -2
View File
@@ -1169,8 +1169,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
// 3) float - size // 3) float - size
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.AttachString(font.GetFamily()); fLink.AttachString(font.Family());
fLink.AttachString(font.GetStyle()); fLink.AttachString(font.Style());
fLink.Attach<float>(font.Size()); fLink.Attach<float>(font.Size());
} else } else
fLink.StartMessage(status); fLink.StartMessage(status);
+15 -4
View File
@@ -135,8 +135,8 @@ ServerFont::ServerFont(FontStyle& style, float size,
fBounds(0, 0, 0, 0), fBounds(0, 0, 0, 0),
fFlags(flags), fFlags(flags),
fSpacing(spacing), fSpacing(spacing),
fDirection(B_FONT_LEFT_TO_RIGHT), fDirection(style.Direction()),
fFace(B_REGULAR_FACE), fFace(style.Face()),
fEncoding(B_UNICODE_UTF8) fEncoding(B_UNICODE_UTF8)
{ {
fStyle->Acquire(); fStyle->Acquire();
@@ -218,14 +218,14 @@ ServerFont::FileFormat()
const char* const char*
ServerFont::GetStyle() const ServerFont::Style() const
{ {
return fStyle->Name(); return fStyle->Name();
} }
const char* const char*
ServerFont::GetFamily() const ServerFont::Family() const
{ {
return fStyle->Family()->Name(); return fStyle->Family()->Name();
} }
@@ -241,6 +241,9 @@ ServerFont::SetStyle(FontStyle& style)
// attach to new style // attach to new style
fStyle = &style; fStyle = &style;
fFace = style.Face();
fDirection = style.Direction();
fStyle->Acquire(); fStyle->Acquire();
} }
} }
@@ -290,6 +293,14 @@ ServerFont::SetFamilyAndStyle(uint32 fontID)
} }
void
ServerFont::SetFace(uint32 face)
{
// TODO: change font style as requested!
fFace = face;
}
/*! /*!
\brief Gets the ID values for the ServerFont instance in one shot \brief Gets the ID values for the ServerFont instance in one shot
\return the combination of family and style ID numbers \return the combination of family and style ID numbers