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

View File

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

View File

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

View File

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