* Fixed GetGlyphShapes(). The BShapes that are outputted are correct now but the app_server still cannot draw them correctly.
* Changed the allocation to new for GetGlyphShapes() and GetEscapements() as the data is deleted in ServerApp.cpp * Minor cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16231 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -612,7 +612,7 @@ FT_BEGIN_HEADER
|
|||||||
/* accuracy during scan-conversion). The transformation is simple: */
|
/* accuracy during scan-conversion). The transformation is simple: */
|
||||||
/* */
|
/* */
|
||||||
/* x' = (x << shift) - delta */
|
/* x' = (x << shift) - delta */
|
||||||
/* y' = (x << shift) - delta */
|
/* y' = (y << shift) - delta */
|
||||||
/* */
|
/* */
|
||||||
/* Set the value of `shift' and `delta' to 0 to get the original */
|
/* Set the value of `shift' and `delta' to 0 to get the original */
|
||||||
/* point coordinates. */
|
/* point coordinates. */
|
||||||
|
|||||||
@@ -1285,9 +1285,11 @@ BFont::GetGlyphShapes(const char charArray[], int32 numChars, BShape *glyphShape
|
|||||||
link.Attach<float>(fShear);
|
link.Attach<float>(fShear);
|
||||||
link.Attach<float>(fRotation);
|
link.Attach<float>(fRotation);
|
||||||
link.Attach<uint32>(fFlags);
|
link.Attach<uint32>(fFlags);
|
||||||
|
|
||||||
link.Attach<int32>(numChars);
|
link.Attach<int32>(numChars);
|
||||||
link.Attach(charArray, numChars);
|
|
||||||
|
uint32 bytesInBuffer = UTF8CountBytes(charArray, numChars);
|
||||||
|
link.Attach<int32>(bytesInBuffer);
|
||||||
|
link.Attach(charArray, bytesInBuffer);
|
||||||
|
|
||||||
if (link.FlushWithReply(code) != B_OK
|
if (link.FlushWithReply(code) != B_OK
|
||||||
|| code != B_OK)
|
|| code != B_OK)
|
||||||
|
|||||||
@@ -1565,7 +1565,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
// 5) float - rotation
|
// 5) float - rotation
|
||||||
// 6) uint32 - flags
|
// 6) uint32 - flags
|
||||||
// 7) int32 - numChars
|
// 7) int32 - numChars
|
||||||
// 8) char - chars (numChars times)
|
// 8) int32 - numBytes
|
||||||
|
// 8) char - chars (bytesInBuffer times)
|
||||||
|
|
||||||
// Returns:
|
// Returns:
|
||||||
// 1) BShape - glyph shape
|
// 1) BShape - glyph shape
|
||||||
@@ -1582,11 +1583,12 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
link.Read<float>(&rotation);
|
link.Read<float>(&rotation);
|
||||||
link.Read<uint32>(&flags);
|
link.Read<uint32>(&flags);
|
||||||
|
|
||||||
int32 numChars;
|
int32 numChars, numBytes;
|
||||||
link.Read<int32>(&numChars);
|
link.Read<int32>(&numChars);
|
||||||
|
link.Read<int32>(&numBytes);
|
||||||
|
|
||||||
char charArray[numChars];
|
char charArray[numBytes];
|
||||||
link.Read(&charArray, numChars);
|
link.Read(&charArray, numBytes);
|
||||||
|
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
status_t status = font.SetFamilyAndStyle(familyID, styleID);
|
status_t status = font.SetFamilyAndStyle(familyID, styleID);
|
||||||
@@ -1627,11 +1629,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
link.Read<uint16>(&familyID);
|
link.Read<uint16>(&familyID);
|
||||||
link.Read<uint16>(&styleID);
|
link.Read<uint16>(&styleID);
|
||||||
|
|
||||||
int32 numChars;
|
int32 numChars, numBytes;
|
||||||
link.Read<int32>(&numChars);
|
link.Read<int32>(&numChars);
|
||||||
|
link.Read<int32>(&numBytes);
|
||||||
uint32 numBytes;
|
|
||||||
link.Read<uint32>(&numBytes);
|
|
||||||
char* charArray = new char[numBytes];
|
char* charArray = new char[numBytes];
|
||||||
link.Read(charArray, numBytes);
|
link.Read(charArray, numBytes);
|
||||||
|
|
||||||
@@ -1738,7 +1738,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
fLink.Attach<BPoint>(escapements[i]);
|
fLink.Attach<BPoint>(escapements[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete escapements;
|
delete[] escapements;
|
||||||
} else
|
} else
|
||||||
fLink.StartMessage(B_ERROR);
|
fLink.StartMessage(B_ERROR);
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -30,11 +30,12 @@ inline BPoint
|
|||||||
VectorToPoint(FT_Vector *vector)
|
VectorToPoint(FT_Vector *vector)
|
||||||
{
|
{
|
||||||
BPoint result;
|
BPoint result;
|
||||||
result.x = float(int32(vector->x)) / 2097152;
|
result.x = float(vector->x) / 64;
|
||||||
result.y = -float(int32(vector->y)) / 2097152;
|
result.y = -float(vector->y) / 64;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
MoveToFunc(FT_Vector *to, void *user)
|
MoveToFunc(FT_Vector *to, void *user)
|
||||||
{
|
{
|
||||||
@@ -42,6 +43,7 @@ MoveToFunc(FT_Vector *to, void *user)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
LineToFunc(FT_Vector *to, void *user)
|
LineToFunc(FT_Vector *to, void *user)
|
||||||
{
|
{
|
||||||
@@ -49,6 +51,7 @@ LineToFunc(FT_Vector *to, void *user)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ConicToFunc(FT_Vector *control, FT_Vector *to, void *user)
|
ConicToFunc(FT_Vector *control, FT_Vector *to, void *user)
|
||||||
{
|
{
|
||||||
@@ -62,6 +65,7 @@ ConicToFunc(FT_Vector *control, FT_Vector *to, void *user)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
CubicToFunc(FT_Vector *control1, FT_Vector *control2, FT_Vector *to, void *user)
|
CubicToFunc(FT_Vector *control1, FT_Vector *control2, FT_Vector *to, void *user)
|
||||||
{
|
{
|
||||||
@@ -76,7 +80,6 @@ CubicToFunc(FT_Vector *control1, FT_Vector *control2, FT_Vector *to, void *user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// is_white_space
|
|
||||||
inline bool
|
inline bool
|
||||||
is_white_space(uint16 glyph)
|
is_white_space(uint16 glyph)
|
||||||
{
|
{
|
||||||
@@ -326,6 +329,8 @@ ServerFont::GetGlyphShapes(const char charArray[], int32 numChars) const
|
|||||||
funcs.line_to = LineToFunc;
|
funcs.line_to = LineToFunc;
|
||||||
funcs.conic_to = ConicToFunc;
|
funcs.conic_to = ConicToFunc;
|
||||||
funcs.cubic_to = CubicToFunc;
|
funcs.cubic_to = CubicToFunc;
|
||||||
|
funcs.shift = 0;
|
||||||
|
funcs.delta = 0;
|
||||||
|
|
||||||
FaceGetter getter(fStyle);
|
FaceGetter getter(fStyle);
|
||||||
FT_Face face = getter.Face();
|
FT_Face face = getter.Face();
|
||||||
@@ -357,10 +362,11 @@ ServerFont::GetGlyphShapes(const char charArray[], int32 numChars) const
|
|||||||
//FT_Vector pen;
|
//FT_Vector pen;
|
||||||
//FT_Set_Transform(face, &smatrix, &pen);
|
//FT_Set_Transform(face, &smatrix, &pen);
|
||||||
|
|
||||||
BShape **shapes = (BShape **)malloc(sizeof(BShape *) * numChars);
|
BShape **shapes = new BShape *[numChars];
|
||||||
for (int i = 0; i < numChars; i++) {
|
for (int i = 0; i < numChars; i++) {
|
||||||
shapes[i] = new BShape();
|
shapes[i] = new BShape();
|
||||||
shapes[i]->Clear();
|
shapes[i]->Clear();
|
||||||
|
|
||||||
// TODO : this is wrong (the nth char isn't charArray[i])
|
// TODO : this is wrong (the nth char isn't charArray[i])
|
||||||
FT_Load_Char(face, charArray[i], FT_LOAD_NO_BITMAP);
|
FT_Load_Char(face, charArray[i], FT_LOAD_NO_BITMAP);
|
||||||
FT_Outline outline = face->glyph->outline;
|
FT_Outline outline = face->glyph->outline;
|
||||||
@@ -500,7 +506,7 @@ ServerFont::GetEscapements(const char charArray[], int32 numChars,
|
|||||||
// of the BeBook. Have actual tests been done here?
|
// of the BeBook. Have actual tests been done here?
|
||||||
|
|
||||||
// TODO: handle UTF8... see below!!
|
// TODO: handle UTF8... see below!!
|
||||||
BPoint *escapements = (BPoint *)malloc(sizeof(BPoint) * numChars);
|
BPoint *escapements = new BPoint[numChars];
|
||||||
for (int i = 0; i < numChars; i++) {
|
for (int i = 0; i < numChars; i++) {
|
||||||
// TODO : this is wrong (the nth char isn't charArray[i])
|
// TODO : this is wrong (the nth char isn't charArray[i])
|
||||||
FT_Load_Char(face, charArray[i], FT_LOAD_NO_BITMAP);
|
FT_Load_Char(face, charArray[i], FT_LOAD_NO_BITMAP);
|
||||||
|
|||||||
Reference in New Issue
Block a user