+void wxConvertVectorFontSize(
+  FIXED                             fxPointSize
+, PFATTRS                           pFattrs
+)
+{
+    HPS                             hPS;
+    HDC                             hDC;
+    LONG                            lXFontResolution;
+    LONG                            lYFontResolution;
+    SIZEF                           vSizef;
+
+    hPS = WinGetScreenPS(HWND_DESKTOP); // Screen presentation space
+
+    //
+    //   Query device context for the screen and then query
+    //   the resolution of the device for the device context.
+    //
+
+    hDC = GpiQueryDevice(hPS);
+    DevQueryCaps( hDC, CAPS_HORIZONTAL_FONT_RES, (LONG)1, &lXFontResolution);
+    DevQueryCaps( hDC, CAPS_VERTICAL_FONT_RES, (LONG)1, &lYFontResolution);
+
+    //
+    //   Calculate the size of the character box, based on the
+    //   point size selected and the resolution of the device.
+    //   The size parameters are of type FIXED, NOT int.
+    //   NOTE: 1 point == 1/72 of an inch.
+    //
+
+    // multiply first to avoid getting vSizef.cx,cy = 0 since fxPointSize
+    // is normally < 72 and FontResolution is typically ca. 100
+    vSizef.cx = (FIXED)( (fxPointSize * lXFontResolution) / 72 );
+    vSizef.cy = (FIXED)( (fxPointSize * lYFontResolution) / 72 );
+
+    if (pFattrs)
+    {
+        pFattrs->lMaxBaselineExt = MAKELONG( HIUSHORT( vSizef.cy ), 0 );
+        pFattrs->lAveCharWidth   = MAKELONG( HIUSHORT( vSizef.cx ), 0 );
+    }
+    WinReleasePS(hPS);
+
+} // end of wxConvertVectorPointSize
+
+void wxFillLogFont( LOGFONT*      pFattrs,  // OS2 GPI FATTRS
+                    PFACENAMEDESC pFaceName,
+                    HPS*          phPS,
+                    bool*         pbInternalPS,
+                    long*         pflId,
+                    wxString&     sFaceName,
+                    wxFont*       pFont )
+{
+    LONG         lNumFonts = 0L;       // For system font count
+    ERRORID      vError;               // For logging API errors
+    LONG         lTemp = 0L;
+    bool         bInternalPS = false;  // if we have to create one
+    PFONTMETRICS pFM = NULL;
+
+    //
+    // Initial house cleaning to free data buffers and ensure we have a
+    // functional PS to work with
+    //
+    if (!*phPS)
+    {
+        *phPS = ::WinGetPS(HWND_DESKTOP);
+        bInternalPS = true;
+    }
+
+    //
+    // Determine the number of fonts.
+    //
+    if((lNumFonts = ::GpiQueryFonts( *phPS
+                                    ,QF_PUBLIC | QF_PRIVATE
+                                    ,NULL
+                                    ,&lTemp
+                                    ,(LONG) sizeof(FONTMETRICS)
+                                    ,NULL
+                                   )) < 0L)
+    {
+        ERRORID                     vError;
+        wxString                    sError;
+
+        vError = ::WinGetLastError(wxGetInstance());
+        sError = wxPMErrorToStr(vError);
+        return;
+    }
+
+    //
+    // Allocate space for the font metrics.
+    //
+    pFM = new FONTMETRICS[lNumFonts + 1];
+
+    //
+    // Retrieve the font metrics.
+    //
+    lTemp = lNumFonts;
+    lTemp = ::GpiQueryFonts( *phPS
+                            ,QF_PUBLIC
+                            ,NULL
+                            ,&lTemp
+                            ,(LONG) sizeof(FONTMETRICS)
+                            ,pFM
+                           );
+    pFont->SetFM( pFM
+                 ,(int)lNumFonts
+                );
+
+    //
+    // Initialize FATTR and FACENAMEDESC
+    //
+    pFattrs->usRecordLength = sizeof(FATTRS);
+    pFattrs->fsFontUse = FATTR_FONTUSE_OUTLINE;       // only outline fonts allowed
+    pFattrs->fsType = 0;
+    pFattrs->lMaxBaselineExt = pFattrs->lAveCharWidth = 0;
+    pFattrs->idRegistry = 0;
+    pFattrs->lMatch = 0;
+
+    pFaceName->usSize = sizeof(FACENAMEDESC);
+    pFaceName->usWeightClass = FWEIGHT_DONT_CARE;
+    pFaceName->usWidthClass = FWIDTH_DONT_CARE;
+    pFaceName->usReserved = 0;
+    pFaceName->flOptions = 0;
+
+    //
+    // This does the actual selection of fonts
+    //
+    wxOS2SelectMatchingFontByName( pFattrs
+                                  ,pFaceName
+                                  ,pFM
+                                  ,(int)lNumFonts
+                                  ,pFont
+                                 );
+    //
+    // We should now have the correct FATTRS set with the selected
+    // font, so now we need to generate an ID
+    //
+    long                            lNumLids = ::GpiQueryNumberSetIds(*phPS);
+
+    if(lNumLids )
+    {
+        long                        alTypes[255];
+        STR8                        azNames[255];
+        long                        alIds[255];
+
+        memset(alIds, 0, sizeof(long) * 255);
+        if(!::GpiQuerySetIds( *phPS
+                             ,lNumLids
+                             ,alTypes
+                             ,azNames
+                             ,alIds
+                            ))
+        {
+            if (bInternalPS)
+                ::WinReleasePS(*phPS);
+            return;
+        }
+        if (*pflId == 0L)
+            *pflId = 1L;
+        for(unsigned long LCNum = 0; LCNum < (unsigned long)lNumLids; LCNum++)
+            if(alIds[LCNum] == *pflId)
+               ++*pflId;
+        if(*pflId > 254)  // wow, no id available!
+        {
+            if (bInternalPS)
+               ::WinReleasePS(*phPS);
+           return;
+        }
+    }
+    else
+        *pflId = 1L;
+    //
+    // Release and delete the current font
+    //
+    ::GpiSetCharSet(*phPS, LCID_DEFAULT);/* release the font before deleting */
+    ::GpiDeleteSetId(*phPS, 1L);         /* delete the logical font          */
+
+    //
+    // Now build a facestring
+    //
+    char                            zFacename[128];
+
+    strcpy(zFacename, pFattrs->szFacename);
+
+    if(::GpiQueryFaceString( *phPS
+                            ,zFacename
+                            ,pFaceName
+                            ,FACESIZE
+                            ,pFattrs->szFacename
+                           ) == GPI_ERROR)
+    {
+        vError = ::WinGetLastError(vHabmain);
+    }
+    sFaceName = (wxChar*)zFacename;
+    *pbInternalPS = bInternalPS;
+
+    //
+    // That's it, we now have everything we need to actually create the font
+    //
+} // end of wxFillLogFont
+
+void wxOS2SelectMatchingFontByName(
+  PFATTRS                           pFattrs