Index: win32ss/include/ntgdityp.h
===================================================================
--- win32ss/include/ntgdityp.h	(revision 72061)
+++ win32ss/include/ntgdityp.h	(working copy)
@@ -231,6 +231,8 @@
 /* New color use parameter. See support.microsoft.com/kb/kbview/108497 */
 #define DIB_PAL_INDICES 2
 
+/* Get/SetBounds/Rect support. */
+#define DCB_WINDOWMGR 0x8000 /* Queries the Windows bounding rectangle instead of the application's */
 
 /* TYPES *********************************************************************/
 
Index: win32ss/gdi/ntgdi/bitblt.c
===================================================================
--- win32ss/gdi/ntgdi/bitblt.c	(revision 72061)
+++ win32ss/gdi/ntgdi/bitblt.c	(working copy)
@@ -78,6 +78,11 @@
     DestRect.right  += DCDest->ptlDCOrig.x;
     DestRect.bottom += DCDest->ptlDCOrig.y;
 
+    if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(DCDest, &DestRect);
+    }
+
     SourceRect.left   = XOriginSrc;
     SourceRect.top    = YOriginSrc;
     SourceRect.right  = XOriginSrc + WidthSrc;
@@ -262,6 +267,11 @@
     rcSrc.right  += DCSrc->ptlDCOrig.x;
     rcSrc.bottom += DCSrc->ptlDCOrig.y;
 
+    if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(DCDest, &rcDest);
+    }
+
     /* Prepare for blit */
     DC_vPrepareDCsForBlit(DCDest, &rcDest, DCSrc, &rcSrc);
 
@@ -420,6 +430,11 @@
     DestRect.right  += DCDest->ptlDCOrig.x;
     DestRect.bottom += DCDest->ptlDCOrig.y;
 
+    if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(DCDest, &DestRect);
+    }
+
     SourcePoint.x = nXSrc;
     SourcePoint.y = nYSrc;
 
@@ -619,6 +634,11 @@
     DestRect.right  += DCDest->ptlDCOrig.x;
     DestRect.bottom += DCDest->ptlDCOrig.y;
 
+    if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(DCDest, &DestRect);
+    }
+
     SourceRect.left   = XOriginSrc;
     SourceRect.top    = YOriginSrc;
     SourceRect.right  = XOriginSrc+WidthSrc;
@@ -807,6 +827,12 @@
     DestRect.top    += pdc->ptlDCOrig.y;
     DestRect.right  += pdc->ptlDCOrig.x;
     DestRect.bottom += pdc->ptlDCOrig.y;
+
+    if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(pdc, &DestRect);
+    }
+
 #ifdef _USE_DIBLIB_
     BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x + XLeft;
     BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y + YLeft;
@@ -1058,6 +1084,13 @@
         return FALSE;
     }
 
+    if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+        RECTL rcrgn;        
+        REGION_GetRgnBox(prgnClip, &rcrgn);
+        IntUpdateBoundsRect(pdc, &rcrgn);
+    }
+
     /* Prepare the DC */
     DC_vPrepareDCsForBlit(pdc, &prgnClip->rdh.rcBound, NULL, NULL);
 
@@ -1137,6 +1170,13 @@
         return FALSE;
     }
 
+    if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+        RECTL rcrgn;        
+        REGION_GetRgnBox(prgnClip, &rcrgn);
+        IntUpdateBoundsRect(pdc, &rcrgn);
+    }
+
     IntEngInitClipObj(&xcoClip);
     IntEngUpdateClipRegion(&xcoClip,
                            prgnClip->rdh.nCount,
@@ -1351,6 +1391,22 @@
         return -1;
     }
 
+    if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       RECTL rcDst;
+
+       RECTL_vSetRect(&rcDst, x, y, x+1, y+1);
+
+       IntLPtoDP(pdc, (LPPOINT)&rcDst, 2);
+
+       rcDst.left   += pdc->ptlDCOrig.x;
+       rcDst.top    += pdc->ptlDCOrig.y;
+       rcDst.right  += pdc->ptlDCOrig.x;
+       rcDst.bottom += pdc->ptlDCOrig.y;
+
+       IntUpdateBoundsRect(pdc, &rcDst);
+    }
+
     /* Translate the color to the target format */
     iSolidColor = TranslateCOLORREF(pdc, crColor);
 
Index: win32ss/gdi/ntgdi/coord.h
===================================================================
--- win32ss/gdi/ntgdi/coord.h	(revision 72061)
+++ win32ss/gdi/ntgdi/coord.h	(working copy)
@@ -4,10 +4,16 @@
 #define MIN_COORD (INT_MIN / 16)
 #define MAX_COORD (INT_MAX / 16)
 
-#define IntLPtoDP(pdc, ppt, count) DC_vXformWorldToDevice(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt));
-#define CoordLPtoDP(pdc, ppt) DC_vXformWorldToDevice(pdc, 1,  (PPOINTL)(ppt), (PPOINTL)(ppt));
-#define IntDPtoLP(pdc, ppt, count) DC_vXformDeviceToWorld(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt));
-#define CoordDPtoLP(pdc, ppt) DC_vXformDeviceToWorld(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
+#define IntLPtoDP(pdc, ppt, count) \
+        DC_vUpdateWorldToDevice(pdc); \
+        DC_vXformWorldToDevice(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt));
+#define CoordLPtoDP(pdc, ppt) \
+        DC_vXformWorldToDevice(pdc, 1,  (PPOINTL)(ppt), (PPOINTL)(ppt));
+#define IntDPtoLP(pdc, ppt, count) \
+        DC_vUpdateDeviceToWorld(pdc); \
+        DC_vXformDeviceToWorld(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt));
+#define CoordDPtoLP(pdc, ppt) \
+        DC_vXformDeviceToWorld(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
 
 #define XForm2MatrixS(m, x) XFormToMatrix(m, (XFORML*)x)
 #define MatrixS2XForm(x, m) MatrixToXForm((XFORML*)x, m)
Index: win32ss/gdi/ntgdi/dc.h
===================================================================
--- win32ss/gdi/ntgdi/dc.h	(revision 72061)
+++ win32ss/gdi/ntgdi/dc.h	(working copy)
@@ -3,9 +3,6 @@
 
 /* Constants ******************************************************************/
 
-/* Get/SetBounds/Rect support. */
-#define DCB_WINDOWMGR 0x8000 /* Queries the Windows bounding rectangle instead of the application's */
-
 /* flFontState */
 enum _FONT_STATE
 {
@@ -207,6 +204,7 @@
 HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC);
 BOOL FASTCALL IntGdiCleanDC(HDC hDC);
 VOID FASTCALL IntvGetDeviceCaps(PPDEVOBJ, PDEVCAPS);
+VOID FASTCALL IntUpdateBoundsRect(PDC,PRECTL);
 
 BOOL NTAPI GreSetDCOwner(HDC hdc, ULONG ulOwner);
 HDC APIENTRY GreCreateCompatibleDC(HDC hdc, BOOL bAltDc);
Index: win32ss/gdi/ntgdi/dcutil.c
===================================================================
--- win32ss/gdi/ntgdi/dcutil.c	(revision 72061)
+++ win32ss/gdi/ntgdi/dcutil.c	(working copy)
@@ -189,8 +189,8 @@
     }
 
     DC_vUpdateTextBrush(pdc);
-//    DC_vUpdateLineBrush(pdc);
-//    DC_vUpdateFillBrush(pdc);
+    DC_vUpdateLineBrush(pdc);
+    DC_vUpdateFillBrush(pdc);
 
     DC_UnlockDc(pdc);
 
@@ -652,6 +652,20 @@
     return Ret;
 }
 
+VOID
+FASTCALL
+IntUpdateBoundsRect(PDC pdc, PRECTL pRect)
+{
+   if (pdc->fs & DC_ACCUM_APP)
+   {
+      RECTL_bUnionRect(&pdc->erclBoundsApp, &pdc->erclBoundsApp, pRect);
+   }
+   if (pdc->fs & DC_ACCUM_WMGR)
+   {
+      RECTL_bUnionRect(&pdc->erclBounds, &pdc->erclBounds, pRect);
+   }
+}
+
 DWORD
 APIENTRY
 NtGdiGetBoundsRect(
@@ -661,19 +675,49 @@
 {
     DWORD ret;
     PDC pdc;
+    RECT rc;
 
     /* Lock the DC */
     if (!(pdc = DC_LockDc(hdc))) return 0;
 
-    /* Get the return value */
-    ret = pdc->fs & DC_ACCUM_APP ? DCB_ENABLE : DCB_DISABLE;
-    ret |= RECTL_bIsEmptyRect(&pdc->erclBoundsApp) ? DCB_RESET : DCB_SET;
+    if (!(flags & DCB_WINDOWMGR))
+    {
+       rc = pdc->erclBoundsApp;
 
+       if (RECTL_bIsEmptyRect(&rc))
+       {
+          rc.left = rc.top = rc.right = rc.bottom = 0;
+          ret = DCB_RESET;
+       }
+       else
+       {
+          RECTL rcRgn;
+          if (pdc->fs & DC_FLAG_DIRTY_RAO) CLIPPING_UpdateGCRegion(pdc);
+          if(!REGION_GetRgnBox(pdc->prgnRao, &rcRgn))
+          {
+             REGION_GetRgnBox(pdc->prgnVis, &rcRgn);
+          }
+          rc.left   = max( rc.left, 0 );
+          rc.top    = max( rc.top, 0 );
+          rc.right  = min( rc.right,  rcRgn.right - rcRgn.left );
+          rc.bottom = min( rc.bottom, rcRgn.bottom - rcRgn.top );
+          DPRINT1("Rao dc %p r %d b %d\n",pdc,rcRgn.right - rcRgn.left, rcRgn.bottom - rcRgn.top);
+          DPRINT1("rc  l %d t %d\n",rc.left,rc.top);
+          DPRINT1("    r %d b %d\n",rc.right,rc.bottom);
+          ret = DCB_SET;
+       }
+       IntDPtoLP( pdc, &rc, 2 );
+       DPRINT1("rc1 l %d t %d\n",rc.left,rc.top);
+       DPRINT1("    r %d b %d\n",rc.right,rc.bottom);
+    }
+    else
+       rc = pdc->erclBounds;
+
     /* Copy the rect to the caller */
     _SEH2_TRY
     {
         ProbeForWrite(prc, sizeof(RECT), 1);
-        *prc = pdc->erclBoundsApp;
+        *prc = rc;
     }
     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
     {
@@ -683,7 +727,16 @@
 
     if (flags & DCB_RESET)
     {
-        RECTL_vSetEmptyRect(&pdc->erclBoundsApp);
+        if (!(flags & DCB_WINDOWMGR))
+        {
+           pdc->erclBoundsApp.left = pdc->erclBoundsApp.top = INT_MAX;
+           pdc->erclBoundsApp.right = pdc->erclBoundsApp.bottom = INT_MIN;
+        }
+        else
+        {
+           pdc->erclBounds.left = pdc->erclBounds.top = INT_MAX;
+           pdc->erclBounds.right = pdc->erclBounds.bottom = INT_MIN;
+        }
     }
 
     DC_UnlockDc(pdc);
@@ -690,7 +743,6 @@
     return ret;
 }
 
-
 DWORD
 APIENTRY
 NtGdiSetBoundsRect(
@@ -709,12 +761,23 @@
     if (!(pdc = DC_LockDc(hdc))) return 0;
 
     /* Get the return value */
-    ret = pdc->fs & DC_ACCUM_APP ? DCB_ENABLE : DCB_DISABLE;
-    ret |= RECTL_bIsEmptyRect(&pdc->erclBoundsApp) ? DCB_RESET : DCB_SET;
+    ret = DCB_RESET; /* we don't have device-specific bounds */
+    ret = (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR) ? DCB_ENABLE : DCB_DISABLE) |
+          (RECTL_bIsEmptyRect(&pdc->erclBoundsApp) ? ret & DCB_SET : DCB_SET );
+    ret |= (flags & DCB_WINDOWMGR);
 
     if (flags & DCB_RESET)
     {
-        RECTL_vSetEmptyRect(&pdc->erclBoundsApp);
+        if (!(flags & DCB_WINDOWMGR))
+        {
+           pdc->erclBoundsApp.left = pdc->erclBoundsApp.top = INT_MAX;
+           pdc->erclBoundsApp.right = pdc->erclBoundsApp.bottom = INT_MIN;
+        }
+        else
+        {
+           pdc->erclBounds.left = pdc->erclBounds.top = INT_MAX;
+           pdc->erclBounds.right = pdc->erclBounds.bottom = INT_MIN;
+        }
     }
 
     if (flags & DCB_ACCUMULATE && prc != NULL)
@@ -733,11 +796,30 @@
         _SEH2_END;
 
         RECTL_vMakeWellOrdered(&rcl);
-        RECTL_bUnionRect(&pdc->erclBoundsApp, &pdc->erclBoundsApp, &rcl);
+
+        if (!(flags & DCB_WINDOWMGR))
+        {           
+           IntLPtoDP( pdc, (POINT *)&rcl, 2 );
+           RECTL_bUnionRect(&pdc->erclBoundsApp, &pdc->erclBoundsApp, &rcl);
+        }
+        else
+           RECTL_bUnionRect(&pdc->erclBounds, &pdc->erclBounds, &rcl);
     }
 
-    if (flags & DCB_ENABLE) pdc->fs |= DC_ACCUM_APP;
-    if (flags & DCB_DISABLE) pdc->fs &= ~DC_ACCUM_APP;
+    if (flags & DCB_ENABLE)
+    {
+       if (!(flags & DCB_WINDOWMGR))
+          pdc->fs |= DC_ACCUM_APP;
+       else
+          pdc->fs |= DC_ACCUM_WMGR;
+    }
+    if (flags & DCB_DISABLE)
+    {
+       if (!(flags & DCB_WINDOWMGR))
+          pdc->fs &= ~DC_ACCUM_APP;
+       else
+          pdc->fs &= ~DC_ACCUM_WMGR;
+    }
     DC_UnlockDc(pdc);
     return ret;
 }
Index: win32ss/gdi/ntgdi/dibobj.c
===================================================================
--- win32ss/gdi/ntgdi/dibobj.c	(revision 72061)
+++ win32ss/gdi/ntgdi/dibobj.c	(working copy)
@@ -559,6 +559,11 @@
     rcDest.bottom = rcDest.top + Height;
     rcDest.top += StartScan;
 
+    if (pDC->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(pDC, &rcDest);
+    }
+
     ptSource.x = XSrc;
     ptSource.y = YSrc;
 
@@ -1265,6 +1270,11 @@
     IntLPtoDP(pdc, (POINTL*)&rcDst, 2);
     RECTL_vOffsetRect(&rcDst, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y);
 
+    if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(pdc, &rcDst);
+    }
+
     hbmTmp = GreCreateBitmapEx(pbmi->bmiHeader.biWidth,
                                abs(pbmi->bmiHeader.biHeight),
                                0,
@@ -1705,6 +1715,54 @@
 
 HBITMAP
 APIENTRY
+GreCreateDIBSection(
+    IN HDC hDC,
+    IN OPTIONAL HANDLE hSection,
+    IN DWORD dwOffset,
+    IN BITMAPINFO* bmi,
+    IN DWORD Usage,
+    IN UINT cjHeader,
+    IN FLONG fl,
+    IN ULONG_PTR dwColorSpace,
+    OUT PVOID *Bits)
+{
+    HBITMAP hbitmap = 0;
+    DC *dc;
+    BOOL bDesktopDC = FALSE;
+
+    if (!bmi) return hbitmap; // Make sure.
+
+    // If the reference hdc is null, take the desktop dc
+    if (hDC == 0)
+    {
+        hDC = NtGdiCreateCompatibleDC(0);
+        bDesktopDC = TRUE;
+    }
+
+    if ((dc = DC_LockDc(hDC)))
+    {
+        hbitmap = DIB_CreateDIBSection(dc,
+                                       bmi,
+                                       Usage,
+                                       Bits,
+                                       hSection,
+                                       dwOffset,
+                                       0);
+        DC_UnlockDc(dc);
+    }
+    else
+    {
+        EngSetLastError(ERROR_INVALID_HANDLE);
+    }
+
+    if (bDesktopDC)
+        NtGdiDeleteObjectApp(hDC);
+
+    return hbitmap;
+}
+
+HBITMAP
+APIENTRY
 DIB_CreateDIBSection(
     PDC dc,
     CONST BITMAPINFO *bmi,
Index: win32ss/gdi/ntgdi/fillshap.c
===================================================================
--- win32ss/gdi/ntgdi/fillshap.c	(revision 72061)
+++ win32ss/gdi/ntgdi/fillshap.c	(working copy)
@@ -572,6 +572,11 @@
     DestRect.top    += dc->ptlDCOrig.y;
     DestRect.bottom += dc->ptlDCOrig.y;
 
+    if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(dc, &DestRect);
+    }
+
     /* In GM_COMPATIBLE, don't include bottom and right edges */
     if (pdcattr->iGraphicsMode == GM_COMPATIBLE)
     {
@@ -971,6 +976,11 @@
     ptlDitherOrg.x += pdc->ptlDCOrig.x;
     ptlDitherOrg.y += pdc->ptlDCOrig.y;
 
+   if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+   {
+      IntUpdateBoundsRect(pdc, &rclExtent);
+   }
+
     DC_vPrepareDCsForBlit(pdc, &rclExtent, NULL, NULL);
 
     psurf = pdc->dclevel.pSurface;
@@ -1138,6 +1148,11 @@
         RECTL_vSetRect(&DestRect, 0, 0, psurf->SurfObj.sizlBitmap.cx, psurf->SurfObj.sizlBitmap.cy);
     }
 
+    if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+    {
+       IntUpdateBoundsRect(dc, &DestRect);
+    }
+
     EXLATEOBJ_vInitialize(&exlo, &gpalRGB, psurf->ppal, 0, 0xffffff, 0);
 
     /* Only solid fills supported for now
Index: win32ss/gdi/ntgdi/freetype.c
===================================================================
--- win32ss/gdi/ntgdi/freetype.c	(revision 72061)
+++ win32ss/gdi/ntgdi/freetype.c	(working copy)
@@ -37,6 +37,14 @@
 #define gmxWorldToDeviceDefault gmxWorldToPageDefault
 
 FT_Library  library;
+typedef struct
+{
+    FT_Int major;
+    FT_Int minor;
+    FT_Int patch;
+} FT_Version_t;
+static FT_Version_t FT_Version;
+static DWORD FT_SimpleVersion;
 
 typedef struct _FONT_ENTRY
 {
@@ -179,6 +187,13 @@
         return FALSE;
     }
 
+    FT_Library_Version(library,&FT_Version.major,&FT_Version.minor,&FT_Version.patch);
+
+    DPRINT1("FreeType version is %d.%d.%d\n",FT_Version.major,FT_Version.minor,FT_Version.patch);
+    FT_SimpleVersion = ((FT_Version.major << 16) & 0xff0000) |
+                       ((FT_Version.minor <<  8) & 0x00ff00) |
+                       ((FT_Version.patch      ) & 0x0000ff);
+
     IntLoadSystemFonts();
 
     return TRUE;
@@ -676,7 +691,27 @@
     /* Correct forumla to get the maxcharwidth from unicode and ansi font */
     TM->tmMaxCharWidth = (FT_MulFix(Face->max_advance_width, XScale) + 32) >> 6;
 
-    TM->tmWeight = pOS2->usWeightClass;
+    if ( TM->tmWeight > 550 && !(Face->style_flags & FT_STYLE_FLAG_BOLD) )
+       FontGDI->flType |= FO_SIM_BOLD; // Use this for now.
+
+    TM->tmWeight = FW_REGULAR; 
+    if ( FontGDI->flType & FO_SIM_BOLD )
+    {    
+       TM->tmAveCharWidth++;  
+       TM->tmMaxCharWidth++;  
+       TM->tmWeight = FW_BOLD;
+    }   
+    else
+    {
+       if (Face->style_flags & FT_STYLE_FLAG_BOLD)
+       {
+          if (pOS2->usWeightClass > FW_MEDIUM)  
+             TM->tmWeight = pOS2->usWeightClass;
+       }
+       else if (pOS2->usWeightClass <= FW_MEDIUM)
+             TM->tmWeight = pOS2->usWeightClass;
+    }
+
     TM->tmOverhang = 0;
     TM->tmDigitizedAspectX = 96;
     TM->tmDigitizedAspectY = 96;
@@ -1046,6 +1081,8 @@
     TEXTMETRICW *TM;
     NEWTEXTMETRICW *Ntm;
     DWORD fs0;
+    FT_WinFNT_HeaderRec Win;
+    ULONG Error;
     NTSTATUS status;
 
     RtlZeroMemory(Info, sizeof(FONTFAMILYINFO));
@@ -1093,10 +1130,24 @@
     Ntm->tmCharSet = TM->tmCharSet;
     Ntm->ntmFlags = TM->tmItalic ? NTM_ITALIC : 0;
 
-    if (550 < TM->tmWeight) Ntm->ntmFlags |= NTM_BOLD;
+    if (FontGDI->face->style_flags & FT_STYLE_FLAG_ITALIC) Ntm->ntmFlags |= NTM_ITALIC;
+    if (FontGDI->face->style_flags & FT_STYLE_FLAG_BOLD)   Ntm->ntmFlags |= NTM_BOLD;
 
+    IntLockFreeType;
+
+    /* fixup the flag for our fake-bold implementation. */
+    if (!FT_IS_SCALABLE( FontGDI->face ) &&
+        !FT_Get_WinFNT_Header( FontGDI->face, &Win ) &&
+         Win.weight > FW_NORMAL )
+         Ntm->ntmFlags |= NTM_BOLD;
+
+    IntUnLockFreeType;
+
     if (0 == Ntm->ntmFlags) Ntm->ntmFlags = NTM_REGULAR;
 
+    if ((FontGDI->FontObj.flFontType & (FO_CFF|FO_POSTSCRIPT)) == (FO_CFF|FO_POSTSCRIPT))
+       Ntm->ntmFlags |= NTM_PS_OPENTYPE;
+
     Ntm->ntmSizeEM = Otm->otmEMSquare;
     Ntm->ntmCellHeight = 0;
     Ntm->ntmAvgWidth = 0;
@@ -1129,7 +1180,7 @@
     IntLockFreeType;
     pOS2 = FT_Get_Sfnt_Table(FontGDI->face, ft_sfnt_os2);
     IntUnLockFreeType;
-    if (NULL != pOS2)
+    if (pOS2 != NULL)
     {
         fs.fsCsb[0] = pOS2->ulCodePageRange1;
         fs.fsCsb[1] = pOS2->ulCodePageRange2;
@@ -1185,7 +1236,40 @@
                     }
                 }
             }
+        }    
+        Info->NewTextMetricEx.ntmFontSig = fs;
+    }
+    else
+    {
+        IntLockFreeType;
+        Error = FT_Get_WinFNT_Header( FontGDI->face, &Win );
+        IntUnLockFreeType;
+        if (!Error)
+        {
+           DPRINT1("pix_h %d charset %d dpi %dx%d pt %d\n", Win.pixel_height, Win.charset,
+                 Win.vertical_resolution,Win.horizontal_resolution, Win.nominal_point_size);
+
+           if (IntTranslateCharsetInfo( (DWORD*)(UINT_PTR)Win.charset, &CharSetInfo, TCI_SRCCHARSET ))
+               fs = CharSetInfo.fs;
         }
+        if (fs.fsCsb[0] == 0)
+        { /* Let's see if we can find any interesting cmaps */
+            for (i = 0; i < (UINT)FontGDI->face->num_charmaps; i++)
+            {
+                switch (FontGDI->face->charmaps[i]->encoding)
+                {
+                case FT_ENCODING_UNICODE:
+                case FT_ENCODING_APPLE_ROMAN:
+                    fs.fsCsb[0] |= FS_LATIN1;
+                    break;
+                case FT_ENCODING_MS_SYMBOL:
+                    fs.fsCsb[0] |= FS_SYMBOL;
+                    break;
+                default:
+                    break;
+                }
+            }
+        }
         Info->NewTextMetricEx.ntmFontSig = fs;
     }
 }
@@ -2966,9 +3050,9 @@
         PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
         // Need hdev, when freetype is loaded need to create DEVOBJ for
         // Consumer and Producer.
-        TextObj->Font->iUniq = 1; // Now it can be cached.
+        FontGdi->FontObj.iUniq      = TextObj->Font->iUniq = 1; // Now it can be cached.
+        FontGdi->FontObj.flFontType = TextObj->Font->flFontType;
         IntFontType(FontGdi);
-        FontGdi->flType = TextObj->Font->flFontType;
         FontGdi->Underline = TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfUnderline ? 0xff : 0;
         FontGdi->StrikeOut = TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfStrikeOut ? 0xff : 0;
         TextObj->fl |= TEXTOBJECT_INIT;
@@ -3439,6 +3523,11 @@
         DestRect.right  += dc->ptlDCOrig.x;
         DestRect.bottom += dc->ptlDCOrig.y;
 
+        if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+        {
+           IntUpdateBoundsRect(dc, &DestRect);
+        }
+
         DC_vPrepareDCsForBlit(dc, &DestRect, NULL, NULL);
 
         if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
@@ -3715,6 +3804,10 @@
             DestRect.top = TextTop + yoff - ((fixAscender + 32) >> 6);
             DestRect.bottom = TextTop + yoff + ((32 - fixDescender) >> 6);
             MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
+            if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+            {
+               IntUpdateBoundsRect(dc, &DestRect);
+            }
             IntEngBitBlt(
                 &psurf->SurfObj,
                 NULL,
Index: win32ss/gdi/ntgdi/line.c
===================================================================
--- win32ss/gdi/ntgdi/line.c	(revision 72061)
+++ win32ss/gdi/ntgdi/line.c	(working copy)
@@ -13,6 +13,67 @@
 
 // Some code from the WINE project source (www.winehq.com)
 
+VOID FASTCALL
+AddPenLinesBounds(PDC dc, int count, POINT *points)
+{
+    DWORD join, endcap;
+    RECTL bounds, rect;
+    LONG lWidth;
+    PBRUSH pbrLine;
+
+    /* Get BRUSH from current pen. */
+    pbrLine = dc->dclevel.pbrLine;
+    ASSERT(pbrLine);
+    
+    lWidth = pbrLine->lWidth;
+
+    // Setup bounds
+    bounds.left = bounds.top = INT_MAX;
+    bounds.right = bounds.bottom = INT_MIN;
+
+    if (((pbrLine->ulPenStyle & PS_TYPE_MASK) & PS_GEOMETRIC) || lWidth > 1)
+    {
+        /* Windows uses some heuristics to estimate the distance from the point that will be painted */
+        lWidth = lWidth + 2;
+        endcap = (PS_ENDCAP_MASK & pbrLine->ulPenStyle);
+        join   = (PS_JOIN_MASK   & pbrLine->ulPenStyle);
+        if (join == PS_JOIN_MITER)
+        {
+           lWidth *= 5;
+           if (endcap == PS_ENDCAP_SQUARE) lWidth = (lWidth * 3 + 1) / 2;
+        }
+        else
+        {
+           if (endcap == PS_ENDCAP_SQUARE) lWidth -= lWidth / 4;
+           else lWidth = (lWidth + 1) / 2;
+        }
+    }
+
+    while (count-- > 0)
+    {
+        rect.left   = points->x - lWidth;
+        rect.top    = points->y - lWidth;
+        rect.right  = points->x + lWidth + 1;
+        rect.bottom = points->y + lWidth + 1;
+        RECTL_bUnionRect(&bounds, &bounds, &rect);        
+        points++;
+    }
+
+    DPRINT1("APLB dc %p l %d t %d\n",dc,rect.left,rect.top);
+    DPRINT1("                 r %d b %d\n",rect.right,rect.bottom);
+
+    {
+       RECTL rcRgn;
+       if (dc->fs & DC_FLAG_DIRTY_RAO) CLIPPING_UpdateGCRegion(dc);
+       if (REGION_GetRgnBox(dc->prgnRao, &rcRgn))
+       {
+          if (RECTL_bIntersectRect( &rcRgn, &rcRgn, &bounds )) IntUpdateBoundsRect(dc, &rcRgn);
+       }
+       else
+          IntUpdateBoundsRect(dc, &bounds);
+    }
+}
+
 // Should use Fx in Point
 //
 BOOL FASTCALL
@@ -150,6 +211,13 @@
         pbrLine = dc->dclevel.pbrLine;
         ASSERT(pbrLine);
 
+        if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+        {
+           DPRINT1("Bounds dc %p l %d t %d\n",dc,Bounds.left,Bounds.top);
+           DPRINT1("                   r %d b %d\n",Bounds.right,Bounds.bottom);
+           AddPenLinesBounds(dc, 2, Points);
+        }
+
         if (!(pbrLine->flAttrs & BR_IS_NULL))
         {
             Ret = IntEngLineTo(&psurf->SurfObj,
@@ -282,6 +350,11 @@
                 Points[i].y += dc->ptlDCOrig.y;
             }
 
+            if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
+            {
+               AddPenLinesBounds(dc, Count, Points);
+            }
+
             Ret = IntEngPolyline(&psurf->SurfObj,
                                  &dc->co.ClipObj,
                                  &dc->eboLine.BrushObject,
Index: win32ss/gdi/ntgdi/pen.h
===================================================================
--- win32ss/gdi/ntgdi/pen.h	(revision 72061)
+++ win32ss/gdi/ntgdi/pen.h	(working copy)
@@ -27,3 +27,5 @@
     _In_ PPEN pPen,
     _In_ INT Count,
     _Out_ PLOGPEN Buffer);
+
+VOID FASTCALL AddPenLinesBounds(PDC,int,POINT *);
Index: win32ss/gdi/gdi32/objects/dc.c
===================================================================
--- win32ss/gdi/gdi32/objects/dc.c	(revision 72061)
+++ win32ss/gdi/gdi32/objects/dc.c	(working copy)
@@ -800,7 +800,7 @@
     UINT	flags
 )
 {
-    return NtGdiGetBoundsRect(hdc,lprcBounds,flags & DCB_RESET);
+    return NtGdiGetBoundsRect(hdc,lprcBounds,flags & ~DCB_WINDOWMGR);
 }
 
 
@@ -814,7 +814,7 @@
               UINT flags)
 {
     /* FIXME add check for validate the flags */
-    return NtGdiSetBoundsRect(hdc, (LPRECT)prc, flags);
+    return NtGdiSetBoundsRect(hdc, (LPRECT)prc, flags & ~DCB_WINDOWMGR);
 }
 
 
