]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixing font utilities
authorDavid Webster <Dave.Webster@bhmi.com>
Thu, 24 Jan 2002 23:24:32 +0000 (23:24 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Thu, 24 Jan 2002 23:24:32 +0000 (23:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/os2/font.cpp
src/os2/fontutil.cpp
src/os2/utils.cpp
src/os2/wx23.def

index e4abc8de91e245c0e2f11010037875d690ab8c3d..8023ca58c8dc2147b2e7bdfbdb110e94c9b559a5 100644 (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;
index 73610c2ac7fc512f96615adc4a8c106aa34080a8..805b4eeb9e716b6ed6efac35cfd1481ec5ff79e0 100644 (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;
 
index 816ed527eb14a369c9e7b8aec3a627a702415352..6cc381d71839eec8ff800e9e6ed571a4a04ae519 100644 (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;
     }
 
index efa02ebbf23e8b5432381c38c4e38cc28afa6b8d..b073de67dd3e25ca070e7b80d0949a07daa30ec7 100644 (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