* 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
|
||||
FT_Matrix_Multiply(&rmatrix, &smatrix);
|
||||
|
||||
//FT_Vector pen;
|
||||
//FT_Set_Transform(face, &smatrix, &pen);
|
||||
FT_Set_Transform(face, &smatrix, NULL);
|
||||
|
||||
BShape **shapes = new BShape *[numChars];
|
||||
for (int i = 0; i < numChars; i++) {
|
||||
@ -374,6 +372,8 @@ ServerFont::GetGlyphShapes(const char charArray[], int32 numChars) const
|
||||
shapes[i]->Close();
|
||||
}
|
||||
|
||||
// Reset transformation
|
||||
FT_Set_Transform(face, NULL, NULL);
|
||||
return shapes;
|
||||
}
|
||||
|
||||
@ -498,25 +498,20 @@ ServerFont::GetEscapements(const char charArray[], int32 numChars,
|
||||
|
||||
// Multiply togheter
|
||||
FT_Matrix_Multiply(&rmatrix, &smatrix);
|
||||
|
||||
//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?
|
||||
FT_Set_Transform(face, &smatrix, NULL);
|
||||
|
||||
// TODO: handle UTF8... see below!!
|
||||
BPoint *escapements = new BPoint[numChars];
|
||||
for (int i = 0; i < numChars; i++) {
|
||||
// TODO : this is wrong (the nth char isn't charArray[i])
|
||||
FT_Load_Char(face, charArray[i], FT_LOAD_NO_BITMAP);
|
||||
// escapements[i].x = float(face->glyph->metrics.width / 64) / fSize;
|
||||
// escapements[i].y = 0;
|
||||
escapements[i].x = float(face->glyph->metrics.horiAdvance / 64) / fSize;
|
||||
escapements[i].y = float(face->glyph->metrics.vertAdvance / 64) / fSize;
|
||||
escapements[i].x = float(face->glyph->advance.x) / 64 / fSize;
|
||||
escapements[i].y = -float(face->glyph->advance.y) / 64 / fSize;
|
||||
escapements[i] += offsetArray[i];
|
||||
}
|
||||
|
||||
// Reset transformation
|
||||
FT_Set_Transform(face, NULL, NULL);
|
||||
return escapements;
|
||||
}
|
||||
|
||||
|
@ -518,60 +518,39 @@ Painter::DrawShape(const int32& opCount, const uint32* opList,
|
||||
|
||||
agg::path_storage path;
|
||||
for (int32 i = 0; i < opCount; i++) {
|
||||
switch (opList[i] & 0xFF000000) {
|
||||
case OP_LINETO: {
|
||||
int32 count = opList[i] & 0x00FFFFFF;
|
||||
while (count--) {
|
||||
path.line_to(points->x, points->y);
|
||||
points++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (OP_MOVETO | OP_LINETO): {
|
||||
int32 count = opList[i] & 0x00FFFFFF;
|
||||
path.move_to(points->x, points->y);
|
||||
uint32 op = opList[i] & 0xFF000000;
|
||||
if (op & OP_MOVETO) {
|
||||
path.move_to(points->x, points->y);
|
||||
points++;
|
||||
}
|
||||
|
||||
if (op & OP_LINETO) {
|
||||
int32 count = opList[i] & 0x00FFFFFF;
|
||||
while (count--) {
|
||||
path.line_to(points->x, points->y);
|
||||
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)
|
||||
return _FillPath(curve);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user