Skip to content

Commit

Permalink
rename functions to more transparent name
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed May 25, 2024
1 parent 263a008 commit 1400d89
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
5 changes: 3 additions & 2 deletions bld/commonui/c/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -181,7 +182,7 @@ void InitMonoFont( char *app, char *inifile, int default_font, HANDLE inst )
need_stock = true;
GetPrivateProfileString( app, fontKey, "", str, sizeof( str ), inifile );
if( str[0] != 0 ) {
if( GetLogFontFromString( &logFont, str ) ) {
if( GetFontFromString( &logFont, str ) ) {
fixedFont = CreateFontIndirect( &logFont );
if( fixedFont != NULL ) {
need_stock = false;
Expand Down Expand Up @@ -214,7 +215,7 @@ void SaveMonoFont( char *app, char *inifile )
{
char str[MAX_STR];

GetFontFormatString( &logFont, str );
SetFontToString( &logFont, str );
WritePrivateProfileString( app, fontKey, str, inifile );

} /* SaveMonoFont */
Expand Down
13 changes: 7 additions & 6 deletions bld/commonui/c/fontstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -39,9 +40,9 @@ static char *outFmtString = "%d %d %d %d %d %d %d %d %d %d %d %d %d \"%s\"";
static char *inFmtString = "%d %d %d %d %d %d %d %d %d %d %d %d %d %[^\0]";

/*
* GetLogFontFromString - get a logical font from a string
* GetFontFromString - get a logical font from a string
*/
bool GetLogFontFromString( LOGFONT *l, char *data )
bool GetFontFromString( LOGFONT *l, char *data )
{
int num;
size_t i;
Expand Down Expand Up @@ -79,16 +80,16 @@ bool GetLogFontFromString( LOGFONT *l, char *data )
}
return( true );

} /* GetLogFontFromString */
} /* GetFontFromString */

/*
* GetFontFormatString
* SetFontToString
*/
void GetFontFormatString( LOGFONT *lf, char *str )
void SetFontToString( LOGFONT *lf, char *str )
{
wsprintf( str, outFmtString, lf->lfHeight, lf->lfWidth, lf->lfEscapement,
lf->lfOrientation, lf->lfWeight, lf->lfItalic, lf->lfUnderline,
lf->lfStrikeOut, lf->lfCharSet, lf->lfOutPrecision, lf->lfClipPrecision,
lf->lfQuality, lf->lfPitchAndFamily, lf->lfFaceName );

} /* GetFontFormatString */
} /* SetFontToString */
5 changes: 3 additions & 2 deletions bld/commonui/h/fontstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -32,7 +33,7 @@
#ifndef _FONTSTR_H_INCLUDED
#define _FONTSTR_H_INCLUDED

bool GetLogFontFromString( LOGFONT *l, char *data );
void GetFontFormatString( LOGFONT *lf, char *str );
bool GetFontFromString( LOGFONT *l, char *data );
void SetFontToString( LOGFONT *lf, char *str );

#endif /* _FONTSTR_H_INCLUDED */
8 changes: 4 additions & 4 deletions bld/gui/win/c/guifont.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -148,7 +148,7 @@ static char *GetFontInfo( LOGFONT *lf )
{
char buff[MAX_STR];

GetFontFormatString( lf, buff );
SetFontToString( lf, buff );
return( GUIStrDup( buff, NULL ) );
}
#endif
Expand Down Expand Up @@ -181,7 +181,7 @@ char * GUIAPI GUIGetFontFromUser( char *fontinfo )

font = NULLHANDLE;
if( fontinfo != NULL ) {
GetLogFontFromString( &lf, fontinfo );
GetFontFromString( &lf, fontinfo );
font = CreateFontIndirect( &lf );
fontinfo = NULL;
}
Expand All @@ -207,7 +207,7 @@ bool GUIAPI GUISetFontInfo( gui_window *wnd, char *fontinfo )
if( fontinfo == NULL ) {
return( false );
}
GetLogFontFromString( &lf, fontinfo );
GetFontFromString( &lf, fontinfo );
font = CreateFontIndirect( &lf );
if( font == NULL ) {
return( false );
Expand Down
6 changes: 3 additions & 3 deletions bld/setupgui/c/winutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -550,7 +550,7 @@ void SetDialogFont()

if( !GetVariableBoolVal( "IsJapanese" ) ) {
fontstr = GUIGetFontInfo( MainWnd );
GetLogFontFromString( &lf, fontstr );
GetFontFromString( &lf, fontstr );
// following line removed - has no effect on line spacing, it only
// causes the dialog boxes to be too narrow in Win 4.0
// lf.lfHeight = (lf.lfHeight * 8)/12;
Expand All @@ -567,7 +567,7 @@ void SetDialogFont()
lf.lfWeight = FW_BOLD;
#endif
strcpy(lf.lfFaceName, "MS Sans Serif");
GetFontFormatString( &lf, dlgfont );
SetFontToString( &lf, dlgfont );
GUISetFontInfo( MainWnd, dlgfont );
GUIMemFree( fontstr );
}
Expand Down

0 comments on commit 1400d89

Please sign in to comment.