- IntEscapeMatrix(&mat1, lfEscapement);
- FT_Matrix_Multiply(&mat1, &mat2);
- FT_Set_Transform(face, &mat2, NULL);
-
- // background rectangle
- vecs[0].x = 0;
- vecs[0].y = (DY1 - FontGDI->tmHeight) << 16; // Top Left
- vecs[1].x = TextWidth64 << 10;
- vecs[1].y = (DY1 - FontGDI->tmHeight) << 16; // Top Right
- vecs[2].x = TextWidth64 << 10;
- vecs[2].y = DY1 << 16; // Bottom Right
- vecs[3].x = 0;
- vecs[3].y = DY1 << 16; // Bottom Left
-
- // the starting point
- vecs[4].x = 0;
- vecs[4].y = (DY1 - FontGDI->tmAscent) << 16;
+ /* Process the vertical alignment */
+#define VALIGN_MASK (TA_TOP | TA_BASELINE | TA_BOTTOM)
+ RtlZeroMemory(vecs, sizeof(vecs));
+ if ((pdcattr->lTextAlign & VALIGN_MASK) == TA_BASELINE)
+ {
+ vecs[1].y = -FontGDI->tmAscent << 16; // upper left
+ vecs[4].y = 0; // baseline
+ vecs[0].y = FontGDI->tmDescent << 16; // lower left
+ }
+ else if ((pdcattr->lTextAlign & VALIGN_MASK) == TA_BOTTOM)
+ {
+ vecs[1].y = -FontGDI->tmHeight << 16; // upper left
+ vecs[4].y = -FontGDI->tmDescent << 16; // baseline
+ vecs[0].y = 0; // lower left
+ }
+ else /* TA_TOP */
+ {
+ vecs[1].y = 0; // upper left
+ vecs[4].y = FontGDI->tmAscent << 16; // baseline
+ vecs[0].y = FontGDI->tmHeight << 16; // lower left
+ }
+ vecs[2] = vecs[1]; // upper right
+ vecs[3] = vecs[0]; // lower right
+#undef VALIGN_MASK