[FORMATTING]

Fix indentation. No code change.

svn path=/trunk/; revision=38199
This commit is contained in:
Timo Kreuzer 2008-12-20 19:43:11 +00:00
parent 35568f58b0
commit 93d4ecb9e8

View file

@ -58,7 +58,8 @@
FT_Library library;
typedef struct _FONT_ENTRY {
typedef struct _FONT_ENTRY
{
LIST_ENTRY ListEntry;
FONTGDI *Font;
UNICODE_STRING FaceName;
@ -77,7 +78,8 @@ static BOOL RenderingEnabled = TRUE;
UINT Hits;
UINT Misses;
typedef struct _FONT_CACHE_ENTRY {
typedef struct _FONT_CACHE_ENTRY
{
LIST_ENTRY ListEntry;
int GlyphIndex;
FT_Face Face;
@ -87,7 +89,8 @@ typedef struct _FONT_CACHE_ENTRY {
static LIST_ENTRY FontCacheListHead;
static UINT FontCacheNumEntries;
static PWCHAR ElfScripts[32] = { /* these are in the order of the fsCsb[0] bits */
static PWCHAR ElfScripts[32] = /* these are in the order of the fsCsb[0] bits */
{
L"Western", /*00*/
L"Central_European",
L"Cyrillic",
@ -114,7 +117,8 @@ static PWCHAR ElfScripts[32] = { /* these are in the order of the fsCsb[0] bits
*/
#define CP_SYMBOL 42
#define MAXTCIINDEX 32
static const CHARSETINFO FontTci[MAXTCIINDEX] = {
static const CHARSETINFO FontTci[MAXTCIINDEX] =
{
/* ANSI */
{ ANSI_CHARSET, 1252, {{0,0,0,0},{FS_LATIN1,0}} },
{ EASTEUROPE_CHARSET, 1250, {{0,0,0,0},{FS_LATIN2,0}} },
@ -166,7 +170,8 @@ InitFontSupport(VOID)
ExInitializeFastMutex(&FreeTypeLock);
ulError = FT_Init_FreeType(&library);
if (ulError) {
if (ulError)
{
DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
return FALSE;
}
@ -367,7 +372,7 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
}
FontGDI = EngAllocMem(FL_ZERO_MEMORY, sizeof(FONTGDI), TAG_FONTOBJ);
if(FontGDI == NULL)
if (FontGDI == NULL)
{
FT_Done_Face(Face);
ObDereferenceObject(SectionObject);
@ -466,13 +471,13 @@ IntEnableFontRendering(BOOL Enable)
FT_Render_Mode FASTCALL
IntGetFontRenderMode(LOGFONTW *logfont)
{
switch(logfont->lfQuality)
switch (logfont->lfQuality)
{
case NONANTIALIASED_QUALITY:
return FT_RENDER_MODE_MONO;
case DRAFT_QUALITY:
return FT_RENDER_MODE_LIGHT;
/* case CLEARTYPE_QUALITY:
/* case CLEARTYPE_QUALITY:
return FT_RENDER_MODE_LCD; */
}
return FT_RENDER_MODE_NORMAL;
@ -1309,15 +1314,16 @@ ftGdiGlyphCacheGet(
CurrentEntry = CurrentEntry->Flink;
}
if (CurrentEntry == &FontCacheListHead) {
if (CurrentEntry == &FontCacheListHead)
{
// DbgPrint("Miss! %x\n", FontEntry->Glyph);
/*
/*
Misses++;
if (Misses>100) {
DbgPrint ("Hits: %d Misses: %d\n", Hits, Misses);
Hits = Misses = 0;
}
*/
*/
return NULL;
}
@ -1325,14 +1331,14 @@ ftGdiGlyphCacheGet(
InsertHeadList(&FontCacheListHead, CurrentEntry);
// DbgPrint("Hit! %x\n", FontEntry->Glyph);
/*
/*
Hits++;
if (Hits>100) {
DbgPrint ("Hits: %d Misses: %d\n", Hits, Misses);
Hits = Misses = 0;
}
*/
*/
return FontEntry->Glyph;
}
@ -1377,7 +1383,8 @@ ftGdiGlyphCacheSet(
NewEntry->Height = Height;
InsertHeadList(&FontCacheListHead, &NewEntry->ListEntry);
if (FontCacheNumEntries++ > MAX_FONT_CACHE) {
if (FontCacheNumEntries++ > MAX_FONT_CACHE)
{
NewEntry = (PFONT_CACHE_ENTRY)FontCacheListHead.Blink;
FT_Done_Glyph(NewEntry->Glyph);
RemoveTailList(&FontCacheListHead);
@ -1471,7 +1478,7 @@ ftGdiGetGlyphOutline(
cjBuf, pvBuf, pmat2);
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
MatrixS2XForm(&xForm, &dc->DcLevel.mxWorldToDevice);
eM11 = xForm.eM11;
@ -1651,9 +1658,9 @@ ftGdiGetGlyphOutline(
{
INT xc, yc;
FT_Vector vec;
for(xc = 0; xc < 2; xc++)
for (xc = 0; xc < 2; xc++)
{
for(yc = 0; yc < 2; yc++)
for (yc = 0; yc < 2; yc++)
{
vec.x = (ft_face->glyph->metrics.horiBearingX +
xc * ft_face->glyph->metrics.width);
@ -1661,17 +1668,17 @@ ftGdiGetGlyphOutline(
yc * ft_face->glyph->metrics.height;
DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
FT_Vector_Transform(&vec, &transMat);
if(xc == 0 && yc == 0)
if (xc == 0 && yc == 0)
{
left = right = vec.x;
top = bottom = vec.y;
}
else
{
if(vec.x < left) left = vec.x;
else if(vec.x > right) right = vec.x;
if(vec.y < bottom) bottom = vec.y;
else if(vec.y > top) top = vec.y;
if (vec.x < left) left = vec.x;
else if (vec.x > right) right = vec.x;
if (vec.y < bottom) bottom = vec.y;
else if (vec.y > top) top = vec.y;
}
}
}
@ -1713,7 +1720,7 @@ ftGdiGetGlyphOutline(
return GDI_ERROR;
}
switch(iFormat)
switch (iFormat)
{
case GGO_BITMAP:
width = gm.gmBlackBoxX;
@ -1721,16 +1728,16 @@ ftGdiGetGlyphOutline(
pitch = ((width + 31) >> 5) << 2;
needed = pitch * height;
if(!pvBuf || !cjBuf) break;
if (!pvBuf || !cjBuf) break;
switch(ft_face->glyph->format)
switch (ft_face->glyph->format)
{
case ft_glyph_format_bitmap:
{
BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
INT w = (ft_face->glyph->bitmap.width + 7) >> 3;
INT h = ft_face->glyph->bitmap.rows;
while(h--)
while (h--)
{
RtlCopyMemory(dst, src, w);
src += ft_face->glyph->bitmap.pitch;
@ -1747,7 +1754,7 @@ ftGdiGetGlyphOutline(
ft_bitmap.buffer = pvBuf;
IntLockFreeType;
if(needsTransform)
if (needsTransform)
{
FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
}
@ -1776,20 +1783,20 @@ ftGdiGetGlyphOutline(
pitch = (width + 3) / 4 * 4;
needed = pitch * height;
if(!pvBuf || !cjBuf) break;
if (!pvBuf || !cjBuf) break;
switch(ft_face->glyph->format)
switch (ft_face->glyph->format)
{
case ft_glyph_format_bitmap:
{
BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
INT h = ft_face->glyph->bitmap.rows;
INT x;
while(h--)
while (h--)
{
for(x = 0; x < pitch; x++)
for (x = 0; x < pitch; x++)
{
if(x < ft_face->glyph->bitmap.width)
if (x < ft_face->glyph->bitmap.width)
dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
else
dst[x] = 0;
@ -1833,10 +1840,10 @@ ftGdiGetGlyphOutline(
return GDI_ERROR;
}
start = pvBuf;
for(row = 0; row < height; row++)
for (row = 0; row < height; row++)
{
ptr = start;
for(col = 0; col < width; col++, ptr++)
for (col = 0; col < width; col++, ptr++)
{
*ptr = (((int)*ptr) * mult + 128) / 256;
}
@ -1853,24 +1860,24 @@ ftGdiGetGlyphOutline(
TTPOLYCURVE *ppc;
DWORD pph_start, cpfx, type;
if(cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
IntLockFreeType;
if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
for(contour = 0; contour < outline->n_contours; contour++)
for (contour = 0; contour < outline->n_contours; contour++)
{
pph_start = needed;
pph = (TTPOLYGONHEADER *)((char *)pvBuf + needed);
first_pt = point;
if(pvBuf)
if (pvBuf)
{
pph->dwType = TT_POLYGON_TYPE;
FTVectorToPOINTFX(&outline->points[point], &pph->pfxStart);
}
needed += sizeof(*pph);
point++;
while(point <= outline->contours[contour])
while (point <= outline->contours[contour])
{
ppc = (TTPOLYCURVE *)((char *)pvBuf + needed);
type = (outline->tags[point] & FT_Curve_Tag_On) ?
@ -1878,40 +1885,41 @@ ftGdiGetGlyphOutline(
cpfx = 0;
do
{
if(pvBuf)
if (pvBuf)
FTVectorToPOINTFX(&outline->points[point], &ppc->apfx[cpfx]);
cpfx++;
point++;
} while(point <= outline->contours[contour] &&
}
while (point <= outline->contours[contour] &&
(outline->tags[point] & FT_Curve_Tag_On) ==
(outline->tags[point-1] & FT_Curve_Tag_On));
/* At the end of a contour Windows adds the start point, but
only for Beziers */
if(point > outline->contours[contour] &&
if (point > outline->contours[contour] &&
!(outline->tags[point-1] & FT_Curve_Tag_On))
{
if(pvBuf)
if (pvBuf)
FTVectorToPOINTFX(&outline->points[first_pt], &ppc->apfx[cpfx]);
cpfx++;
}
else if(point <= outline->contours[contour] &&
else if (point <= outline->contours[contour] &&
outline->tags[point] & FT_Curve_Tag_On)
{
/* add closing pt for bezier */
if(pvBuf)
if (pvBuf)
FTVectorToPOINTFX(&outline->points[point], &ppc->apfx[cpfx]);
cpfx++;
point++;
}
if(pvBuf)
if (pvBuf)
{
ppc->wType = type;
ppc->cpfx = cpfx;
}
needed += sizeof(*ppc) + (cpfx - 1) * sizeof(POINTFX);
}
if(pvBuf) pph->cb = needed - pph_start;
if (pvBuf) pph->cb = needed - pph_start;
}
IntUnLockFreeType;
break;
@ -1941,7 +1949,7 @@ ftGdiGetGlyphOutline(
TTPOLYCURVE *ppc;
DWORD pph_start, cpfx, type;
FT_Vector cubic_control[4];
if(cjBuf == 0) pvBuf = NULL;
if (cjBuf == 0) pvBuf = NULL;
if (needsTransform && pvBuf)
{
@ -1950,19 +1958,19 @@ ftGdiGetGlyphOutline(
IntUnLockFreeType;
}
for(contour = 0; contour < outline->n_contours; contour++)
for (contour = 0; contour < outline->n_contours; contour++)
{
pph_start = needed;
pph = (TTPOLYGONHEADER *)((char *)pvBuf + needed);
first_pt = point;
if(pvBuf)
if (pvBuf)
{
pph->dwType = TT_POLYGON_TYPE;
FTVectorToPOINTFX(&outline->points[point], &pph->pfxStart);
}
needed += sizeof(*pph);
point++;
while(point <= outline->contours[contour])
while (point <= outline->contours[contour])
{
ppc = (TTPOLYCURVE *)((char *)pvBuf + needed);
type = (outline->tags[point] & FT_Curve_Tag_On) ?
@ -1970,9 +1978,9 @@ ftGdiGetGlyphOutline(
cpfx = 0;
do
{
if(type == TT_PRIM_LINE)
if (type == TT_PRIM_LINE)
{
if(pvBuf)
if (pvBuf)
FTVectorToPOINTFX(&outline->points[point], &ppc->apfx[cpfx]);
cpfx++;
point++;
@ -1985,19 +1993,19 @@ ftGdiGetGlyphOutline(
/* FIXME: Possible optimization in endpoint calculation
if there are two consecutive curves */
cubic_control[0] = outline->points[point-1];
if(!(outline->tags[point-1] & FT_Curve_Tag_On))
if (!(outline->tags[point-1] & FT_Curve_Tag_On))
{
cubic_control[0].x += outline->points[point].x + 1;
cubic_control[0].y += outline->points[point].y + 1;
cubic_control[0].x >>= 1;
cubic_control[0].y >>= 1;
}
if(point+1 > outline->contours[contour])
if (point+1 > outline->contours[contour])
cubic_control[3] = outline->points[first_pt];
else
{
cubic_control[3] = outline->points[point+1];
if(!(outline->tags[point+1] & FT_Curve_Tag_On))
if (!(outline->tags[point+1] & FT_Curve_Tag_On))
{
cubic_control[3].x += outline->points[point].x + 1;
cubic_control[3].y += outline->points[point].y + 1;
@ -2014,7 +2022,7 @@ ftGdiGetGlyphOutline(
cubic_control[1].y += (cubic_control[0].y + 1) / 3;
cubic_control[2].x += (cubic_control[3].x + 1) / 3;
cubic_control[2].y += (cubic_control[3].y + 1) / 3;
if(pvBuf)
if (pvBuf)
{
FTVectorToPOINTFX(&cubic_control[1], &ppc->apfx[cpfx]);
FTVectorToPOINTFX(&cubic_control[2], &ppc->apfx[cpfx+1]);
@ -2024,27 +2032,27 @@ ftGdiGetGlyphOutline(
point++;
}
}
while(point <= outline->contours[contour] &&
while (point <= outline->contours[contour] &&
(outline->tags[point] & FT_Curve_Tag_On) ==
(outline->tags[point-1] & FT_Curve_Tag_On));
/* At the end of a contour Windows adds the start point,
but only for Beziers and we've already done that.
*/
if(point <= outline->contours[contour] &&
if (point <= outline->contours[contour] &&
outline->tags[point] & FT_Curve_Tag_On)
{
/* This is the closing pt of a bezier, but we've already
added it, so just inc point and carry on */
point++;
}
if(pvBuf)
if (pvBuf)
{
ppc->wType = type;
ppc->cpfx = cpfx;
}
needed += sizeof(*ppc) + (cpfx - 1) * sizeof(POINTFX);
}
if(pvBuf) pph->cb = needed - pph_start;
if (pvBuf) pph->cb = needed - pph_start;
}
break;
}
@ -2212,7 +2220,7 @@ ftGdiGetTextCharsetInfo(
USHORT usACP, usOEM;
Dc_Attr = Dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &Dc->Dc_Attr;
if (!Dc_Attr) Dc_Attr = &Dc->Dc_Attr;
hFont = Dc_Attr->hlfntNew;
TextObj = RealizeFontInit(hFont);
@ -2241,7 +2249,7 @@ ftGdiGetTextCharsetInfo(
{
FT_UInt dummy;
if(FT_Get_First_Char( Face, &dummy ) < 0x100)
if (FT_Get_First_Char( Face, &dummy ) < 0x100)
fs.fsCsb[0] |= FS_LATIN1;
else
fs.fsCsb[0] |= FS_SYMBOL;
@ -2394,13 +2402,13 @@ ftGdiGetTextMetricsW(
return FALSE;
}
if(!(dc = DC_LockDc(hDC)))
if (!(dc = DC_LockDc(hDC)))
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
TextObj = RealizeFontInit(Dc_Attr->hlfntNew);
if (NULL != TextObj)
{
@ -2501,7 +2509,7 @@ ftGdiGetFontData(
Error = FT_Load_Sfnt_Table(FontGdi->face, Table, Offset, NULL, &Needed);
if( !Error && Needed < Size) Size = Needed;
if ( !Error && Needed < Size) Size = Needed;
}
if (!FT_Load_Sfnt_Table(FontGdi->face, Table, Offset, Buffer, &Size))
Result = Size;
@ -2884,7 +2892,7 @@ IntGdiGetFontResourceInfo(
return FALSE;
}
switch(dwType)
switch (dwType)
{
case 0: /* FIXME: returns 1 or 2, don't know what this is atm */
*(DWORD*)pBuffer = 1;
@ -3144,7 +3152,7 @@ NtGdiExtTextOutW(
}
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
/* Check if String is valid */
if ((Count > 0xFFFF) || (Count > 0 && UnsafeString == NULL))
@ -3217,7 +3225,8 @@ NtGdiExtTextOutW(
SurfObj = &BitmapObj->SurfObj;
ASSERT(SurfObj);
Start.x = XStart; Start.y = YStart;
Start.x = XStart;
Start.y = YStart;
IntLPtoDP(dc, &Start, 1);
RealXStart = (Start.x + dc->ptlDCOrig.x) << 6;
@ -3307,7 +3316,7 @@ NtGdiExtTextOutW(
}
TextObj = RealizeFontInit(Dc_Attr->hlfntNew);
if(TextObj == NULL)
if (TextObj == NULL)
{
goto fail;
}
@ -3642,7 +3651,7 @@ NtGdiExtTextOutW(
EngDeleteXlate(XlateObj);
EngDeleteXlate(XlateObj2);
BITMAPOBJ_UnlockBitmap(BitmapObj);
if(TextObj != NULL)
if (TextObj != NULL)
TEXTOBJ_UnlockText(TextObj);
if (hBrushBg != NULL)
{
@ -3669,7 +3678,7 @@ fail:
EngDeleteXlate(XlateObj2);
if ( XlateObj != NULL )
EngDeleteXlate(XlateObj);
if(TextObj != NULL)
if (TextObj != NULL)
TEXTOBJ_UnlockText(TextObj);
if (BitmapObj != NULL)
BITMAPOBJ_UnlockBitmap(BitmapObj);
@ -3696,9 +3705,9 @@ fail:
return FALSE;
}
/*
* @implemented
*/
/*
* @implemented
*/
BOOL
APIENTRY
NtGdiGetCharABCWidthsW(
@ -3721,7 +3730,7 @@ NtGdiGetCharABCWidthsW(
HFONT hFont = 0;
NTSTATUS Status = STATUS_SUCCESS;
if(pwch)
if (pwch)
{
_SEH2_TRY
{
@ -3758,7 +3767,7 @@ NtGdiGetCharABCWidthsW(
return FALSE;
}
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
hFont = Dc_Attr->hlfntNew;
TextObj = RealizeFontInit(hFont);
DC_UnlockDc(dc);
@ -3834,7 +3843,7 @@ NtGdiGetCharABCWidthsW(
lsb = left >> 6;
bbx = (right - left) >> 6;
/*
/*
DPRINT1("lsb %d and bbx %d\n", lsb, bbx );
*/
if (!fl)
@ -3864,9 +3873,9 @@ NtGdiGetCharABCWidthsW(
return TRUE;
}
/*
* @implemented
*/
/*
* @implemented
*/
BOOL
APIENTRY
NtGdiGetCharWidthW(
@ -3889,7 +3898,7 @@ NtGdiGetCharWidthW(
UINT i, glyph_index, BufferSize;
HFONT hFont = 0;
if(pwc)
if (pwc)
{
_SEH2_TRY
{
@ -3926,7 +3935,7 @@ NtGdiGetCharWidthW(
return FALSE;
}
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
hFont = Dc_Attr->hlfntNew;
TextObj = RealizeFontInit(hFont);
DC_UnlockDc(dc);
@ -4004,9 +4013,9 @@ NtGdiGetCharWidthW(
}
/*
* @implemented
*/
/*
* @implemented
*/
DWORD
APIENTRY
NtGdiGetGlyphIndicesW(
@ -4038,7 +4047,7 @@ NtGdiGetGlyphIndicesW(
return GDI_ERROR;
}
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
hFont = Dc_Attr->hlfntNew;
TextObj = RealizeFontInit(hFont);
DC_UnlockDc(dc);