From 828621c2ea0c43af4082218ba33b5e4137283db9 Mon Sep 17 00:00:00 2001
From: David Webster <Dave.Webster@bhmi.com>
Date: Wed, 23 Jan 2002 05:48:58 +0000
Subject: [PATCH] More bug fix updates.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/os2/font.cpp     | 42 ++++++++++++++++++++++--------------------
 src/os2/fontutil.cpp |  2 ++
 src/os2/wx23.def     | 10 +++++-----
 3 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/src/os2/font.cpp b/src/os2/font.cpp
index c6a9b75646..e4abc8de91 100644
--- a/src/os2/font.cpp
+++ b/src/os2/font.cpp
@@ -362,13 +362,14 @@ bool wxFontRefData::Alloc(
 )
 {
     wxString                        sFaceName;
-    long                            flId;
+    long                            flId = m_hFont;
 
     if (!m_bNativeFontInfoOk)
     {
         wxFillLogFont( &m_vNativeFontInfo.fa
                       ,&m_vNativeFontInfo.fn
                       ,&m_hPS
+                      ,&m_bInternalPS
                       ,&flId
                       ,sFaceName
                       ,pFont
@@ -381,25 +382,9 @@ bool wxFontRefData::Alloc(
                           ,flId
                           ,&m_vNativeFontInfo.fa
                          ) != GPI_ERROR)
-       m_hFont = (WXHFONT)1;
+       m_hFont = (WXHFONT)flId;
+       m_nFontId = flId;
 
-    //
-    // We don't actuall keep the font around if using a temporary PS
-    //
-    if (m_bInternalPS)
-    {
-        if(m_hFont)
-            ::GpiDeleteSetId( m_hPS
-                             ,flId
-                            );
-
-        ::WinReleasePS(m_hPS);
-    }
-    else
-        //
-        // Select the font into the Presentation space
-        //
-        ::GpiSetCharSet(m_hPS, flId); // sets font for presentation space
     if (!m_hFont)
     {
         wxLogLastError("CreateFont");
@@ -413,7 +398,6 @@ bool wxFontRefData::Alloc(
     //
     // Set refData members with the results
     //
-    m_hFont = (WXHFONT)m_nFontId;
     memcpy(&m_vFattrs, &m_vNativeFontInfo.fa, sizeof(m_vFattrs));
     memcpy(&m_vFname, &m_vNativeFontInfo.fn, sizeof(m_vFname));
     m_nPointSize  = m_vNativeFontInfo.fm.lEmHeight;
@@ -462,6 +446,24 @@ bool wxFontRefData::Alloc(
     m_bUnderlined = ((m_vNativeFontInfo.fa.fsSelection & FATTR_SEL_UNDERSCORE) != 0);
     m_sFaceName = m_vNativeFontInfo.fa.szFacename;
     m_vEncoding = wxGetFontEncFromCharSet(m_vNativeFontInfo.fa.usCodePage);
+
+    //
+    // We don't actuall keep the font around if using a temporary PS
+    //
+    if (m_bInternalPS)
+    {
+        if(m_hFont)
+            ::GpiDeleteSetId( m_hPS
+                             ,flId
+                            );
+
+        ::WinReleasePS(m_hPS);
+    }
+    else
+        //
+        // Select the font into the Presentation space
+        //
+        ::GpiSetCharSet(m_hPS, flId); // sets font for presentation space
     return TRUE;
 } // end of wxFontRefData::Alloc
 
diff --git a/src/os2/fontutil.cpp b/src/os2/fontutil.cpp
index 31bbcaac3d..9aea7a80bf 100644
--- a/src/os2/fontutil.cpp
+++ b/src/os2/fontutil.cpp
@@ -262,6 +262,7 @@ void wxFillLogFont(
   LOGFONT*                          pFattrs  // OS2 GPI FATTRS
 , PFACENAMEDESC                     pFaceName
 , HPS*                              phPS
+, bool*                             pbInternalPS
 , long*                             pflId
 , wxString&                         sFaceName
 , wxFont*                           pFont
@@ -419,6 +420,7 @@ void wxFillLogFont(
         vError = ::WinGetLastError(vHabmain);
     }
     sFaceName = zFacename;
+    *pbInternalPS = bInternalPS;
 
     //
     // That's it, we now have everything we need to actually create the font
diff --git a/src/os2/wx23.def b/src/os2/wx23.def
index 871fd0b3b7..efa02ebbf2 100644
--- a/src/os2/wx23.def
+++ b/src/os2/wx23.def
@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
 CODE LOADONCALL
 
 EXPORTS
-;From library:  H:\DEV\WX2\WXWINDOWS\LIB\wx.lib
+;From library:  F:\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:  H:\DEV\WX2\WXWINDOWS\src\common\extended.c
+  ;From object file:  F:\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:  H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
+  ;From object file:  F:\DEV\WX2\WXWINDOWS\src\common\unzip.c
     ;PUBDEFs (Symbols available from object file):
       unzReadCurrentFile
       unzGetCurrentFileInfo
@@ -12317,12 +12317,12 @@ EXPORTS
       wxTestFontEncoding__FRC20wxNativeEncodingInfo
       ;wxCreateFontFromLogFont(const _FATTRS*,_FONTMETRICS* const,_FACENAMEDESC*)
       wxCreateFontFromLogFont__FPC7_FATTRSCP12_FONTMETRICSP13_FACENAMEDESC
+      ;wxFillLogFont(_FATTRS*,_FACENAMEDESC*,unsigned long*,unsigned long*,long*,wxString&,wxFont*)
+      wxFillLogFont__FP7_FATTRSP13_FACENAMEDESCPUlT3PlR8wxStringP6wxFont
       ;wxGetNativeFontEncoding(wxFontEncoding,wxNativeEncodingInfo*)
       wxGetNativeFontEncoding__F14wxFontEncodingP20wxNativeEncodingInfo
       ;wxOS2SelectMatchingFontByName(_FATTRS*,_FACENAMEDESC*,_FONTMETRICS*,int,const wxFont*)
       wxOS2SelectMatchingFontByName__FP7_FATTRSP13_FACENAMEDESCP12_FONTMETRICSiPC6wxFont
-      ;wxFillLogFont(_FATTRS*,_FACENAMEDESC*,unsigned long*,long*,wxString&,wxFont*)
-      wxFillLogFont__FP7_FATTRSP13_FACENAMEDESCPUlPlR8wxStringP6wxFont
       ;wxGpiStrcmp(char*,char*)
       wxGpiStrcmp__FPcT1
       ;wxNativeEncodingInfo::FromString(const wxString&)
-- 
2.50.0

