mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
Fix bug making glyphs from random garbage; when narrowing in on
correct font size, compute based on ratio from what we have rather than just reducing by one each pass.
This commit is contained in:
parent
be3863dd5a
commit
e6399c74c1
1 changed files with 15 additions and 4 deletions
|
@ -474,6 +474,7 @@ ceFillFontInfo( const CEDrawCtx* dctx, LOGFONT* fontInfo,
|
||||||
{
|
{
|
||||||
XP_MEMSET( fontInfo, 0, sizeof(*fontInfo) );
|
XP_MEMSET( fontInfo, 0, sizeof(*fontInfo) );
|
||||||
fontInfo->lfHeight = height;
|
fontInfo->lfHeight = height;
|
||||||
|
fontInfo->lfQuality = PROOF_QUALITY;
|
||||||
|
|
||||||
/* if ( bold ) { */
|
/* if ( bold ) { */
|
||||||
/* fontInfo->lfWeight = FW_BOLD; */
|
/* fontInfo->lfWeight = FW_BOLD; */
|
||||||
|
@ -504,14 +505,15 @@ ceBestFitFont( CEDrawCtx* dctx, XP_U16 soughtHeight, RFIndex index,
|
||||||
|
|
||||||
char sample[65];
|
char sample[65];
|
||||||
makeTestBuf( dctx, sample, VSIZE(sample), index );
|
makeTestBuf( dctx, sample, VSIZE(sample), index );
|
||||||
len = strlen(sample);
|
len = 1 + strlen(sample);
|
||||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, sample, len,
|
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, sample, len,
|
||||||
widebuf, len );
|
widebuf, len );
|
||||||
|
|
||||||
memBM = CreateCompatibleBitmap( memDC, soughtHeight*2, soughtHeight*2 );
|
memBM = CreateCompatibleBitmap( memDC, soughtHeight*2, soughtHeight*2 );
|
||||||
SelectObject( memDC, memBM );
|
SelectObject( memDC, memBM );
|
||||||
|
|
||||||
for ( firstPass = XP_TRUE, testSize = soughtHeight*2; ; --testSize ) {
|
for ( firstPass = XP_TRUE, testSize = soughtHeight*2; ; ) {
|
||||||
|
XP_U16 prevSize;
|
||||||
LOGFONT fontInfo;
|
LOGFONT fontInfo;
|
||||||
HFONT testFont;
|
HFONT testFont;
|
||||||
|
|
||||||
|
@ -554,6 +556,13 @@ ceBestFitFont( CEDrawCtx* dctx, XP_U16 soughtHeight, RFIndex index,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DeleteObject( testFont );
|
DeleteObject( testFont );
|
||||||
|
|
||||||
|
prevSize = testSize;
|
||||||
|
testSize = (testSize * soughtHeight) / thisHeight;
|
||||||
|
if ( testSize >= prevSize ) {
|
||||||
|
/* guarantee progress regardless of rounding errors */
|
||||||
|
testSize = prevSize - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,8 +704,10 @@ DRAW_FUNC_NAME(boardBegin)( DrawCtx* p_dctx,
|
||||||
} /* draw_boardBegin */
|
} /* draw_boardBegin */
|
||||||
|
|
||||||
DLSTATIC void
|
DLSTATIC void
|
||||||
DRAW_FUNC_NAME(objFinished)( DrawCtx* p_dctx, BoardObjectType typ,
|
DRAW_FUNC_NAME(objFinished)( DrawCtx* XP_UNUSED(p_dctx),
|
||||||
const XP_Rect* rect, DrawFocusState dfs )
|
BoardObjectType XP_UNUSED(typ),
|
||||||
|
const XP_Rect* XP_UNUSED(rect),
|
||||||
|
DrawFocusState XP_UNUSED(dfs) )
|
||||||
{
|
{
|
||||||
#ifdef DRAW_FOCUS_FRAME
|
#ifdef DRAW_FOCUS_FRAME
|
||||||
if ( (dfs == DFS_TOP) && (typ == OBJ_BOARD || typ == OBJ_TRAY) ) {
|
if ( (dfs == DFS_TOP) && (typ == OBJ_BOARD || typ == OBJ_TRAY) ) {
|
||||||
|
|
Loading…
Reference in a new issue