Implemented WriteSetFontFamily() and WriteSetFontStyle(). Only the
server side functions are missing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21941 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2f99607b77
commit
feb557a6d1
@ -36,8 +36,8 @@ public:
|
||||
status_t WritePushState();
|
||||
status_t WritePopState();
|
||||
|
||||
status_t WriteSetFontFamily(const font_family &family);
|
||||
status_t WriteSetFontStyle(const font_style &style);
|
||||
status_t WriteSetFontFamily(const font_family family);
|
||||
status_t WriteSetFontStyle(const font_style style);
|
||||
status_t WriteSetFontSpacing(const int32 &spacing);
|
||||
status_t WriteSetFontSize(const float &size);
|
||||
status_t WriteSetFontRotation(const float &rotation);
|
||||
|
@ -18,6 +18,9 @@
|
||||
|
||||
#define THROW_ERROR(error) throw (status_t)(error)
|
||||
|
||||
// TODO: Review writing of strings. AFAIK in the picture data format
|
||||
// They are not supposed to be NULL terminated (at least, it's not mandatory)
|
||||
// and we should write their size.
|
||||
PictureDataWriter::PictureDataWriter()
|
||||
:
|
||||
fData(NULL)
|
||||
@ -384,21 +387,31 @@ PictureDataWriter::WriteDrawPicture(const BPoint &where, const int32 &token)
|
||||
|
||||
|
||||
status_t
|
||||
PictureDataWriter::WriteSetFontFamily(const font_family &family)
|
||||
PictureDataWriter::WriteSetFontFamily(const font_family family)
|
||||
{
|
||||
/*BeginOp(B_PIC_SET_FONT_FAMILY);
|
||||
Write(
|
||||
EndOp();*/
|
||||
try {
|
||||
BeginOp(B_PIC_SET_FONT_FAMILY);
|
||||
WriteData(family, strlen(family));
|
||||
Write<int8>(0);
|
||||
EndOp();
|
||||
} catch (status_t &status) {
|
||||
return status;
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
PictureDataWriter::WriteSetFontStyle(const font_style &style)
|
||||
PictureDataWriter::WriteSetFontStyle(const font_style style)
|
||||
{
|
||||
/*BeginOp(B_PIC_SET_FONT_STYLE);
|
||||
Write(
|
||||
EndOp();*/
|
||||
try {
|
||||
BeginOp(B_PIC_SET_FONT_STYLE);
|
||||
WriteData(style, strlen(style));
|
||||
Write<int8>(0);
|
||||
EndOp();
|
||||
} catch (status_t &status) {
|
||||
return status;
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "DrawingEngine.h"
|
||||
#include "ServerApp.h"
|
||||
#include "ServerBitmap.h"
|
||||
#include "ServerFont.h"
|
||||
#include "ServerPicture.h"
|
||||
#include "ServerTokenSpace.h"
|
||||
#include "ViewLayer.h"
|
||||
@ -581,14 +582,16 @@ set_scale(ViewLayer *view, float scale)
|
||||
static void
|
||||
set_font_family(ViewLayer *view, const char *family)
|
||||
{
|
||||
printf("SetFontFamily(%s)\n", family);
|
||||
// TODO: Implement
|
||||
// Can we have a ServerFont::SetFamily() which accepts a string ?
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_font_style(ViewLayer *view, const char *style)
|
||||
{
|
||||
printf("SetFontStyle(%s)\n", style);
|
||||
// TODO: Implement
|
||||
// Can we have a ServerFont::SetStyle() which accepts a string ?
|
||||
}
|
||||
|
||||
|
||||
@ -831,12 +834,10 @@ ServerPicture::SetFontFromLink(BPrivate::LinkReceiver& link)
|
||||
if (mask & B_FONT_FAMILY_AND_STYLE) {
|
||||
uint32 fontID;
|
||||
link.Read<uint32>(&fontID);
|
||||
//uint16 style = fontID & 0xFFFF;
|
||||
//uint16 family = (fontID & 0xFFFF0000) >> 16;
|
||||
// TODO: WriteSetFamily() and WriteSetStyle()
|
||||
// accept font_family and font_style parameters, not uint16
|
||||
//WriteSetFontFamily(family);
|
||||
//WriteSetFontStyle(style);
|
||||
ServerFont font;
|
||||
font.SetFamilyAndStyle(fontID);
|
||||
WriteSetFontFamily((font_family)font.Family());
|
||||
WriteSetFontStyle((font_style)font.Style());
|
||||
}
|
||||
|
||||
if (mask & B_FONT_SIZE) {
|
||||
|
Loading…
Reference in New Issue
Block a user