Implemented ServerFont::SetFamilyAndStyle(id,id)
Other API tweaks to ServerFont Style changes in ServerFont git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10928 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#include "ServerFont.h"
|
#include "ServerFont.h"
|
||||||
|
#include "FontServer.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Constructor
|
\brief Constructor
|
||||||
@@ -39,34 +39,32 @@
|
|||||||
ServerFont::ServerFont(FontStyle *style, float size, float rotation, float shear,
|
ServerFont::ServerFont(FontStyle *style, float size, float rotation, float shear,
|
||||||
uint16 flags, uint8 spacing)
|
uint16 flags, uint8 spacing)
|
||||||
{
|
{
|
||||||
fstyle=style;
|
fStyle=style;
|
||||||
fsize=size;
|
fSize=size;
|
||||||
frotation=rotation;
|
frotation=rotation;
|
||||||
fshear=shear;
|
fshear=shear;
|
||||||
fflags=flags;
|
fFlags=flags;
|
||||||
fspacing=spacing;
|
fSpacing=spacing;
|
||||||
fdirection=B_FONT_LEFT_TO_RIGHT;
|
fDirection=B_FONT_LEFT_TO_RIGHT;
|
||||||
fface=B_REGULAR_FACE;
|
fFace=B_REGULAR_FACE;
|
||||||
ftruncate=B_TRUNCATE_END;
|
fEncoding=B_UNICODE_UTF8;
|
||||||
fencoding=B_UNICODE_UTF8;
|
fBounds.Set(0,0,0,0);
|
||||||
fbounds.Set(0,0,0,0);
|
if(fStyle)
|
||||||
if(fstyle)
|
fStyle->AddDependent();
|
||||||
fstyle->AddDependent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerFont::ServerFont(void)
|
ServerFont::ServerFont(void)
|
||||||
{
|
{
|
||||||
fstyle=NULL;
|
fStyle=NULL;
|
||||||
fsize=0.0;
|
fSize=0.0;
|
||||||
frotation=0.0;
|
frotation=0.0;
|
||||||
fshear=90.0;
|
fshear=90.0;
|
||||||
fflags=0;
|
fFlags=0;
|
||||||
fspacing=B_STRING_SPACING;
|
fSpacing=B_STRING_SPACING;
|
||||||
fdirection=B_FONT_LEFT_TO_RIGHT;
|
fDirection=B_FONT_LEFT_TO_RIGHT;
|
||||||
fface=B_REGULAR_FACE;
|
fFace=B_REGULAR_FACE;
|
||||||
ftruncate=B_TRUNCATE_END;
|
fEncoding=B_UNICODE_UTF8;
|
||||||
fencoding=B_UNICODE_UTF8;
|
fBounds.Set(0,0,0,0);
|
||||||
fbounds.Set(0,0,0,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -75,19 +73,18 @@ ServerFont::ServerFont(void)
|
|||||||
*/
|
*/
|
||||||
ServerFont::ServerFont(const ServerFont &font)
|
ServerFont::ServerFont(const ServerFont &font)
|
||||||
{
|
{
|
||||||
fstyle=font.fstyle;
|
fStyle=font.fStyle;
|
||||||
fsize=font.fsize;
|
fSize=font.fSize;
|
||||||
frotation=font.frotation;
|
frotation=font.frotation;
|
||||||
fshear=font.fshear;
|
fshear=font.fshear;
|
||||||
fflags=font.fflags;
|
fFlags=font.fFlags;
|
||||||
fspacing=font.fspacing;
|
fSpacing=font.fSpacing;
|
||||||
fdirection=font.fdirection;
|
fDirection=font.fDirection;
|
||||||
fface=font.fface;
|
fFace=font.fFace;
|
||||||
ftruncate=font.ftruncate;
|
fEncoding=font.fEncoding;
|
||||||
fencoding=font.fencoding;
|
fBounds.Set(0,0,0,0);
|
||||||
fbounds.Set(0,0,0,0);
|
if(fStyle)
|
||||||
if(fstyle)
|
fStyle->AddDependent();
|
||||||
fstyle->AddDependent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -95,8 +92,8 @@ ServerFont::ServerFont(const ServerFont &font)
|
|||||||
*/
|
*/
|
||||||
ServerFont::~ServerFont(void)
|
ServerFont::~ServerFont(void)
|
||||||
{
|
{
|
||||||
if(fstyle)
|
if(fStyle)
|
||||||
fstyle->RemoveDependent();
|
fStyle->RemoveDependent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -105,19 +102,18 @@ ServerFont::~ServerFont(void)
|
|||||||
\return A copy of the specified font
|
\return A copy of the specified font
|
||||||
*/
|
*/
|
||||||
ServerFont& ServerFont::operator=(const ServerFont& font){
|
ServerFont& ServerFont::operator=(const ServerFont& font){
|
||||||
fstyle = font.fstyle;
|
fStyle = font.fStyle;
|
||||||
fsize = font.fsize;
|
fSize = font.fSize;
|
||||||
frotation = font.frotation;
|
frotation = font.frotation;
|
||||||
fshear = font.fshear;
|
fshear = font.fshear;
|
||||||
fflags = font.fflags;
|
fFlags = font.fFlags;
|
||||||
fspacing = font.fspacing;
|
fSpacing = font.fSpacing;
|
||||||
fdirection = B_FONT_LEFT_TO_RIGHT;
|
fDirection = B_FONT_LEFT_TO_RIGHT;
|
||||||
fface = B_REGULAR_FACE;
|
fFace = B_REGULAR_FACE;
|
||||||
ftruncate = B_TRUNCATE_END;
|
fEncoding = B_UNICODE_UTF8;
|
||||||
fencoding = B_UNICODE_UTF8;
|
fBounds.Set(0,0,0,0);
|
||||||
fbounds.Set(0,0,0,0);
|
if(fStyle)
|
||||||
if(fstyle)
|
fStyle->AddDependent();
|
||||||
fstyle->AddDependent();
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,8 +123,8 @@ ServerFont& ServerFont::operator=(const ServerFont& font){
|
|||||||
*/
|
*/
|
||||||
int32 ServerFont::CountTuned(void)
|
int32 ServerFont::CountTuned(void)
|
||||||
{
|
{
|
||||||
if(fstyle)
|
if(fStyle)
|
||||||
fstyle->TunedCount();
|
fStyle->TunedCount();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -139,7 +135,7 @@ int32 ServerFont::CountTuned(void)
|
|||||||
*/
|
*/
|
||||||
font_file_format ServerFont::FileFormat(void)
|
font_file_format ServerFont::FileFormat(void)
|
||||||
{
|
{
|
||||||
// TODO: implement
|
// TODO: implement ServerFont::FileFormat
|
||||||
return B_TRUETYPE_WINDOWS;
|
return B_TRUETYPE_WINDOWS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,17 +145,17 @@ font_file_format ServerFont::FileFormat(void)
|
|||||||
*/
|
*/
|
||||||
BRect ServerFont::BoundingBox(void)
|
BRect ServerFont::BoundingBox(void)
|
||||||
{
|
{
|
||||||
return fbounds;
|
return fBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *ServerFont::GetStyle(void) const
|
const char *ServerFont::GetStyle(void) const
|
||||||
{
|
{
|
||||||
return fstyle->Name();
|
return fStyle->Name();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *ServerFont::GetFamily(void) const
|
const char *ServerFont::GetFamily(void) const
|
||||||
{
|
{
|
||||||
return fstyle->Family()->Name();
|
return fStyle->Family()->Name();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -168,7 +164,25 @@ const char *ServerFont::GetFamily(void) const
|
|||||||
*/
|
*/
|
||||||
void ServerFont::Height(font_height *fh)
|
void ServerFont::Height(font_height *fh)
|
||||||
{
|
{
|
||||||
fh->ascent=fheight.ascent;
|
if(!fh)
|
||||||
fh->descent=fheight.descent;
|
return;
|
||||||
fh->leading=fheight.leading;
|
|
||||||
|
if(fStyle)
|
||||||
|
*fh=fStyle->GetHeight(fSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Sets the ServerFont instance to whatever font is specified
|
||||||
|
\param fontID the combination of family and style ID numbers
|
||||||
|
*/
|
||||||
|
void ServerFont::SetFamilyAndStyle(const uint32 &fontID)
|
||||||
|
{
|
||||||
|
uint16 style = fontID & 0xFFFF;
|
||||||
|
uint16 family = (fontID & 0xFFFF0000) >> 16;
|
||||||
|
|
||||||
|
fontserver->Lock();
|
||||||
|
FontStyle *sty=fontserver->GetStyle(family,style);
|
||||||
|
fontserver->Unlock();
|
||||||
|
if(sty)
|
||||||
|
fStyle=sty;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -528,9 +528,7 @@ void ServerWindow::SetLayerFontState(Layer *layer, LinkMsgReader &link)
|
|||||||
{
|
{
|
||||||
uint32 fontID;
|
uint32 fontID;
|
||||||
link.Read<int32>((int32*)&fontID);
|
link.Read<int32>((int32*)&fontID);
|
||||||
|
layer->fLayerData->font.SetFamilyAndStyle(fontID);
|
||||||
// TODO: Implement. ServerFont::SetFamilyAndStyle(uint32) is needed
|
|
||||||
//layer->fLayerData->font->
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask & B_FONT_SIZE)
|
if (mask & B_FONT_SIZE)
|
||||||
|
|||||||
Reference in New Issue
Block a user