- return wxFont(fontPoints, fontFamily, fontStyle,
- fontWeight, fontUnderline, fontFace,
- fontEncoding);
+ //
+ // Fill in the FATTRS with the best match from FONTMETRICS
+ //
+ pFattrs->usRecordLength = sizeof(FATTRS); // sets size of structure
+ pFattrs->fsSelection = pFM[nIndex].fsSelection; // uses default selection
+ pFattrs->lMatch = pFM[nIndex].lMatch; // force match
+ pFattrs->idRegistry = pFM[nIndex].idRegistry; // uses default registry
+ pFattrs->usCodePage = pFM[nIndex].usCodePage; // code-page
+ 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;
+
+ wxStrcpy(pFattrs->szFacename, pFM[nIndex].szFacename);
+ // Debug
+ strcpy(zFontFaceName, pFM[nIndex].szFacename);
+ strcpy(zFontFaceName, pFattrs->szFacename);
+
+ if(usWeightClass >= FWEIGHT_BOLD)
+ pFattrs->fsSelection |= FATTR_SEL_BOLD;
+ if(pFont->GetUnderlined())
+ pFattrs->fsSelection |= FATTR_SEL_UNDERSCORE;
+ if(fsSelection & FM_SEL_ITALIC)
+ pFattrs->fsSelection |= FATTR_SEL_ITALIC;
+} // end of wxOS2SelectMatchingFontByName
+
+wxFont wxCreateFontFromLogFont(
+ const LOGFONT* pLogFont
+, const PFONTMETRICS pFM
+, PFACENAMEDESC pFaceName
+)
+{
+ wxNativeFontInfo vInfo;
+
+ vInfo.fa = *pLogFont;
+ vInfo.fm = *pFM;
+ vInfo.fn = *pFaceName;
+ return wxFont(vInfo);
+} // end of wxCreateFontFromLogFont
+
+int wxGpiStrcmp(
+ char* s0
+, char* s1
+)
+{ int l0;
+ int l1;
+ int l;
+ int d;
+ int d1;
+ int i;
+ int rc;
+
+ rc = 0;
+ if(s0 == NULL)
+ {
+ if(s1 == NULL)
+ return 0;
+ else
+ return 32;
+ }
+ else if(s1 == NULL)
+ return 32;
+
+ l0 = strlen(s0);
+ l1 = strlen(s1);
+ l = l0;
+ if(l0 != l1)
+ {
+ rc++;
+ if(l1 < l0)
+ l = l1;
+ }
+ for(i=0;i<l;i++)
+ {
+ d = s0[i]-s1[i];
+ if(!d)
+ continue;
+ d1 = toupper(s0[i]) - toupper(s1[i]);
+ if(!d1)
+ continue;
+ rc += abs(d);
+ }
+ return rc;