Fixing font utilities

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 2002-01-24 23:24:32 +00:00
parent 59d77e8381
commit e1146627e2
4 changed files with 42 additions and 27 deletions

View File

@ -363,6 +363,9 @@ bool wxFontRefData::Alloc(
{
wxString sFaceName;
long flId = m_hFont;
long lRc;
short nIndex = 0;
PFONTMETRICS pFM = NULL;
if (!m_bNativeFontInfoOk)
{
@ -377,22 +380,21 @@ bool wxFontRefData::Alloc(
m_bNativeFontInfoOk = TRUE;
}
if(::GpiCreateLogFont( m_hPS
,NULL
,flId
,&m_vNativeFontInfo.fa
) != GPI_ERROR)
if((lRc = ::GpiCreateLogFont( m_hPS
,NULL
,flId
,&m_vNativeFontInfo.fa
)) != GPI_ERROR)
{
m_hFont = (WXHFONT)flId;
m_nFontId = flId;
}
if (!m_hFont)
{
wxLogLastError("CreateFont");
}
//
// Query for the actual metrics of the current font being used
//
::GpiSetCharSet(m_hPS, flId); // sets font for presentation space
::GpiQueryFontMetrics(m_hPS, sizeof(FONTMETRICS), &m_vNativeFontInfo.fm);
//
@ -403,13 +405,21 @@ bool wxFontRefData::Alloc(
m_nPointSize = m_vNativeFontInfo.fm.lEmHeight;
if (strcmp(m_vNativeFontInfo.fa.szFacename, "Times New Roman") == 0)
m_nFamily = wxROMAN;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Tms Rmn") == 0)
m_nFamily = wxSWISS;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "WarpSans") == 0)
m_nFamily = wxSWISS;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Helvitica") == 0)
m_nFamily = wxSWISS;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Helv") == 0)
m_nFamily = wxSWISS;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Script") == 0)
m_nFamily = wxSCRIPT;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier New") == 0)
m_nFamily = wxMODERN;
m_nFamily = wxTELETYPE;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier") == 0)
m_nFamily = wxTELETYPE;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "System VIO") == 0)
m_nFamily = wxMODERN;
else
m_nFamily = wxSWISS;

View File

@ -325,6 +325,9 @@ void wxFillLogFont(
wxString sVals;
//
// For debugging, delete later
//
for (int i = 0; i < lNumFonts; i++)
{
sVals << "Face: " << pFM[i].szFacename
@ -440,12 +443,12 @@ void wxOS2SelectMatchingFontByName(
int nPointSize;
int nDiff;
int nIs;
int nIndex;
int nMinDiff;
int nMinDiff0;
int nApirc;
int anDiff[16];
int anMinDiff[16];
int nIndex = 0;
STR8 zFn;
char zFontFaceName[FACESIZE];
wxString sFaceName;
@ -612,16 +615,8 @@ void wxOS2SelectMatchingFontByName(
pFattrs->lMatch = pFM[nIndex].lMatch; // force match
pFattrs->idRegistry = pFM[nIndex].idRegistry; // uses default registry
pFattrs->usCodePage = pFM[nIndex].usCodePage; // code-page
if(pFM[nIndex].lMatch)
{
pFattrs->lMaxBaselineExt = pFM[nIndex].lMaxBaselineExt; // requested font height
pFattrs->lAveCharWidth = pFM[nIndex].lAveCharWidth ; // requested font width
}
else
{
pFattrs->lMaxBaselineExt = 0;
pFattrs->lAveCharWidth = 0;
}
pFattrs->lMaxBaselineExt = 0; // OUTLINE fonts need this set to 0 as they use other attributes to match
pFattrs->lAveCharWidth = 0; // OUTLINE fonts need this set to 0 as they use other attributes to match
pFattrs->fsType = 0;// pfm->fsType; /* uses default type */
pFattrs->fsFontUse = 0;

View File

@ -1218,6 +1218,7 @@ void wxOS2SetFont(
char zStyle[30];
if (hWnd == NULLHANDLE)
return;
//
// The fonts available for Presentation Params are just three
@ -1227,20 +1228,29 @@ void wxOS2SetFont(
switch(rFont.GetFamily())
{
case wxSCRIPT:
strcpy(zFacename, "Script");
break;
case wxDECORATIVE:
case wxROMAN:
strcpy(zFacename,"Times New Roman");
strcpy(zFacename,"Tms Rmn");
break;
case wxTELETYPE:
case wxMODERN:
strcpy(zFacename, "Courier");
break;
case wxMODERN:
strcpy(zFacename, "System Vio");
break;
case wxSWISS:
strcpy(zFacename, "Helv");
break;
case wxDEFAULT:
default:
strcpy(zFacename, "Helvetica");
strcpy(zFacename, "System Vio");
break;
}

View File

@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
CODE LOADONCALL
EXPORTS
;From library: F:\DEV\WX2\WXWINDOWS\LIB\wx.lib
;From library: H:\DEV\WX2\WXWINDOWS\LIB\wx.lib
;From object file: dummy.cpp
;PUBDEFs (Symbols available from object file):
wxDummyChar
@ -1772,7 +1772,7 @@ EXPORTS
wxEVT_NC_LEFT_DCLICK
wxEVT_INIT_DIALOG
wxEVT_COMMAND_SET_FOCUS
;From object file: F:\DEV\WX2\WXWINDOWS\src\common\extended.c
;From object file: H:\DEV\WX2\WXWINDOWS\src\common\extended.c
;PUBDEFs (Symbols available from object file):
ConvertToIeeeExtended
ConvertFromIeeeExtended
@ -5771,7 +5771,7 @@ EXPORTS
Read32__17wxTextInputStreamFv
;wxTextInputStream::SkipIfEndOfLine(char)
SkipIfEndOfLine__17wxTextInputStreamFc
;From object file: F:\DEV\WX2\WXWINDOWS\src\common\unzip.c
;From object file: H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
;PUBDEFs (Symbols available from object file):
unzReadCurrentFile
unzGetCurrentFileInfo