Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

dbcs.h File Reference

Go to the source code of this file.

Classes

struct  _MODE_FONT_PAIR
struct  _FS_CODEPAGE
struct  tagSTRINGBITMAP

Defines

#define UNICODE_DBCS_PADDING   0xffff
#define DEFAULT_FONTSIZE   256
#define DEFAULT_EUDCSIZE   1
#define VDM_EUDC_FONT_SIZE_X   16
#define VDM_EUDC_FONT_SIZE_Y   16
#define USACP   1252
#define KOREAN_CP   949
#define JAPAN_CP   932
#define FS_MODE_TEXT   0x0001
#define FS_MODE_GRAPHICS   0x0002
#define FS_MODE_FIND   0x8000
#define FS_TEXT   (FS_MODE_FIND+FS_MODE_TEXT)
#define FS_GRAPHICS   (FS_MODE_FIND+FS_MODE_GRAPHICS)

Typedefs

typedef _MODE_FONT_PAIR MODE_FONT_PAIR
typedef _MODE_FONT_PAIRPMODE_FONT_PAIR
typedef _FS_CODEPAGE FS_CODEPAGE
typedef _FS_CODEPAGEPFS_CODEPAGE
typedef tagSTRINGBITMAP STRINGBITMAP
typedef tagSTRINGBITMAPLPSTRINGBITMAP

Functions

UINT GetStringBitmapW (HDC hdc, LPWSTR pwc, UINT cwc, UINT cbData, BYTE *pSB)
VOID SetLineChar (IN PSCREEN_INFORMATION ScreenInfo)
BOOL CheckBisectStringA (IN DWORD CodePage, IN PCHAR Buffer, IN DWORD NumBytes, IN LPCPINFO lpCPInfo)
VOID BisectWrite (IN SHORT StringLength, IN COORD TargetPoint, IN PSCREEN_INFORMATION ScreenInfo)
VOID BisectClipbrd (IN SHORT StringLength, IN COORD TargetPoint, IN PSCREEN_INFORMATION ScreenInfo, OUT PSMALL_RECT SmallRect)
VOID BisectWriteAttr (IN SHORT StringLength, IN COORD TargetPoint, IN PSCREEN_INFORMATION ScreenInfo)
DWORD RemoveDbcsMark (IN PWCHAR Dst, IN PWCHAR Src, IN DWORD NumBytes, IN PCHAR SrcA, IN BOOL OS2OemFormat)
DWORD RemoveDbcsMarkCell (IN PCHAR_INFO Dst, IN PCHAR_INFO Src, IN DWORD NumBytes)
DWORD RemoveDbcsMarkAll (IN PSCREEN_INFORMATION ScreenInfo, IN PROW Row, IN PSHORT LeftChar, IN PRECT TextRect, IN int *TextLeft, IN PWCHAR Buffer, IN SHORT NumberOfChars)
BOOL IsDBCSLeadByteConsole (IN BYTE AsciiChar, IN LPCPINFO lpCPInfo)
NTSTATUS AdjustFont (IN PCONSOLE_INFORMATION Console, IN UINT CodePage)
NTSTATUS ConvertToCodePage (IN PCONSOLE_INFORMATION Console, IN UINT PrevCodePage)
NTSTATUS ConvertOutputOemToNonOemUnicode (IN OUT LPWSTR Source, IN OUT PBYTE KAttrRows, IN int SourceLength, IN UINT Codepage)
VOID TextOutEverything (IN PCONSOLE_INFORMATION Console, IN PSCREEN_INFORMATION ScreenInfo, IN SHORT LeftWindowPos, IN OUT PSHORT RightWindowPos, IN OUT PSHORT CountOfAttr, IN SHORT CountOfAttrOriginal, IN OUT PBOOL DoubleColorDBCS, IN BOOL LocalEUDCFlag, IN PROW Row, IN PATTR_PAIR Attr, IN SHORT LeftTextPos, IN SHORT RightTextPos, IN int WindowRectLeft, IN RECT WindowRect, IN SHORT NumberOfChars)
VOID TextOutCommonLVB (IN PCONSOLE_INFORMATION Console, IN WORD Attributes, IN RECT CommonLVBRect)
NTSTATUS MakeAltRasterFont (UINT CodePage, COORD DefaultFontSize, COORD *AltFontSize, BYTE *AltFontFamily, ULONG *AltFontIndex, LPWSTR AltFaceName)
NTSTATUS InitializeDbcsMisc (VOID)
BYTE CodePageToCharSet (UINT CodePage)
BOOL IsAvailableFarEastCodePage (UINT CodePage)
LPTTFONTLIST SearchTTFont (LPWSTR pwszFace, BOOL fCodePage, UINT CodePage)
BOOL IsAvailableTTFont (LPWSTR pwszFace)
BOOL IsAvailableTTFontCP (LPWSTR pwszFace, UINT CodePage)
LPWSTR GetAltFaceName (LPWSTR pwszFace)
BOOL IsAvailableFsCodePage (UINT CodePage)
BOOL RegisterKeisenOfTTFont (IN PSCREEN_INFORMATION ScreenInfo)
ULONG TranslateUnicodeToOem (IN PCONSOLE_INFORMATION Console, IN PWCHAR UnicodeBuffer, IN ULONG UnicodeCharCount, OUT PCHAR AnsiBuffer, IN ULONG AnsiByteCount, OUT PINPUT_RECORD DbcsLeadInpRec)
DWORD ImmConversionToConsole (DWORD fdwConversion)
DWORD ImmConversionFromConsole (DWORD dwNlsMode)
BOOL CreateDbcsScreenBuffer (IN PCONSOLE_INFORMATION Console, IN COORD dwScreenBufferSize, OUT PDBCS_SCREEN_BUFFER DbcsScreenBuffer)
BOOL DeleteDbcsScreenBuffer (IN PDBCS_SCREEN_BUFFER DbcsScreenBuffer)
BOOL ReCreateDbcsScreenBuffer (IN PCONSOLE_INFORMATION Console, IN UINT OldCodePage)
BOOL FE_PolyTextOutCandidate (IN PSCREEN_INFORMATION ScreenInfo, IN PSMALL_RECT Region)
VOID FE_ConsolePolyTextOut (IN PSCREEN_INFORMATION ScreenInfo, IN PSMALL_RECT Region)
NTSTATUS SetRAMFontCodePage (IN PSCREEN_INFORMATION ScreenInfo)
NTSTATUS SetRAMFont (IN PSCREEN_INFORMATION ScreenInfo, IN PCHAR_INFO ScreenBufPtr, IN DWORD Length)

Variables

ULONG DefaultFontIndex
COORD DefaultFontSize
BYTE DefaultFontFamily
PUSHORT RegInitialPalette
PUCHAR RegColorBuffer
PUCHAR RegColorBufferNoTranslate
DWORD NUMBER_OF_MODE_FONT_PAIRS
PMODE_FONT_PAIR RegModeFontPairs
SINGLE_LIST_ENTRY gRegFullScreenCodePage


Define Documentation

#define DEFAULT_EUDCSIZE   1
 

Definition at line 21 of file dbcs.h.

#define DEFAULT_FONTSIZE   256
 

Definition at line 20 of file dbcs.h.

#define FS_GRAPHICS   (FS_MODE_FIND+FS_MODE_GRAPHICS)
 

Definition at line 54 of file dbcs.h.

Referenced by SrvSetConsoleHardwareState().

#define FS_MODE_FIND   0x8000
 

Definition at line 52 of file dbcs.h.

Referenced by InitializeFullScreen().

#define FS_MODE_GRAPHICS   0x0002
 

Definition at line 51 of file dbcs.h.

Referenced by DisplayModeTransition(), InitializeFullScreen(), and UnregisterVDM().

#define FS_MODE_TEXT   0x0001
 

Definition at line 50 of file dbcs.h.

Referenced by InitializeFullScreen().

#define FS_TEXT   (FS_MODE_FIND+FS_MODE_TEXT)
 

Definition at line 53 of file dbcs.h.

Referenced by SrvSetConsoleHardwareState().

#define JAPAN_CP   932
 

Definition at line 28 of file dbcs.h.

Referenced by UnregisterVDM().

#define KOREAN_CP   949
 

Definition at line 27 of file dbcs.h.

Referenced by UnregisterVDM().

#define UNICODE_DBCS_PADDING   0xffff
 

Definition at line 18 of file dbcs.h.

Referenced by FE_TranslateOutputToAnsiUnicodeInternal().

#define USACP   1252
 

Definition at line 26 of file dbcs.h.

Referenced by FalseUnicodeToRealUnicode(), ReadOutputString(), RealUnicodeToFalseUnicode(), SB_TranslateOutputToOem(), SB_TranslateOutputToUnicode(), SrvInvalidateBitMapRect(), WWSB_DoSrvWriteConsole(), WWSB_FillOutput(), and WWSB_WriteOutputString().

#define VDM_EUDC_FONT_SIZE_X   16
 

Definition at line 23 of file dbcs.h.

#define VDM_EUDC_FONT_SIZE_Y   16
 

Definition at line 24 of file dbcs.h.


Typedef Documentation

typedef struct _FS_CODEPAGE FS_CODEPAGE
 

typedef struct tagSTRINGBITMAP * LPSTRINGBITMAP
 

Referenced by SetRAMFontCodePage().

typedef struct _MODE_FONT_PAIR MODE_FONT_PAIR
 

typedef struct _FS_CODEPAGE * PFS_CODEPAGE
 

typedef struct _MODE_FONT_PAIR * PMODE_FONT_PAIR
 

typedef struct tagSTRINGBITMAP STRINGBITMAP
 

Referenced by SetRAMFontCodePage().


Function Documentation

NTSTATUS AdjustFont IN PCONSOLE_INFORMATION  Console,
IN UINT  CodePage
 

VOID BisectClipbrd IN SHORT  StringLength,
IN COORD  TargetPoint,
IN PSCREEN_INFORMATION  ScreenInfo,
OUT PSMALL_RECT  SmallRect
 

Referenced by MyInvert(), and StoreSelection().

VOID BisectWrite IN SHORT  StringLength,
IN COORD  TargetPoint,
IN PSCREEN_INFORMATION  ScreenInfo
 

Referenced by FE_StreamWriteToScreenBuffer(), WWSB_DoWriteConsole(), WWSB_FillOutput(), WWSB_FillRectangle(), WWSB_WriteOutputString(), and WWSB_WriteRectToScreenBuffer().

VOID BisectWriteAttr IN SHORT  StringLength,
IN COORD  TargetPoint,
IN PSCREEN_INFORMATION  ScreenInfo
 

Referenced by WWSB_FillOutput(), and WWSB_WriteOutputString().

BOOL CheckBisectStringA IN DWORD  CodePage,
IN PCHAR  Buffer,
IN DWORD  NumBytes,
IN LPCPINFO  lpCPInfo
 

Referenced by WWSB_DoSrvWriteConsole().

BYTE CodePageToCharSet UINT  CodePage  ) 
 

Referenced by FindCreateFont(), and HandleKeyEvent().

NTSTATUS ConvertOutputOemToNonOemUnicode IN OUT LPWSTR  Source,
IN OUT PBYTE  KAttrRows,
IN int  SourceLength,
IN UINT  Codepage
 

NTSTATUS ConvertToCodePage IN PCONSOLE_INFORMATION  Console,
IN UINT  PrevCodePage
 

BOOL CreateDbcsScreenBuffer IN PCONSOLE_INFORMATION  Console,
IN COORD  dwScreenBufferSize,
OUT PDBCS_SCREEN_BUFFER  DbcsScreenBuffer
 

Definition at line 5870 of file output.c.

References BYTE, ConsoleHeapAlloc, ConsoleHeapFree, FALSE, MAKE_TAG, NULL, PBYTE, and TRUE.

Referenced by CreateScreenBuffer(), ReCreateDbcsScreenBufferWorker(), and ResizeScreenBuffer().

05875 { 05876 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 05877 DbcsScreenBuffer->TransBufferCharacter = 05878 (PWCHAR)ConsoleHeapAlloc( 05879 MAKE_TAG( SCREEN_DBCS_TAG ), 05880 (dwScreenBufferSize.X*dwScreenBufferSize.Y*sizeof(WCHAR))+sizeof(WCHAR)); 05881 if (DbcsScreenBuffer->TransBufferCharacter == NULL) { 05882 return FALSE; 05883 } 05884 05885 DbcsScreenBuffer->TransBufferAttribute = 05886 (PBYTE)ConsoleHeapAlloc( 05887 MAKE_TAG( SCREEN_DBCS_TAG ), 05888 (dwScreenBufferSize.X*dwScreenBufferSize.Y*sizeof(BYTE))+sizeof(BYTE)); 05889 if (DbcsScreenBuffer->TransBufferAttribute == NULL) { 05890 ConsoleHeapFree(DbcsScreenBuffer->TransBufferCharacter); 05891 return FALSE; 05892 } 05893 05894 DbcsScreenBuffer->TransWriteConsole = 05895 (PWCHAR)ConsoleHeapAlloc( 05896 MAKE_TAG( SCREEN_DBCS_TAG ), 05897 (dwScreenBufferSize.X*dwScreenBufferSize.Y*sizeof(WCHAR))+sizeof(WCHAR)); 05898 if (DbcsScreenBuffer->TransWriteConsole == NULL) { 05899 ConsoleHeapFree(DbcsScreenBuffer->TransBufferAttribute); 05900 ConsoleHeapFree(DbcsScreenBuffer->TransBufferCharacter); 05901 return FALSE; 05902 } 05903 05904 DbcsScreenBuffer->KAttrRows = 05905 (PBYTE)ConsoleHeapAlloc( 05906 MAKE_TAG( SCREEN_DBCS_TAG ), 05907 dwScreenBufferSize.X*dwScreenBufferSize.Y*sizeof(BYTE)); 05908 if (DbcsScreenBuffer->KAttrRows == NULL) { 05909 ConsoleHeapFree(DbcsScreenBuffer->TransWriteConsole); 05910 ConsoleHeapFree(DbcsScreenBuffer->TransBufferAttribute); 05911 ConsoleHeapFree(DbcsScreenBuffer->TransBufferCharacter); 05912 return FALSE; 05913 } 05914 } 05915 else { 05916 DbcsScreenBuffer->TransBufferCharacter = NULL; 05917 DbcsScreenBuffer->TransBufferAttribute = NULL; 05918 DbcsScreenBuffer->TransWriteConsole = NULL; 05919 DbcsScreenBuffer->KAttrRows = NULL; 05920 } 05921 05922 return TRUE; 05923 }

BOOL DeleteDbcsScreenBuffer IN PDBCS_SCREEN_BUFFER  DbcsScreenBuffer  ) 
 

Definition at line 5926 of file output.c.

References ConsoleHeapFree, and TRUE.

Referenced by FreeScreenBuffer(), ReCreateDbcsScreenBuffer(), and ResizeScreenBuffer().

05929 { 05930 if (DbcsScreenBuffer->KAttrRows) { 05931 ConsoleHeapFree(DbcsScreenBuffer->TransBufferCharacter); 05932 ConsoleHeapFree(DbcsScreenBuffer->TransBufferAttribute); 05933 ConsoleHeapFree(DbcsScreenBuffer->TransWriteConsole); 05934 ConsoleHeapFree(DbcsScreenBuffer->KAttrRows); 05935 } 05936 return TRUE; 05937 }

VOID FE_ConsolePolyTextOut IN PSCREEN_INFORMATION  ScreenInfo,
IN PSMALL_RECT  Region
 

BOOL FE_PolyTextOutCandidate IN PSCREEN_INFORMATION  ScreenInfo,
IN PSMALL_RECT  Region
 

LPWSTR GetAltFaceName LPWSTR  pwszFace  ) 
 

Referenced by FindCreateFont().

UINT GetStringBitmapW HDC  hdc,
LPWSTR  pwc,
UINT  cwc,
UINT  cbData,
BYTE pSB
 

Referenced by SetRAMFont(), and SetRAMFontCodePage().

DWORD ImmConversionFromConsole DWORD  dwNlsMode  ) 
 

Referenced by ConsoleWindowProc().

DWORD ImmConversionToConsole DWORD  fdwConversion  ) 
 

Referenced by HandleKeyEvent().

NTSTATUS InitializeDbcsMisc VOID   ) 
 

Referenced by InitWindowsStuff().

BOOL IsAvailableFarEastCodePage UINT  CodePage  ) 
 

Referenced by ConServerDllInitialization(), DoCreateScreenBuffer(), FindCreateFont(), GetRegistryValues(), PropertiesUpdate(), ReCreateDbcsScreenBuffer(), and SrvSetConsoleCP().

BOOL IsAvailableFsCodePage UINT  CodePage  ) 
 

Referenced by DisplayModeTransition(), SrvSetConsoleHardwareState(), and UnregisterVDM().

BOOL IsAvailableTTFont LPWSTR  pwszFace  ) 
 

Referenced by FindCreateFont(), and FontEnum().

BOOL IsAvailableTTFontCP LPWSTR  pwszFace,
UINT  CodePage
 

Referenced by FontEnum().

BOOL IsDBCSLeadByteConsole IN BYTE  AsciiChar,
IN LPCPINFO  lpCPInfo
 

Referenced by WWSB_FillOutput(), WWSB_WriteOutputString(), and WWSB_WriteRectToScreenBuffer().

NTSTATUS MakeAltRasterFont UINT  CodePage,
COORD  DefaultFontSize,
COORD *  AltFontSize,
BYTE AltFontFamily,
ULONG *  AltFontIndex,
LPWSTR  AltFaceName
 

Referenced by FindCreateFont(), and SetRAMFontCodePage().

BOOL ReCreateDbcsScreenBuffer IN PCONSOLE_INFORMATION  Console,
IN UINT  OldCodePage
 

Definition at line 5985 of file output.c.

References ASSERT, BOOL, CONSOLE_TEXTMODE_BUFFER, ConsoleHeapAlloc, ConsoleHeapFree, _DBCS_SCREEN_BUFFER_TRACKER::data, DeleteDbcsScreenBuffer(), exit, FALSE, IsAvailableFarEastCodePage(), MAKE_TAG, _SCREEN_INFORMATION::Next, NULL, PDBCS_SCREEN_BUFFER_TRACKER, ReCreateDbcsScreenBufferWorker(), TRUE, and UINT.

Referenced by SrvSetConsoleCP().

05988 { 05989 BOOL fResult = FALSE; 05990 PDBCS_SCREEN_BUFFER_TRACKER pDbcsScreenBuffer; 05991 PSCREEN_INFORMATION pScreenInfo; 05992 UINT nScreen; 05993 UINT i; 05994 #if DBG 05995 UINT nScreenSave; 05996 #endif 05997 05998 // 05999 // If DbcsBuffers don't need to be modified, just bail out. 06000 // 06001 if (!IsAvailableFarEastCodePage(OldCodePage) == !CONSOLE_IS_DBCS_OUTPUTCP(pConsole) ) 06002 return TRUE; 06003 06004 // 06005 // Count the number of screens allocated. 06006 // 06007 for (nScreen = 0, pScreenInfo = pConsole->ScreenBuffers; pScreenInfo; pScreenInfo = pScreenInfo->Next) { 06008 // 06009 // Ignore graphic mode buffer. 06010 // 06011 if (pScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 06012 ++nScreen; 06013 } 06014 } 06015 #if DBG 06016 nScreenSave = nScreen; 06017 #endif 06018 06019 // 06020 // Allocate the temporary buffer to store the old values 06021 // 06022 pDbcsScreenBuffer = ConsoleHeapAlloc(MAKE_TAG(TMP_DBCS_TAG), sizeof *pDbcsScreenBuffer * nScreen); 06023 if (pDbcsScreenBuffer == NULL) { 06024 RIPMSG0(RIP_WARNING, "ReCreateDbcsScreenBuffer: not enough memory."); 06025 return FALSE; 06026 } 06027 06028 // 06029 // Try to allocate or de-allocate the necessary DBCS buffers 06030 // 06031 for (nScreen = 0, pScreenInfo = pConsole->ScreenBuffers; pScreenInfo; pScreenInfo = pScreenInfo->Next) { 06032 ASSERT(nScreen < nScreenSave); // make sure ScreenBuffers are not changed 06033 06034 // 06035 // We only handle the text mode screen buffer. 06036 // 06037 if (pScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 06038 // 06039 // Save the previous value just in case something goes bad. 06040 // 06041 #if DBG 06042 pDbcsScreenBuffer[nScreen].pScreenInfo = pScreenInfo; 06043 #endif 06044 pDbcsScreenBuffer[nScreen++].data = pScreenInfo->BufferInfo.TextInfo.DbcsScreenBuffer; 06045 06046 if (!ReCreateDbcsScreenBufferWorker(pConsole, pScreenInfo)) { 06047 // 06048 // If we fail to ReCreate the DbcsScreenBuffer, 06049 // free all allocation to this point, and restore the orginal. 06050 // 06051 RIPMSG0(RIP_WARNING, "ReCreateDbcsScreenBuffer: failed to recreate dbcs screen buffer."); 06052 06053 for (i = 0, pScreenInfo = pConsole->ScreenBuffers; i < nScreen; pScreenInfo = pScreenInfo->Next) { 06054 ASSERT(pScreenInfo); 06055 06056 if (pScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 06057 ASSERT(pDbcsScreenBuffer[i].pScreenInfo == pScreenInfo); 06058 if (i < nScreen - 1) { 06059 ASSERT(pScreenInfo->BufferInfo.TextInfo.DbcsScreenBuffer.KAttrRows != pDbcsScreenBuffer[i].data.KAttrRows); 06060 DeleteDbcsScreenBuffer(&pScreenInfo->BufferInfo.TextInfo.DbcsScreenBuffer); 06061 } 06062 06063 pScreenInfo->BufferInfo.TextInfo.DbcsScreenBuffer = pDbcsScreenBuffer[i++].data; 06064 } 06065 } 06066 goto exit; 06067 } 06068 } 06069 } 06070 06071 // 06072 // All allocation succeeded. Now we can delete the old allocation. 06073 // 06074 for (i = 0; i < nScreen; ++i) { 06075 DeleteDbcsScreenBuffer(&pDbcsScreenBuffer[i].data); 06076 } 06077 06078 fResult = TRUE; 06079 06080 exit: 06081 ConsoleHeapFree(pDbcsScreenBuffer); 06082 06083 return fResult; 06084 }

BOOL RegisterKeisenOfTTFont IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Referenced by CreateWindowsWindow().

DWORD RemoveDbcsMark IN PWCHAR  Dst,
IN PWCHAR  Src,
IN DWORD  NumBytes,
IN PCHAR  SrcA,
IN BOOL  OS2OemFormat
 

DWORD RemoveDbcsMarkAll IN PSCREEN_INFORMATION  ScreenInfo,
IN PROW  Row,
IN PSHORT  LeftChar,
IN PRECT  TextRect,
IN int *  TextLeft,
IN PWCHAR  Buffer,
IN SHORT  NumberOfChars
 

Referenced by WWSB_ConsolePolyTextOut(), and WWSB_WriteRegionToScreen().

DWORD RemoveDbcsMarkCell IN PCHAR_INFO  Dst,
IN PCHAR_INFO  Src,
IN DWORD  NumBytes
 

LPTTFONTLIST SearchTTFont LPWSTR  pwszFace,
BOOL  fCodePage,
UINT  CodePage
 

VOID SetLineChar IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Referenced by CreateScreenBuffer(), and SetScreenBufferFont().

NTSTATUS SetRAMFont IN PSCREEN_INFORMATION  ScreenInfo,
IN PCHAR_INFO  ScreenBufPtr,
IN DWORD  Length
 

Definition at line 3336 of file server/private.c.

References tagSTRINGBITMAP::ajBits, BufferSize, BYTE, BYTE_ALIGN, CalcBitmapBufferSize(), ConsoleHeapAlloc, ConsoleHeapFree, ConsoleHeapSize, DWORD, FontInfo, _MODE_FONT_PAIR::FontSize, _FONT_CACHE_INFORMATION::FullScreenFontIndex, _FONT_CACHE_INFORMATION::FullScreenFontSize, GetExpandFontImage(), GetFontImage(), GetStringBitmapW(), MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, RegModeFontPairs, SetFontImage(), SHORT, Status, and WORD_ALIGN.

Referenced by FE_WriteRegionToScreenHW().

03341 { 03342 ULONG ModeIndex = ScreenInfo->BufferInfo.TextInfo.ModeIndex; 03343 COORD FsFontSize1 = RegModeFontPairs[ModeIndex].FontSize; 03344 COORD FsFontSize2 = FsFontSize1; 03345 COORD GdiFontSize1; 03346 COORD GdiFontSize2; 03347 COORD RetFontSize; 03348 WCHAR wCharBuf[2]; 03349 LPSTRINGBITMAP StringBitmap; 03350 DWORD BufferSize; 03351 PWORD FontImage; 03352 PFONT_CACHE_INFORMATION FontCache; 03353 HFONT hOldFont; 03354 NTSTATUS Status; 03355 03356 FontCache = (PFONT_CACHE_INFORMATION)ScreenInfo->Console->FontCacheInformation; 03357 if (FontCache==NULL) 03358 { 03359 RIPMSG0(RIP_ERROR, "SetRAMFont: ScreenInfo->Console->FontCacheInformation == NULL."); 03360 return STATUS_UNSUCCESSFUL; 03361 } 03362 03363 GdiFontSize1 = FontCache->FullScreenFontSize; 03364 GdiFontSize2 = GdiFontSize1; 03365 GdiFontSize2.X *= 2; 03366 FsFontSize2.X *= 2; 03367 03368 BufferSize = CalcBitmapBufferSize(GdiFontSize2,BYTE_ALIGN); 03369 StringBitmap = ConsoleHeapAlloc( MAKE_TAG(TMP_DBCS_TAG), 03370 sizeof(STRINGBITMAP) + sizeof(StringBitmap->ajBits) * BufferSize); 03371 if (StringBitmap==NULL) 03372 { 03373 RIPMSG0(RIP_WARNING, "SetRAMFont: failed to allocate StringBitmap"); 03374 return STATUS_UNSUCCESSFUL; 03375 } 03376 03377 /* 03378 * Change GDI font to full screen font that best matched. 03379 */ 03380 hOldFont = SelectObject(ScreenInfo->Console->hDC,FontInfo[FontCache->FullScreenFontIndex].hFont); 03381 03382 while (Length--) 03383 { 03384 Status = GetFontImage(ScreenInfo->Console->FontCacheInformation, 03385 ScreenBufPtr->Char.UnicodeChar, 03386 (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1, 03387 0, 03388 NULL); 03389 if (! NT_SUCCESS(Status) ) 03390 { 03391 wCharBuf[0] = ScreenBufPtr->Char.UnicodeChar; 03392 wCharBuf[1] = TEXT('\0'); 03393 GetStringBitmapW(ScreenInfo->Console->hDC, 03394 wCharBuf, 03395 1, 03396 (ULONG)ConsoleHeapSize(StringBitmap), 03397 (BYTE*)StringBitmap 03398 ); 03399 03400 RetFontSize.X = (SHORT)StringBitmap->uiWidth; 03401 RetFontSize.Y = (SHORT)StringBitmap->uiHeight; 03402 03403 Status = SetFontImage(ScreenInfo->Console->FontCacheInformation, 03404 ScreenBufPtr->Char.UnicodeChar, 03405 RetFontSize, 03406 BYTE_ALIGN, 03407 StringBitmap->ajBits 03408 ); 03409 if (! NT_SUCCESS(Status)) { 03410 RIPMSG3(RIP_WARNING, "SetRAMFont: failed to set font image. wc=%04x sz=(%x,%x)", 03411 ScreenBufPtr->Char.UnicodeChar, RetFontSize.X, RetFontSize.Y); 03412 } 03413 03414 if ( ( (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) && 03415 (GdiFontSize2.X != FsFontSize2.X || GdiFontSize2.Y != FsFontSize2.Y)) || 03416 (!(ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) && 03417 (GdiFontSize1.X != FsFontSize1.X || GdiFontSize1.Y != FsFontSize1.Y)) ) 03418 { 03419 BufferSize = CalcBitmapBufferSize(FsFontSize2,WORD_ALIGN); 03420 FontImage = ConsoleHeapAlloc( MAKE_TAG(TMP_DBCS_TAG), 03421 BufferSize 03422 ); 03423 if (FontImage!=NULL) { 03424 03425 GetExpandFontImage(ScreenInfo->Console->FontCacheInformation, 03426 ScreenBufPtr->Char.UnicodeChar, 03427 (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? GdiFontSize2 : GdiFontSize1, 03428 (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1, 03429 FontImage 03430 ); 03431 03432 Status = SetFontImage(ScreenInfo->Console->FontCacheInformation, 03433 ScreenBufPtr->Char.UnicodeChar, 03434 (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1, 03435 WORD_ALIGN, 03436 FontImage 03437 ); 03438 if (! NT_SUCCESS(Status)) { 03439 RIPMSG3(RIP_WARNING, "SetRAMFont: failed to set font image. wc=%04x sz=(%x,%x)", 03440 ScreenBufPtr->Char.UnicodeChar, 03441 ((ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1).X, 03442 ((ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1).Y); 03443 } 03444 03445 ConsoleHeapFree(FontImage); 03446 } else { 03447 RIPMSG0(RIP_WARNING, "SetRAMFont: failed to allocate FontImage."); 03448 } 03449 } 03450 } 03451 03452 if (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) 03453 { 03454 ScreenBufPtr += 2; 03455 if (Length >= 1) 03456 Length -= 1; 03457 else 03458 break; 03459 } 03460 else 03461 { 03462 ScreenBufPtr++; 03463 } 03464 } 03465 03466 ConsoleHeapFree(StringBitmap); 03467 03468 /* 03469 * Back to GDI font 03470 */ 03471 SelectObject(ScreenInfo->Console->hDC,hOldFont); 03472 03473 return Status; 03474 }

NTSTATUS SetRAMFontCodePage IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 3175 of file server/private.c.

References tagSTRINGBITMAP::ajBits, BufferSize, BYTE, BYTE_ALIGN, CalcBitmapBufferSize(), ConsoleHeapAlloc, ConsoleHeapFree, ConsoleHeapSize, CreateFontCache(), DWORD, FontInfo, _MODE_FONT_PAIR::FontSize, _FONT_CACHE_INFORMATION::FullScreenFontIndex, _FONT_CACHE_INFORMATION::FullScreenFontSize, GetExpandFontImage(), GetStringBitmapW(), LPSTRINGBITMAP, MAKE_TAG, MakeAltRasterFont(), NT_SUCCESS, NTSTATUS(), NULL, OEMCP, PFONT_CACHE_INFORMATION, RegModeFontPairs, SCR_FONTCODEPAGE(), _MODE_FONT_PAIR::ScreenSize, SetFontImage(), SHORT, Status, STRINGBITMAP, and WORD_ALIGN.

Referenced by FE_WriteRegionToScreenHW().

03178 { 03179 FSVIDEO_SCREEN_INFORMATION ScreenInformation; 03180 ULONG ModeIndex = ScreenInfo->BufferInfo.TextInfo.ModeIndex; 03181 COORD FontSize; 03182 WCHAR wChar; 03183 WCHAR wCharBuf[2]; 03184 LPSTRINGBITMAP StringBitmap; 03185 DWORD BufferSize; 03186 PWORD FontImage; 03187 PFONT_CACHE_INFORMATION FontCache; 03188 WCHAR AltFaceName[LF_FACESIZE]; 03189 COORD AltFontSize; 03190 BYTE AltFontFamily; 03191 ULONG AltFontIndex = 0; 03192 HFONT hOldFont; 03193 NTSTATUS Status; 03194 03195 ScreenInformation.ScreenSize = RegModeFontPairs[ModeIndex].ScreenSize; 03196 ScreenInformation.FontSize = RegModeFontPairs[ModeIndex].FontSize; 03197 if (ScreenInfo->Console->FontCacheInformation == NULL) 03198 { 03199 Status = CreateFontCache(&FontCache); 03200 if (!NT_SUCCESS(Status)) { 03201 RIPMSG1(RIP_WARNING, "SetRAMFontCodePage: failed in CreateFontCache. Status=%08x", Status); 03202 return STATUS_UNSUCCESSFUL; 03203 } 03204 (PFONT_CACHE_INFORMATION)ScreenInfo->Console->FontCacheInformation = FontCache; 03205 03206 MakeAltRasterFont(SCR_FONTCODEPAGE(ScreenInfo), 03207 RegModeFontPairs[ModeIndex].FontSize, 03208 &AltFontSize, &AltFontFamily, &AltFontIndex, AltFaceName); 03209 FontCache->FullScreenFontIndex = AltFontIndex; 03210 FontCache->FullScreenFontSize = AltFontSize; 03211 03212 BufferSize = CalcBitmapBufferSize(FontCache->FullScreenFontSize,BYTE_ALIGN); 03213 StringBitmap = ConsoleHeapAlloc( MAKE_TAG(TMP_DBCS_TAG), 03214 sizeof(STRINGBITMAP) + sizeof(StringBitmap->ajBits) * BufferSize); 03215 if (StringBitmap==NULL) 03216 { 03217 RIPMSG0(RIP_WARNING, "SetRAMFontCodePage: failed to allocate StringBitmap"); 03218 return STATUS_UNSUCCESSFUL; 03219 } 03220 03221 03222 /* 03223 * Change GDI font to full screen font that best matched. 03224 */ 03225 hOldFont = SelectObject(ScreenInfo->Console->hDC,FontInfo[FontCache->FullScreenFontIndex].hFont); 03226 03227 03228 for (wChar=0x00; wChar < 0x80; wChar++) { 03229 wCharBuf[0] = wChar; 03230 wCharBuf[1] = TEXT('\0'); 03231 GetStringBitmapW(ScreenInfo->Console->hDC, 03232 wCharBuf, 03233 1, 03234 (ULONG)ConsoleHeapSize(StringBitmap), 03235 (BYTE*)StringBitmap 03236 ); 03237 03238 FontSize.X = (SHORT)StringBitmap->uiWidth; 03239 FontSize.Y = (SHORT)StringBitmap->uiHeight; 03240 03241 #if defined(LATER_DBCS_FOR_GRID_CHAR) // by kazum 03242 BufferSize = CalcBitmapBufferSize(FontSize,BYTE_ALIGN); 03243 *(StringBitmap->ajBits + BufferSize) = 0; 03244 *(StringBitmap->ajBits + BufferSize + 1) = 0; 03245 03246 if (gpGridCharacter) { 03247 PGRID_CHARACTER_INFORMATION GridCharacter; 03248 PWCHAR CodePoint; 03249 03250 GridCharacter = gpGridCharacter; 03251 do { 03252 if (GridCharacter->CodePage == OEMCP) { 03253 CodePoint = GridCharacter->CodePoint; 03254 while (*CodePoint) { 03255 if (*CodePoint == wChar) { 03256 if (FontSize.X <= 8) 03257 *(StringBitmap->ajBits + BufferSize) = *(StringBitmap->ajBits + BufferSize - 1); 03258 else { 03259 *(StringBitmap->ajBits + BufferSize) = *(StringBitmap->ajBits + BufferSize - 2); 03260 *(StringBitmap->ajBits + BufferSize + 1) = *(StringBitmap->ajBits + BufferSize - 1); 03261 } 03262 break; 03263 } 03264 else 03265 CodePoint++; 03266 } 03267 break; 03268 } 03269 } while (GridCharacter = GridCharacter->pNext); 03270 } 03271 #endif // LATER_DBCS_FOR_GRID_CHAR // by kazum 03272 03273 Status = SetFontImage(ScreenInfo->Console->FontCacheInformation, 03274 wChar, 03275 FontSize, 03276 BYTE_ALIGN, 03277 StringBitmap->ajBits 03278 ); 03279 if (! NT_SUCCESS(Status)) { 03280 RIPMSG3(RIP_WARNING, "SetRAMFontCodePage: failed to set font image. wc=%04x sz=(%x, %x).", 03281 wChar, FontSize.X, FontSize.Y); 03282 } 03283 03284 if (FontSize.X != ScreenInformation.FontSize.X || 03285 FontSize.Y != ScreenInformation.FontSize.Y) 03286 { 03287 BufferSize = CalcBitmapBufferSize(ScreenInformation.FontSize,WORD_ALIGN); 03288 FontImage = ConsoleHeapAlloc( MAKE_TAG(TMP_DBCS_TAG), 03289 BufferSize 03290 ); 03291 if (FontImage!=NULL) { 03292 03293 GetExpandFontImage(ScreenInfo->Console->FontCacheInformation, 03294 wChar, 03295 FontSize, 03296 ScreenInformation.FontSize, 03297 FontImage 03298 ); 03299 03300 Status = SetFontImage(ScreenInfo->Console->FontCacheInformation, 03301 wChar, 03302 ScreenInformation.FontSize, 03303 WORD_ALIGN, 03304 FontImage 03305 ); 03306 if (! NT_SUCCESS(Status)) { 03307 RIPMSG3(RIP_WARNING, "SetRAMFontCodePage: failed to set font image. wc=%04x, sz=(%x,%x)", 03308 wChar, ScreenInformation.FontSize.X, ScreenInformation.FontSize.Y); 03309 } 03310 03311 ConsoleHeapFree(FontImage); 03312 } else { 03313 RIPMSG0(RIP_WARNING, "SetRAMFontCodePage: failed to allocate FontImage."); 03314 } 03315 } 03316 } 03317 03318 ConsoleHeapFree(StringBitmap); 03319 03320 /* 03321 * Back to GDI font 03322 */ 03323 SelectObject(ScreenInfo->Console->hDC,hOldFont); 03324 } 03325 03326 Status = GdiFullscreenControl(FullscreenControlSetScreenInformation, 03327 &ScreenInformation, 03328 sizeof(ScreenInformation), 03329 NULL, 03330 NULL); 03331 03332 return Status; 03333 }

VOID TextOutCommonLVB IN PCONSOLE_INFORMATION  Console,
IN WORD  Attributes,
IN RECT  CommonLVBRect
 

Referenced by WWSB_ConsolePolyTextOut().

VOID TextOutEverything IN PCONSOLE_INFORMATION  Console,
IN PSCREEN_INFORMATION  ScreenInfo,
IN SHORT  LeftWindowPos,
IN OUT PSHORT  RightWindowPos,
IN OUT PSHORT  CountOfAttr,
IN SHORT  CountOfAttrOriginal,
IN OUT PBOOL  DoubleColorDBCS,
IN BOOL  LocalEUDCFlag,
IN PROW  Row,
IN PATTR_PAIR  Attr,
IN SHORT  LeftTextPos,
IN SHORT  RightTextPos,
IN int  WindowRectLeft,
IN RECT  WindowRect,
IN SHORT  NumberOfChars
 

Referenced by WWSB_WriteRegionToScreen().

ULONG TranslateUnicodeToOem IN PCONSOLE_INFORMATION  Console,
IN PWCHAR  UnicodeBuffer,
IN ULONG  UnicodeCharCount,
OUT PCHAR  AnsiBuffer,
IN ULONG  AnsiByteCount,
OUT PINPUT_RECORD  DbcsLeadInpRec
 

Referenced by CookedRead(), RawReadWaitRoutine(), and ReadChars().


Variable Documentation

BYTE DefaultFontFamily
 

Definition at line 45 of file dbcs.h.

Referenced by EnumerateFonts().

ULONG DefaultFontIndex
 

Definition at line 43 of file dbcs.h.

Referenced by EnumerateFonts(), FindCreateFont(), and FontEnum().

COORD DefaultFontSize
 

Definition at line 44 of file dbcs.h.

Referenced by EnumerateFonts(), and FindCreateFont().

SINGLE_LIST_ENTRY gRegFullScreenCodePage
 

Definition at line 70 of file dbcs.h.

DWORD NUMBER_OF_MODE_FONT_PAIRS
 

Definition at line 68 of file dbcs.h.

PUCHAR RegColorBuffer
 

Definition at line 66 of file dbcs.h.

PUCHAR RegColorBufferNoTranslate
 

Definition at line 67 of file dbcs.h.

PUSHORT RegInitialPalette
 

Definition at line 65 of file dbcs.h.

PMODE_FONT_PAIR RegModeFontPairs
 

Definition at line 69 of file dbcs.h.

Referenced by DisplayModeTransition(), FE_WriteRegionToScreenHW(), InitializeFullScreen(), SetRAMFont(), SetRAMFontCodePage(), SrvGetConsoleHardwareState(), SrvSetConsoleHardwareState(), and UnregisterVDM().


Generated on Sat May 15 19:43:23 2004 for test by doxygen 1.3.7