new DC attribute: DC_ATTR_WORD_EXTRA

This commit is contained in:
Vincent Wei
2019-02-22 18:46:23 +08:00
parent 1e73f6713a
commit 39b8c88d1b
4 changed files with 17 additions and 12 deletions

View File

@@ -159,6 +159,7 @@ struct tagDC
int tabstop;
int cExtra; /* Character extra */
int wExtra; /* Word extra */
int alExtra; /* Above line extra */
int blExtra; /* Bellow line extra */

View File

@@ -422,9 +422,8 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount,
if (RECTWP(pRect) == 0 || RECTHP(pRect) == 0) return -1;
pdc = dc_HDC2PDC(hdc);
/* for support utf-16 by humingming 2010.7.6 */
//if (is_utf16_logfont (pdc)) return -1;
if (pdc->pLogFont->rotation) return -1;
if (pdc->pLogFont->rotation)
return -1;
if (nCount < 0) nCount = __mg_strlen (pdc->pLogFont, pText);
if (nCount <= 0) return -1;
@@ -478,9 +477,11 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount,
}
/* set the start_x pos.*/
if (nFormat & DT_RIGHT){
if (nFormat & DT_RIGHT) {
x = rcDraw.right;
old_ta = SetTextAlign(hdc, TA_RIGHT);
_ERR_PRINTF("%s: SetTextAlign(TA_RIGHT) called, pdc->ta_flags(%x)\n",
__FUNCTION__, pdc->ta_flags);
}
else {
old_ta = SetTextAlign(hdc, TA_LEFT);

View File

@@ -1733,7 +1733,7 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient)
pdc->pLogFont = GetSystemFont (SYSLOGFONT_WCHAR_DEF);
pdc->tabstop = 8;
pdc->CurTextPos.x = pdc->CurTextPos.y = 0;
pdc->cExtra = pdc->alExtra = pdc->blExtra = 0;
pdc->cExtra = pdc->wExtra = pdc->alExtra = pdc->blExtra = 0;
pdc->mapmode = MM_TEXT;
pdc->ta_flags = TA_LEFT | TA_TOP | TA_NOUPDATECP;
@@ -1834,12 +1834,12 @@ static void dc_InitMemDCFrom (PDC pdc, const PDC pdc_ref)
/* copy attributes from reference DC
* gal_pixel bkcolor, pencolor, brushcolor, textcolor;
* int bkmode, tabstop, cExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags;
* int bkmode, tabstop, cExtra, wExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags;
*/
memcpy (&pdc->bkcolor, &pdc_ref->bkcolor,
sizeof (gal_pixel)*4 + sizeof (int)*8);
memcpy (&pdc->bkcolor, &pdc_ref->bkcolor,
sizeof (gal_pixel)*4 + sizeof (int)*9);
#ifdef _MGHAVE_ADV_2DAPI
memcpy (&pdc->pen_type, &pdc_ref->pen_type,
memcpy (&pdc->pen_type, &pdc_ref->pen_type,
(sizeof(int)*7) + sizeof(POINT) + (sizeof (void*)*3));
#endif
pdc->pLogFont = pdc_ref->pLogFont;
@@ -1900,7 +1900,7 @@ static void dc_InitScreenDC (PDC pdc, GAL_Surface *surface)
pdc->pLogFont = GetSystemFont (SYSLOGFONT_WCHAR_DEF);
pdc->tabstop = 8;
pdc->CurTextPos.x = pdc->CurTextPos.y = 0;
pdc->cExtra = pdc->alExtra = pdc->blExtra = 0;
pdc->cExtra = pdc->wExtra = pdc->alExtra = pdc->blExtra = 0;
pdc->mapmode = MM_TEXT;
pdc->ta_flags = TA_LEFT | TA_TOP | TA_NOUPDATECP;
@@ -3438,8 +3438,8 @@ HWND GUIAPI WindowFromDC (HDC hdc)
typedef struct _DCSTATE
{
GAL_Color bkcolor, pencolor, brushcolor, textcolor;
/* bkmode, tabstop, cExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags */
char attrs_g1 [sizeof(int)*8];
/* bkmode, tabstop, cExtra, wExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags */
char attrs_g1 [sizeof(int)*9];
#ifdef _MGHAVE_ADV_2DAPI
/*

View File

@@ -2351,6 +2351,9 @@ int _font_get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
if (bbox) bbox->x -= (bold + ch_extra + adv_len);
}
_ERR_PRINTF("_font_get_glyph_advance: direction(%s)\n",
direction?"LTR":"RTL");
if (direction) {
tmp_x += bold + ch_extra;
if (adv_x) *adv_x = tmp_x - x;