* Changed DrawShape() to take the current pen location into account (Stephan please review that AGG part)
* Fixed GetEscapements() to return the correct values * Corrected and enabled the rotate / shear transform for GetGlyphShapes() and GetEscapements() The Iterview sample code demo is now working. If you play with it a bit you can also rotate the text. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16232 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bb96bd0a70
commit
7213cb626c
@ -358,9 +358,7 @@ ServerFont::GetGlyphShapes(const char charArray[], int32 numChars) const
|
|||||||
|
|
||||||
// Multiply togheter
|
// Multiply togheter
|
||||||
FT_Matrix_Multiply(&rmatrix, &smatrix);
|
FT_Matrix_Multiply(&rmatrix, &smatrix);
|
||||||
|
FT_Set_Transform(face, &smatrix, NULL);
|
||||||
//FT_Vector pen;
|
|
||||||
//FT_Set_Transform(face, &smatrix, &pen);
|
|
||||||
|
|
||||||
BShape **shapes = new BShape *[numChars];
|
BShape **shapes = new BShape *[numChars];
|
||||||
for (int i = 0; i < numChars; i++) {
|
for (int i = 0; i < numChars; i++) {
|
||||||
@ -374,6 +372,8 @@ ServerFont::GetGlyphShapes(const char charArray[], int32 numChars) const
|
|||||||
shapes[i]->Close();
|
shapes[i]->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset transformation
|
||||||
|
FT_Set_Transform(face, NULL, NULL);
|
||||||
return shapes;
|
return shapes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,25 +498,20 @@ ServerFont::GetEscapements(const char charArray[], int32 numChars,
|
|||||||
|
|
||||||
// Multiply togheter
|
// Multiply togheter
|
||||||
FT_Matrix_Multiply(&rmatrix, &smatrix);
|
FT_Matrix_Multiply(&rmatrix, &smatrix);
|
||||||
|
FT_Set_Transform(face, &smatrix, NULL);
|
||||||
//FT_Vector pen;
|
|
||||||
//FT_Set_Transform(face, &smatrix, &pen);
|
|
||||||
|
|
||||||
// TODO: I'm not sure if this the correct interpretation
|
|
||||||
// of the BeBook. Have actual tests been done here?
|
|
||||||
|
|
||||||
// TODO: handle UTF8... see below!!
|
// TODO: handle UTF8... see below!!
|
||||||
BPoint *escapements = new 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);
|
||||||
// escapements[i].x = float(face->glyph->metrics.width / 64) / fSize;
|
escapements[i].x = float(face->glyph->advance.x) / 64 / fSize;
|
||||||
// escapements[i].y = 0;
|
escapements[i].y = -float(face->glyph->advance.y) / 64 / fSize;
|
||||||
escapements[i].x = float(face->glyph->metrics.horiAdvance / 64) / fSize;
|
|
||||||
escapements[i].y = float(face->glyph->metrics.vertAdvance / 64) / fSize;
|
|
||||||
escapements[i] += offsetArray[i];
|
escapements[i] += offsetArray[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset transformation
|
||||||
|
FT_Set_Transform(face, NULL, NULL);
|
||||||
return escapements;
|
return escapements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,60 +518,39 @@ Painter::DrawShape(const int32& opCount, const uint32* opList,
|
|||||||
|
|
||||||
agg::path_storage path;
|
agg::path_storage path;
|
||||||
for (int32 i = 0; i < opCount; i++) {
|
for (int32 i = 0; i < opCount; i++) {
|
||||||
switch (opList[i] & 0xFF000000) {
|
uint32 op = opList[i] & 0xFF000000;
|
||||||
case OP_LINETO: {
|
if (op & OP_MOVETO) {
|
||||||
int32 count = opList[i] & 0x00FFFFFF;
|
path.move_to(points->x, points->y);
|
||||||
while (count--) {
|
points++;
|
||||||
path.line_to(points->x, points->y);
|
}
|
||||||
points++;
|
|
||||||
}
|
if (op & OP_LINETO) {
|
||||||
break;
|
int32 count = opList[i] & 0x00FFFFFF;
|
||||||
}
|
while (count--) {
|
||||||
case (OP_MOVETO | OP_LINETO): {
|
path.line_to(points->x, points->y);
|
||||||
int32 count = opList[i] & 0x00FFFFFF;
|
|
||||||
path.move_to(points->x, points->y);
|
|
||||||
points++;
|
points++;
|
||||||
// execute "line to(s)"
|
|
||||||
while (count--) {
|
|
||||||
path.line_to(points->x, points->y);
|
|
||||||
points++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case OP_BEZIERTO: {
|
|
||||||
int32 count = opList[i] & 0x00FFFFFF;
|
|
||||||
while (count) {
|
|
||||||
path.curve4(points[0].x, points[0].y,
|
|
||||||
points[1].x, points[1].y,
|
|
||||||
points[2].x, points[2].y);
|
|
||||||
points += 3;
|
|
||||||
count -= 3;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (OP_MOVETO | OP_BEZIERTO): {
|
|
||||||
int32 count = opList[i] & 0x00FFFFFF;
|
|
||||||
// execute "move to"
|
|
||||||
path.move_to(points->x, points->y);
|
|
||||||
points++;
|
|
||||||
// execute "bezier to(s)"
|
|
||||||
while (count) {
|
|
||||||
path.curve4(points[0].x, points[0].y,
|
|
||||||
points[1].x, points[1].y,
|
|
||||||
points[2].x, points[2].y);
|
|
||||||
points += 3;
|
|
||||||
count -= 3;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case OP_CLOSE:
|
|
||||||
case OP_CLOSE | OP_LINETO | OP_BEZIERTO: {
|
|
||||||
path.close_polygon();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op & OP_BEZIERTO) {
|
||||||
|
int32 count = opList[i] & 0x00FFFFFF;
|
||||||
|
while (count) {
|
||||||
|
path.curve4(points[0].x, points[0].y,
|
||||||
|
points[1].x, points[1].y,
|
||||||
|
points[2].x, points[2].y);
|
||||||
|
points += 3;
|
||||||
|
count -= 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (op & OP_CLOSE)
|
||||||
|
path.close_polygon();
|
||||||
}
|
}
|
||||||
agg::conv_curve<agg::path_storage> curve(path);
|
|
||||||
|
typedef agg::conv_transform<agg::path_storage, agg::trans_affine> conv_trans_type;
|
||||||
|
conv_trans_type transformed(path, agg::trans_affine_translation(fPenLocation.x, fPenLocation.y));
|
||||||
|
agg::conv_curve<conv_trans_type> curve(transformed);
|
||||||
|
|
||||||
if (filled)
|
if (filled)
|
||||||
return _FillPath(curve);
|
return _FillPath(curve);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user