]> git.saurik.com Git - wxWidgets.git/blob - src/os2/font.cpp
Last correction for makefile.g95: win32 mkdir does not like forward slashes as directory
[wxWidgets.git] / src / os2 / font.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: font.cpp
3 // Purpose: wxFont class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/06/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include <malloc.h>
21 // For compilers that support precompilation, includes "wx.h".
22 #include "wx/wxprec.h"
23
24 #ifndef WX_PRECOMP
25 #include <stdio.h>
26 #include "wx/setup.h"
27 #include "wx/list.h"
28 #include "wx/utils.h"
29 #include "wx/app.h"
30 #include "wx/font.h"
31 #endif // WX_PRECOMP
32
33 #include "wx/os2/private.h"
34
35 IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
36
37 #if wxUSE_PORTABLE_FONTS_IN_MSW
38 IMPLEMENT_DYNAMIC_CLASS(wxFontNameDirectory, wxObject)
39 #endif
40
41 // ----------------------------------------------------------------------------
42 // wxFontRefData - the internal description of the font
43 // ----------------------------------------------------------------------------
44
45 class WXDLLEXPORT wxFontRefData: public wxGDIRefData
46 {
47 friend class WXDLLEXPORT wxFont;
48
49 public:
50 wxFontRefData()
51 {
52 Init(12, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
53 "", wxFONTENCODING_DEFAULT);
54 }
55
56 wxFontRefData(const wxFontRefData& data)
57 {
58 Init(data.m_nPointSize, data.m_nFamily, data.m_nStyle, data.m_nWeight,
59 data.m_bUnderlined, data.m_sFaceName, data.m_vEncoding);
60
61 m_nFontId = data.m_nFontId;
62 }
63
64 wxFontRefData( int nSize
65 ,int nFamily
66 ,int nStyle
67 ,int nWeight
68 ,bool bUnderlined
69 ,const wxString& sFaceName
70 ,wxFontEncoding vEncoding
71 )
72 {
73 Init(nSize, nFamily, nStyle, nWeight, bUnderlined, sFaceName, vEncoding);
74 }
75
76 virtual ~wxFontRefData();
77
78 protected:
79 // common part of all ctors
80 void Init( int nSize
81 ,int nFamily
82 ,int nStyle
83 ,int nWeight
84 ,bool bUnderlined
85 ,const wxString& rsFaceName
86 ,wxFontEncoding vEncoding
87 );
88
89 //
90 // If TRUE, the pointer to the actual font is temporary and SHOULD NOT BE
91 // DELETED by destructor
92 //
93 bool m_bTemporary;
94 int m_nFontId;
95
96 //
97 // Font characterstics
98 //
99 int m_nPointSize;
100 int m_nFamily;
101 int m_nStyle;
102 int m_nWeight;
103 bool m_bUnderlined;
104 wxString m_sFaceName;
105 wxFontEncoding m_vEncoding;
106
107 //
108 // Some PM specific stuff
109 //
110 WXHFONT m_hFont;
111 PFONTMETRICS m_pFM; // array of FONTMETRICS structs
112 int m_nNumFonts; // number of fonts in array
113 HPS m_hPS; // PS handle this font belongs to
114 FATTRS m_vFattrs; // Current fattrs struct
115 FACENAMEDESC m_vFname; // Current facename struct
116 }; // end of CLASS wxFontRefData
117
118 // ============================================================================
119 // implementation
120 // ============================================================================
121
122 // ----------------------------------------------------------------------------
123 // wxFontRefData
124 // ----------------------------------------------------------------------------
125
126 void wxFontRefData::Init(
127 int nPointSize
128 , int nFamily
129 , int nStyle
130 , int nWeight
131 , bool bUnderlined
132 , const wxString& rsFaceName
133 , wxFontEncoding vEncoding
134 )
135 {
136 m_nStyle = nStyle;
137 m_nPointSize = nPointSize;
138 m_nFamily = nFamily;
139 m_nStyle = nStyle;
140 m_nWeight = nWeight;
141 m_bUnderlined = bUnderlined;
142 m_sFaceName = rsFaceName;
143 m_vEncoding = vEncoding;
144 m_nFontId = 0;
145 m_bTemporary = FALSE;
146
147 m_hFont = 0;
148 m_pFM = (PFONTMETRICS)NULL;
149 m_hPS = NULLHANDLE;
150 m_nNumFonts = 0;
151 } // end of wxFontRefData::Init
152
153 wxFontRefData::~wxFontRefData()
154 {
155 if (m_pFM)
156 delete [] m_pFM;
157 m_pFM = (PFONTMETRICS)NULL;
158 }
159
160 // ----------------------------------------------------------------------------
161 // wxFont
162 // ----------------------------------------------------------------------------
163
164 wxFont::wxFont(const wxNativeFontInfo& rInfo)
165 {
166 Init();
167
168 (void)Create( rInfo.pointSize
169 ,rInfo.family
170 ,rInfo.style
171 ,rInfo.weight
172 ,rInfo.underlined
173 ,rInfo.faceName
174 ,rInfo.encoding
175 );
176 }
177
178
179 void wxFont::Init()
180 {
181 if ( wxTheFontList )
182 wxTheFontList->Append(this);
183 }
184
185 // ----------------------------------------------------------------------------
186 // Constructor for a font. Note that the real construction is done
187 // in wxDC::SetFont, when information is available about scaling etc.
188 // ----------------------------------------------------------------------------
189 bool wxFont::Create(
190 int nPointSize
191 , int nFamily
192 , int nStyle
193 , int nWeight
194 , bool bUnderlined
195 , const wxString& rsFaceName
196 , wxFontEncoding vEncoding
197 )
198 {
199 UnRef();
200 m_refData = new wxFontRefData( nPointSize
201 ,nFamily
202 ,nStyle
203 ,nWeight
204 ,bUnderlined
205 ,rsFaceName
206 ,vEncoding
207 );
208 RealizeResource();
209 return TRUE;
210 } // end of wxFont::Create
211
212 wxFont::~wxFont()
213 {
214 if (wxTheFontList)
215 wxTheFontList->DeleteObject(this);
216 } // end of wxFont::~wxFont
217
218 // ----------------------------------------------------------------------------
219 // real implementation
220 // Boris' Kovalenko comments:
221 // Because OS/2 fonts are associated with PS we can not create the font
222 // here, but we may check that font definition is true
223 // ----------------------------------------------------------------------------
224
225 bool wxFont::RealizeResource()
226 {
227 LONG lNumFonts = 0L;
228 LONG lTemp = 0L;
229 PFONTMETRICS pFM = NULL;
230 ERRORID vError;
231
232 if ( GetResourceHandle() )
233 {
234 // VZ: the old code returned FALSE in this case, but it doesn't seem
235 // to make sense because the font _was_ created
236 wxLogDebug(wxT("Calling wxFont::RealizeResource() twice"));
237
238 return TRUE;
239 }
240
241 LONG flId;
242 bool bInternalPS = FALSE; // if we have to create one
243
244 //
245 // Now cheking
246 //
247 flId = 1L;
248 if (!M_FONTDATA->m_hPS)
249 {
250 M_FONTDATA->m_hPS = ::WinGetPS(HWND_DESKTOP);
251 bInternalPS = TRUE;
252 }
253
254 if (M_FONTDATA->m_pFM)
255 {
256 delete [] M_FONTDATA->m_pFM;
257 M_FONTDATA->m_pFM = NULL;
258 }
259 //
260 // Determine the number of fonts.
261 //
262 lNumFonts = ::GpiQueryFonts( M_FONTDATA->m_hPS
263 ,QF_PUBLIC
264 ,NULL
265 ,&lTemp
266 ,(LONG) sizeof(FONTMETRICS)
267 ,NULL
268 );
269
270 //
271 // Allocate space for the font metrics.
272 //
273 pFM = new FONTMETRICS[lNumFonts + 1];
274
275 //
276 // Retrieve the font metrics.
277 //
278 lTemp = lNumFonts;
279 lTemp = ::GpiQueryFonts( M_FONTDATA->m_hPS
280 ,QF_PUBLIC
281 ,NULL
282 ,&lTemp
283 ,(LONG) sizeof(FONTMETRICS)
284 ,pFM
285 );
286 SetFM( pFM
287 ,(int)lNumFonts
288 );
289
290 wxString sVals;
291
292 for (int i = 0; i < lNumFonts; i++)
293 {
294 sVals << "Face: " <<M_FONTDATA->m_pFM[i].szFacename
295 << "Family: " <<M_FONTDATA->m_pFM[i].szFamilyname
296 << " PointSize: " << M_FONTDATA->m_pFM[i].lEmHeight
297 << " Height: " << M_FONTDATA->m_pFM[i].lXHeight
298 ;
299 sVals = "";
300 }
301 M_FONTDATA->m_vFattrs.usRecordLength = sizeof(FATTRS);
302 M_FONTDATA->m_vFattrs.fsFontUse = FATTR_FONTUSE_OUTLINE | // only outline fonts allowed
303 FATTR_FONTUSE_TRANSFORMABLE; // may be transformed
304 M_FONTDATA->m_vFattrs.fsType = 0;
305 M_FONTDATA->m_vFattrs.lMaxBaselineExt = M_FONTDATA->m_vFattrs.lAveCharWidth = 0;
306 M_FONTDATA->m_vFattrs.idRegistry = 0;
307 M_FONTDATA->m_vFattrs.lMatch = 0;
308
309 M_FONTDATA->m_vFname.usSize = sizeof(FACENAMEDESC);
310 M_FONTDATA->m_vFname.usWidthClass = FWIDTH_NORMAL;
311 M_FONTDATA->m_vFname.usReserved = 0;
312 M_FONTDATA->m_vFname.flOptions = 0;
313
314 OS2SelectMatchingFontByName();
315
316 long lNumLids = ::GpiQueryNumberSetIds(M_FONTDATA->m_hPS);
317 long lGpiError;
318
319 //
320 // First we should generate unique id
321 //
322 if(lNumLids )
323 {
324 long alTypes[255];
325 STR8 azNames[255];
326 long alIds[255];
327
328 if(!::GpiQuerySetIds( M_FONTDATA->m_hPS
329 ,lNumLids
330 ,alTypes
331 ,azNames
332 ,alIds
333 ))
334 {
335 if (bInternalPS)
336 ::WinReleasePS(M_FONTDATA->m_hPS);
337 return 0;
338 }
339
340 for(unsigned long LCNum = 0; LCNum < lNumLids; LCNum++)
341 if(alIds[LCNum] == flId)
342 ++flId;
343 if(flId > 254) // wow, no id available!
344 {
345 if (bInternalPS)
346 ::WinReleasePS(M_FONTDATA->m_hPS);
347 return 0;
348 }
349 }
350
351 //
352 // Release and delete the current font
353 //
354 ::GpiSetCharSet(M_FONTDATA->m_hPS, LCID_DEFAULT);/* release the font before deleting */
355 ::GpiDeleteSetId(M_FONTDATA->m_hPS, 1L); /* delete the logical font */
356
357 //
358 // Now build a facestring
359 //
360 char zFacename[128];
361 strcpy(zFacename, M_FONTDATA->m_vFattrs.szFacename);
362
363 if(::GpiQueryFaceString( M_FONTDATA->m_hPS
364 ,zFacename
365 ,&M_FONTDATA->m_vFname
366 ,FACESIZE
367 ,M_FONTDATA->m_vFattrs.szFacename
368 ) == GPI_ERROR)
369 {
370 vError = ::WinGetLastError(vHabmain);
371 }
372
373 M_FONTDATA->m_sFaceName = zFacename;
374
375 if(::GpiCreateLogFont( M_FONTDATA->m_hPS
376 ,NULL
377 ,flId
378 ,&M_FONTDATA->m_vFattrs
379 ) != GPI_ERROR)
380 M_FONTDATA->m_hFont = (WXHFONT)1;
381
382
383 if (bInternalPS)
384 {
385 if(M_FONTDATA->m_hFont)
386 ::GpiDeleteSetId( M_FONTDATA->m_hPS
387 ,flId
388 );
389
390 ::WinReleasePS(M_FONTDATA->m_hPS);
391 }
392 else
393 ::GpiSetCharSet(M_FONTDATA->m_hPS, flId); // sets font for presentation space
394 if (!M_FONTDATA->m_hFont)
395 {
396 wxLogLastError("CreateFont");
397 }
398 M_FONTDATA->m_nFontId = flId;
399 return(M_FONTDATA->m_hFont != 0);
400 } // end of wxFont::RealizeResource
401
402 bool wxFont::FreeResource(
403 bool bForce
404 )
405 {
406 if (GetResourceHandle())
407 {
408 M_FONTDATA->m_hFont = 0;
409 ::GpiDeleteSetId( M_FONTDATA->m_hPS
410 ,M_FONTDATA->m_nFontId
411 );
412 return TRUE;
413 }
414 return FALSE;
415 } // end of wxFont::FreeResource
416
417 WXHANDLE wxFont::GetHFONT() const
418 {
419 if (!M_FONTDATA)
420 return 0;
421 else
422 return (WXHANDLE)M_FONTDATA->m_hFont;
423 } // end of wxFont::GetHFONT
424
425 WXHANDLE wxFont::GetResourceHandle()
426 {
427 return GetHFONT();
428 } // end of wxFont::GetResourceHandle
429
430 bool wxFont::IsFree() const
431 {
432 return (M_FONTDATA && (M_FONTDATA->m_hFont == 0));
433 } // end of wxFont::IsFree
434
435 void wxFont::Unshare()
436 {
437 // Don't change shared data
438 if ( !m_refData )
439 {
440 m_refData = new wxFontRefData();
441 }
442 else
443 {
444 wxFontRefData* ref = new wxFontRefData(*M_FONTDATA);
445 UnRef();
446 m_refData = ref;
447 }
448 } // end of wxFont::Unshare
449
450 // ----------------------------------------------------------------------------
451 // change font attribute: we recreate font when doing it
452 // ----------------------------------------------------------------------------
453
454 void wxFont::SetPointSize(
455 int nPointSize
456 )
457 {
458 Unshare();
459
460 M_FONTDATA->m_nPointSize = nPointSize;
461
462 RealizeResource();
463 } // end of wxFont::SetPointSize
464
465 void wxFont::SetFamily(
466 int nFamily
467 )
468 {
469 Unshare();
470
471 M_FONTDATA->m_nFamily = nFamily;
472
473 RealizeResource();
474 } // end of wxFont::SetFamily
475
476 void wxFont::SetStyle(
477 int nStyle
478 )
479 {
480 Unshare();
481
482 M_FONTDATA->m_nStyle = nStyle;
483
484 RealizeResource();
485 } // end of wxFont::SetStyle
486
487 void wxFont::SetWeight(
488 int nWeight
489 )
490 {
491 Unshare();
492
493 M_FONTDATA->m_nWeight = nWeight;
494
495 RealizeResource();
496 } // end of wxFont::SetWeight
497
498 void wxFont::SetFaceName(
499 const wxString& rsFaceName
500 )
501 {
502 Unshare();
503
504 M_FONTDATA->m_sFaceName = rsFaceName;
505
506 RealizeResource();
507 } // end of wxFont::SetFaceName
508
509 void wxFont::SetUnderlined(
510 bool bUnderlined
511 )
512 {
513 Unshare();
514
515 M_FONTDATA->m_bUnderlined = bUnderlined;
516
517 RealizeResource();
518 } // end of wxFont::SetUnderlined
519
520 void wxFont::SetEncoding(
521 wxFontEncoding vEncoding
522 )
523 {
524 Unshare();
525
526 M_FONTDATA->m_vEncoding = vEncoding;
527
528 RealizeResource();
529 } // end of wxFont::SetEncoding
530
531 void wxFont::SetPS(
532 HPS hPS
533 )
534 {
535 Unshare();
536
537 M_FONTDATA->m_hPS = hPS;
538
539 RealizeResource();
540 } // end of wxFont::SetPS
541
542 void wxFont::SetFM(
543 PFONTMETRICS pFM
544 , int nNumFonts
545 )
546 {
547 //
548 // Don't realize the font with this one
549 //
550 M_FONTDATA->m_pFM = pFM;
551 M_FONTDATA->m_nNumFonts = nNumFonts;
552 } // end of wxFont::SetFM
553
554 // ----------------------------------------------------------------------------
555 // accessors
556 // ----------------------------------------------------------------------------
557
558 int wxFont::GetPointSize() const
559 {
560 wxFontRefData* pTmp;
561
562 pTmp = M_FONTDATA;
563 if(pTmp)
564 return pTmp->m_nPointSize;
565 else
566 return 10;
567 } // end of wxFont::GetPointSize
568
569 int wxFont::GetFamily() const
570 {
571 return M_FONTDATA->m_nFamily;
572 } // end of wxFont::GetFamily
573
574 int wxFont::GetFontId() const
575 {
576 return M_FONTDATA->m_nFontId;
577 } // end of wxFont::GetFontId
578
579 int wxFont::GetStyle() const
580 {
581 return M_FONTDATA->m_nStyle;
582 } // end of wxFont::GetStyle
583
584 int wxFont::GetWeight() const
585 {
586 return M_FONTDATA->m_nWeight;
587 }
588
589 bool wxFont::GetUnderlined() const
590 {
591 return M_FONTDATA->m_bUnderlined;
592 } // end of wxFont::GetUnderlined
593
594 wxString wxFont::GetFaceName() const
595 {
596 wxString sStr;
597
598 if ( M_FONTDATA )
599 sStr = M_FONTDATA->m_sFaceName ;
600 return sStr;
601 } // end of wxFont::GetFaceName
602
603 wxFontEncoding wxFont::GetEncoding() const
604 {
605 return M_FONTDATA->m_vEncoding;
606 } // end of wxFont::GetEncoding
607
608 HPS wxFont::GetPS() const
609 {
610 return M_FONTDATA->m_hPS;
611 } // end of wxFont::GetPS
612
613 void wxFont::OS2SelectMatchingFontByName()
614 {
615 int i;
616 int nDiff0;
617 int nDiff;
618 int nIs;
619 int nIndex;
620 int nMinDiff;
621 int nMinDiff0;
622 int nApirc;
623 int anDiff[16];
624 int anMinDiff[16];
625 STR8 zFn;
626 char zFontFaceName[FACESIZE];
627 wxString sFaceName;
628 USHORT usWeightClass;
629 int fsSelection = 0;
630
631 nMinDiff0 = 0xf000;
632 for(i = 0;i < 16; i++)
633 anMinDiff[i] = nMinDiff0;
634
635 switch (GetFamily())
636 {
637 case wxSCRIPT:
638 sFaceName = wxT("Script");
639 break;
640
641 case wxDECORATIVE:
642 case wxROMAN:
643 sFaceName = wxT("Times New Roman");
644 break;
645
646 case wxTELETYPE:
647 case wxMODERN:
648 sFaceName = wxT("Courier") ;
649 break;
650
651 case wxSWISS:
652 sFaceName = wxT("WarpSans") ;
653 break;
654
655 case wxDEFAULT:
656 default:
657 sFaceName = wxT("Helv") ;
658 }
659
660 switch (GetWeight())
661 {
662 default:
663 wxFAIL_MSG(_T("unknown font weight"));
664 // fall through
665 usWeightClass = FWEIGHT_DONT_CARE;
666 break;
667
668 case wxNORMAL:
669 usWeightClass = FWEIGHT_NORMAL;
670 break;
671
672 case wxLIGHT:
673 usWeightClass = FWEIGHT_LIGHT;
674 break;
675
676 case wxBOLD:
677 usWeightClass = FWEIGHT_BOLD;
678 break;
679
680 case wxFONTWEIGHT_MAX:
681 usWeightClass = FWEIGHT_ULTRA_BOLD;
682 break;
683 }
684 M_FONTDATA->m_vFname.usWeightClass = usWeightClass;
685
686 switch (GetStyle())
687 {
688 case wxITALIC:
689 case wxSLANT:
690 fsSelection = FM_SEL_ITALIC;
691 M_FONTDATA->m_vFname.flOptions = FTYPE_ITALIC;
692 break;
693
694 default:
695 wxFAIL_MSG(wxT("unknown font slant"));
696 // fall through
697
698 case wxNORMAL:
699 fsSelection = 0;
700 break;
701 }
702
703 wxStrncpy(zFontFaceName, sFaceName.c_str(), WXSIZEOF(zFontFaceName));
704 M_FONTDATA->m_nPointSize = GetPointSize();
705 nIndex = 0;
706 for(i = 0, nIs = 0; i < M_FONTDATA->m_nNumFonts; i++)
707 {
708 // Debug code
709 int nPointSize = M_FONTDATA->m_nPointSize;
710 int nEmHeight = 0;
711 int nXHeight = 0;
712 anDiff[0] = wxGpiStrcmp(M_FONTDATA->m_pFM[i].szFamilyname, zFontFaceName);
713 anDiff[1] = abs(M_FONTDATA->m_pFM[i].lEmHeight - M_FONTDATA->m_nPointSize);
714 anDiff[2] = abs(M_FONTDATA->m_pFM[i].usWeightClass - usWeightClass);
715 anDiff[3] = abs((M_FONTDATA->m_pFM[i].fsSelection & 0x2f) - fsSelection);
716 if(anDiff[0] == 0)
717 {
718 nEmHeight = (int)M_FONTDATA->m_pFM[i].lEmHeight;
719 nXHeight =(int)M_FONTDATA->m_pFM[i].lXHeight;
720 if( (nIs & 0x01) == 0)
721 {
722 nIs = 1;
723 nIndex = i;
724 anMinDiff[1] = anDiff[1];
725 anMinDiff[2] = anDiff[2];
726 anMinDiff[3] = anDiff[3];
727 }
728 else if(anDiff[3] < anMinDiff[3])
729 {
730 nIndex = i;
731 anMinDiff[3] = anDiff[3];
732 }
733 else if(anDiff[2] < anMinDiff[2])
734 {
735 nIndex = i;
736 anMinDiff[2] = anDiff[2];
737 }
738 else if(anDiff[1] < anMinDiff[1])
739 {
740 nIndex = i;
741 anMinDiff[1] = anDiff[1];
742 }
743 anMinDiff[0] = 0;
744 }
745 else if(anDiff[0] < anMinDiff[0])
746 {
747 nIs = 2;
748 nIndex = i;
749 anMinDiff[3] = anDiff[3];
750 anMinDiff[2] = anDiff[2];
751 anMinDiff[1] = anDiff[1];
752 anMinDiff[0] = anDiff[0];
753 }
754 else if(anDiff[0] == anMinDiff[0])
755 {
756 if(anDiff[3] < anMinDiff[3])
757 {
758 nIndex = i;
759 anMinDiff[3] = anDiff[3];
760 nIs = 2;
761 }
762 else if(anDiff[2] < anMinDiff[2])
763 {
764 nIndex = i;
765 anMinDiff[2] = anDiff[2];
766 nIs = 2;
767 }
768 else if(anDiff[1] < anMinDiff[1])
769 {
770 nIndex = i;
771 anMinDiff[1] = anDiff[1];
772 nIs = 2;
773 }
774 }
775 }
776
777 M_FONTDATA->m_vFattrs.usRecordLength = sizeof(FATTRS); // sets size of structure
778 M_FONTDATA->m_vFattrs.fsSelection = M_FONTDATA->m_pFM[nIndex].fsSelection; // uses default selection
779 M_FONTDATA->m_vFattrs.lMatch = M_FONTDATA->m_pFM[nIndex].lMatch; // force match
780 M_FONTDATA->m_vFattrs.idRegistry = M_FONTDATA->m_pFM[nIndex].idRegistry; // uses default registry
781 M_FONTDATA->m_vFattrs.usCodePage = M_FONTDATA->m_pFM[nIndex].usCodePage; // code-page
782 if(M_FONTDATA->m_pFM[nIndex].lMatch)
783 {
784 M_FONTDATA->m_vFattrs.lMaxBaselineExt = M_FONTDATA->m_pFM[nIndex].lMaxBaselineExt; // requested font height
785 M_FONTDATA->m_vFattrs.lAveCharWidth = M_FONTDATA->m_pFM[nIndex].lAveCharWidth ; // requested font width
786 }
787 else
788 {
789 M_FONTDATA->m_vFattrs.lMaxBaselineExt = 0;
790 M_FONTDATA->m_vFattrs.lAveCharWidth = 0;
791 }
792 M_FONTDATA->m_vFattrs.fsType = 0;// pfm->fsType; /* uses default type */
793 M_FONTDATA->m_vFattrs.fsFontUse = 0;
794
795 wxStrcpy(M_FONTDATA->m_vFattrs.szFacename, M_FONTDATA->m_pFM[nIndex].szFacename);
796 // Debug
797 strcpy(zFontFaceName, M_FONTDATA->m_pFM[nIndex].szFacename);
798 strcpy(zFontFaceName, M_FONTDATA->m_vFattrs.szFacename);
799
800 if(usWeightClass >= FWEIGHT_BOLD)
801 M_FONTDATA->m_vFattrs.fsSelection |= FATTR_SEL_BOLD;
802 if(GetUnderlined())
803 M_FONTDATA->m_vFattrs.fsSelection |= FATTR_SEL_UNDERSCORE;
804 if(fsSelection & FM_SEL_ITALIC)
805 M_FONTDATA->m_vFattrs.fsSelection |= FATTR_SEL_ITALIC;
806 }
807
808
809