* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: text.c,v 1.108 2004/07/30 09:16:06 weiden Exp $ */
+/* $Id: text.c,v 1.109 2004/08/21 02:22:45 navaraf Exp $ */
#include <w32k.h>
#include <ft2build.h>
BOOL bRestartScan = TRUE;
NTSTATUS Status;
- RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Media\\Fonts\\");
+ RtlInitUnicodeString(&Directory, L"\\SystemRoot\\media\\fonts\\");
/* FIXME: Add support for other font types */
RtlInitUnicodeString(&SearchPattern, L"*.ttf");
int error, glyph_index, n, i;
FT_Face face;
FT_GlyphSlot glyph;
- ULONG TextLeft, TextTop, pitch, previous, BackgroundLeft;
+ LONGLONG TextLeft, RealXStart;
+ ULONG TextTop, pitch, previous, BackgroundLeft;
FT_Bool use_kerning;
RECTL DestRect, MaskRect;
POINTL SourcePoint, BrushOrigin;
Start.x = XStart; Start.y = YStart;
IntLPtoDP(dc, &Start, 1);
- XStart = Start.x + dc->w.DCOrgX;
+ RealXStart = (Start.x + dc->w.DCOrgX) << 6;
YStart = Start.y + dc->w.DCOrgY;
/* Create the brushes */
if (dc->w.textAlign & (TA_RIGHT | TA_CENTER))
{
- UINT TextWidth = 0;
+ ULONGLONG TextWidth = 0;
LPCWSTR TempText = String;
int Start;
if (NULL != Dx)
{
Start = Count < 2 ? 0 : Count - 2;
- TextWidth = Count < 2 ? 0 : Dx[Count - 2];
+ TextWidth = Count < 2 ? 0 : (Dx[Count - 2] << 6);
}
else
{
IntLockFreeType;
FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
IntUnLockFreeType;
- TextWidth += delta.x >> 6;
+ TextWidth += delta.x;
}
- TextWidth += glyph->advance.x >> 6;
+ TextWidth += glyph->advance.x;
previous = glyph_index;
TempText++;
if (dc->w.textAlign & TA_RIGHT)
{
- XStart -= TextWidth;
+ RealXStart -= TextWidth;
}
else
{
- XStart -= TextWidth / 2;
+ RealXStart -= TextWidth / 2;
}
}
- TextLeft = XStart;
+ TextLeft = RealXStart;
TextTop = YStart;
- BackgroundLeft = XStart;
+ BackgroundLeft = (RealXStart + 32) >> 6;
/*
* The main rendering loop.
IntLockFreeType;
FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
IntUnLockFreeType;
- TextLeft += delta.x >> 6;
+ TextLeft += delta.x;
}
if (glyph->format == ft_glyph_format_outline)
if (fuOptions & ETO_OPAQUE)
{
DestRect.left = BackgroundLeft;
- DestRect.right = TextLeft + ((glyph->advance.x + 32) >> 6);
+ DestRect.right = (TextLeft + glyph->advance.x + 32) >> 6;
DestRect.top = TextTop + yoff - ((face->size->metrics.ascender + 32) >> 6);
DestRect.bottom = TextTop + yoff + ((32 - face->size->metrics.descender) >> 6);
IntEngBitBlt(
BackgroundLeft = DestRect.right;
}
- DestRect.left = TextLeft;
- DestRect.right = TextLeft + glyph->bitmap.width;
+ DestRect.left = ((TextLeft + 32) >> 6) + glyph->bitmap_left;
+ DestRect.right = DestRect.left + glyph->bitmap.width;
DestRect.top = TextTop + yoff - glyph->bitmap_top;
DestRect.bottom = DestRect.top + glyph->bitmap.rows;
if (NULL == Dx)
{
- TextLeft += (glyph->advance.x + 32) >> 6;
+ TextLeft += glyph->advance.x;
}
else
{
- TextLeft += Dx[i];
+ TextLeft += Dx[i] << 6;
}
previous = glyph_index;
{
glyph_index = FT_Get_Char_Index(face, i);
FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
- SafeBuffer[i - FirstChar] = face->glyph->advance.x >> 6;
+ SafeBuffer[i - FirstChar] = (face->glyph->advance.x + 32) >> 6;
}
IntUnLockFreeType;
TEXTOBJ_UnlockText(hFont);
FT_Face face;
FT_GlyphSlot glyph;
INT error, n, glyph_index, i, previous;
- LONG TotalWidth = 0;
+ ULONGLONG TotalWidth = 0;
FT_CharMap charmap, found = NULL;
BOOL use_kerning;
IntLockFreeType;
FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
IntUnLockFreeType;
- TotalWidth += delta.x >> 6;
+ TotalWidth += delta.x;
}
- TotalWidth += glyph->advance.x >> 6;
+ TotalWidth += glyph->advance.x;
- if (TotalWidth <= MaxExtent && NULL != Fit)
+ if (((TotalWidth + 32) >> 6) <= MaxExtent && NULL != Fit)
{
*Fit = i + 1;
}
if (NULL != Dx)
{
- Dx[i] = TotalWidth;
+ Dx[i] = (TotalWidth + 32) >> 6;
}
previous = glyph_index;
String++;
}
- Size->cx = TotalWidth;
+ Size->cx = (TotalWidth + 32) >> 6;
Size->cy = (TextObj->logfont.lfHeight < 0 ? - TextObj->logfont.lfHeight : TextObj->logfont.lfHeight);
Size->cy = EngMulDiv(Size->cy, NtGdiGetDeviceCaps(hDC, LOGPIXELSY), 72);