From e01bcbd238149aa2eb016317eb6fb747375f9db9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 17 May 2012 21:08:28 +0000 Subject: [PATCH] 2012-05-17 23:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/include/hbgtinfo.ch + added new HB_GTI_FONTATTRIBUTE value: HB_GTI_FONTA_CTRLCHARS When used it forces using CTRL characters (from chr(0) to chr(31)) directly without translation to CP437 unicode values. In windows some fonts need it to correctly display them. * harbour/src/rtl/gtwvt/gtwvt.h * harbour/src/rtl/gtwvt/gtwvt.c + added support for hb_gtInfo( HB_GTI_FONTATTRIBUTE, HB_GTI_FONTA_CTRLCHARS ) * harbour/src/rtl/hbgtcore.c ! do not replace CTRL chars with '?' in HB_GTSELF_GETUC() method --- harbour/ChangeLog | 15 +++++++++++++++ harbour/include/hbgtinfo.ch | 1 + harbour/src/rtl/gtwvt/gtwvt.c | 10 +++++++++- harbour/src/rtl/gtwvt/gtwvt.h | 2 ++ harbour/src/rtl/hbgtcore.c | 2 +- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c985da38f9..768302443d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,21 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-17 23:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/include/hbgtinfo.ch + + added new HB_GTI_FONTATTRIBUTE value: HB_GTI_FONTA_CTRLCHARS + When used it forces using CTRL characters (from chr(0) to chr(31)) + directly without translation to CP437 unicode values. + In windows some fonts need it to correctly display them. + + * harbour/src/rtl/gtwvt/gtwvt.h + * harbour/src/rtl/gtwvt/gtwvt.c + + added support for + hb_gtInfo( HB_GTI_FONTATTRIBUTE, HB_GTI_FONTA_CTRLCHARS ) + + * harbour/src/rtl/hbgtcore.c + ! do not replace CTRL chars with '?' in HB_GTSELF_GETUC() method + 2012-05-17 22:54 UTC+0200 Viktor Szakats (harbour syenar.net) * include/harbour.hbx ! minor diff --git a/harbour/include/hbgtinfo.ch b/harbour/include/hbgtinfo.ch index 00146c8c34..c2adaef9de 100644 --- a/harbour/include/hbgtinfo.ch +++ b/harbour/include/hbgtinfo.ch @@ -165,6 +165,7 @@ #define HB_GTI_FONTA_FIXMETRIC 1 #define HB_GTI_FONTA_CLRBKG 2 #define HB_GTI_FONTA_DRAWBOX 4 +#define HB_GTI_FONTA_CTRLCHARS 8 /* Keyboard shifts states */ #define HB_GTI_KBD_SHIFT 0x000001 diff --git a/harbour/src/rtl/gtwvt/gtwvt.c b/harbour/src/rtl/gtwvt/gtwvt.c index 5840f439c7..19f2d116bb 100644 --- a/harbour/src/rtl/gtwvt/gtwvt.c +++ b/harbour/src/rtl/gtwvt/gtwvt.c @@ -323,6 +323,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) pWVT->fontHeight = WVT_DEFAULT_FONT_HEIGHT; pWVT->fontWeight = FW_NORMAL; pWVT->fontQuality = DEFAULT_QUALITY; + pWVT->fontAttribute = WVT_DEFAULT_FONT_ATTR; HB_STRNCPY( pWVT->fontFace, WVT_DEFAULT_FONT_NAME, HB_SIZEOFARRAY( pWVT->fontFace ) - 1 ); pWVT->CaretExist = HB_FALSE; @@ -1712,7 +1713,8 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT ) HB_USHORT usChar; if( !HB_GTSELF_GETSCRCHAR( pWVT->pGT, iRow, iCol, &iColor, &bAttr, &usChar ) ) break; - usChar = hb_cdpGetU16Ctrl( usChar ); + if( ( pWVT->fontAttribute & HB_GTI_FONTA_CTRLCHARS ) == 0 ) + usChar = hb_cdpGetU16Ctrl( usChar ); /* as long as GTWVT uses only 16 colors we can ignore other bits * and not divide output when it does not change anythings @@ -2498,6 +2500,12 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } break; + case HB_GTI_FONTATTRIBUTE: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontAttribute ); + if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) + pWVT->fontAttribute = hb_itemGetNI( pInfo->pNewVal ) & HB_GTI_FONTA_CTRLCHARS; + break; + case HB_GTI_SCREENHEIGHT: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.y * pWVT->ROWS ); iVal = hb_itemGetNI( pInfo->pNewVal ); diff --git a/harbour/src/rtl/gtwvt/gtwvt.h b/harbour/src/rtl/gtwvt/gtwvt.h index 8a82b20a87..3998b9d5d4 100644 --- a/harbour/src/rtl/gtwvt/gtwvt.h +++ b/harbour/src/rtl/gtwvt/gtwvt.h @@ -87,6 +87,7 @@ # define WVT_DEFAULT_FONT_HEIGHT 20 # define WVT_DEFAULT_FONT_WIDTH 10 #endif +#define WVT_DEFAULT_FONT_ATTR 0 #define WVT_DEFAULT_FONT_NAME TEXT( "Courier New" ) #define BLACK RGB( 0x00, 0x00, 0x00 ) @@ -143,6 +144,7 @@ typedef struct int fontWidth; /* requested font width */ int fontWeight; /* Bold level */ int fontQuality; /* requested font quality */ + int fontAttribute; /* font attribute: HB_GTI_FONTA_* */ TCHAR fontFace[ LF_FACESIZE ]; /* requested font face name LF_FACESIZE #defined in wingdi.h */ HFONT hFont; /* current font handle */ #if ! defined( UNICODE ) diff --git a/harbour/src/rtl/hbgtcore.c b/harbour/src/rtl/hbgtcore.c index eac23814dd..00b1bb0bba 100644 --- a/harbour/src/rtl/hbgtcore.c +++ b/harbour/src/rtl/hbgtcore.c @@ -799,7 +799,7 @@ static HB_BOOL hb_gt_def_GetUC( PHB_GT pGT, int iRow, int iCol, if( pGT->cdpHost && pGT->cdpTerm != pGT->cdpHost ) uc = hb_cdpGetUC( pGT->cdpHost, wc, 0 ); if( uc == 0 ) - uc = hb_cdpGetUC( hb_vmCDP(), wc, '?' ); + uc = hb_cdpGetUC( hb_vmCDP(), wc, wc < 32 ? ( HB_UCHAR ) wc : '?' ); } } }