1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/font.cpp
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
34 #include "wx/msw/private.h"
37 #include "wx/encinfo.h"
38 #include "wx/fontutil.h"
39 #include "wx/fontmap.h"
42 #include "wx/sysopt.h"
45 #include "wx/scopeguard.h"
46 #include "wx/tokenzr.h"
48 // ----------------------------------------------------------------------------
50 // ----------------------------------------------------------------------------
52 // the mask used to extract the pitch from LOGFONT::lfPitchAndFamily field
53 static const int PITCH_MASK
= FIXED_PITCH
| VARIABLE_PITCH
;
55 // ----------------------------------------------------------------------------
56 // wxFontRefData - the internal description of the font
57 // ----------------------------------------------------------------------------
59 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
65 Init(-1, wxSize(0,0), false, wxFONTFAMILY_DEFAULT
, wxFONTSTYLE_NORMAL
,
66 wxFONTWEIGHT_NORMAL
, false, wxEmptyString
,
67 wxFONTENCODING_DEFAULT
);
70 wxFontRefData(int size
,
71 const wxSize
& pixelSize
,
77 const wxString
& faceName
,
78 wxFontEncoding encoding
)
80 Init(size
, pixelSize
, sizeUsingPixels
, family
, style
, weight
,
81 underlined
, faceName
, encoding
);
84 wxFontRefData(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0)
89 wxFontRefData(const wxFontRefData
& data
) : wxGDIRefData()
91 Init(data
.m_nativeFontInfo
);
94 virtual ~wxFontRefData();
101 // all wxFont accessors
102 int GetPointSize() const
104 return m_nativeFontInfo
.GetPointSize();
107 wxSize
GetPixelSize() const
109 return m_nativeFontInfo
.GetPixelSize();
112 bool IsUsingSizeInPixels() const
114 return m_sizeUsingPixels
;
117 wxFontFamily
GetFamily() const
119 return m_nativeFontInfo
.GetFamily();
122 wxFontStyle
GetStyle() const
124 return m_nativeFontInfo
.GetStyle();
127 wxFontWeight
GetWeight() const
129 return m_nativeFontInfo
.GetWeight();
132 bool GetUnderlined() const
134 return m_nativeFontInfo
.GetUnderlined();
137 wxString
GetFaceName() const
139 wxString facename
= m_nativeFontInfo
.GetFaceName();
140 if ( facename
.empty() )
142 facename
= GetMSWFaceName();
143 if ( !facename
.empty() )
145 // cache the face name, it shouldn't change unless the family
146 // does and wxNativeFontInfo::SetFamily() resets the face name
147 const_cast<wxFontRefData
*>(this)->SetFaceName(facename
);
154 wxFontEncoding
GetEncoding() const
156 return m_nativeFontInfo
.GetEncoding();
159 WXHFONT
GetHFONT() const
163 return (WXHFONT
)m_hFont
;
166 bool HasHFONT() const
171 // ... and setters: notice that all of them invalidate the currently
172 // allocated HFONT, if any, so that the next call to GetHFONT() recreates a
174 void SetPointSize(int pointSize
)
178 m_nativeFontInfo
.SetPointSize(pointSize
);
179 m_sizeUsingPixels
= false;
182 void SetPixelSize(const wxSize
& pixelSize
)
184 wxCHECK_RET( pixelSize
.GetWidth() >= 0, "negative font width" );
185 wxCHECK_RET( pixelSize
.GetHeight() != 0, "zero font height" );
189 m_nativeFontInfo
.SetPixelSize(pixelSize
);
190 m_sizeUsingPixels
= true;
193 void SetFamily(wxFontFamily family
)
197 m_nativeFontInfo
.SetFamily(family
);
200 void SetStyle(wxFontStyle style
)
204 m_nativeFontInfo
.SetStyle(style
);
207 void SetWeight(wxFontWeight weight
)
211 m_nativeFontInfo
.SetWeight(weight
);
214 bool SetFaceName(const wxString
& faceName
)
218 return m_nativeFontInfo
.SetFaceName(faceName
);
221 void SetUnderlined(bool underlined
)
225 m_nativeFontInfo
.SetUnderlined(underlined
);
228 void SetEncoding(wxFontEncoding encoding
)
232 m_nativeFontInfo
.SetEncoding(encoding
);
235 const wxNativeFontInfo
& GetNativeFontInfo() const
237 // we need to create the font now to get the corresponding LOGFONT if
238 // it hadn't been done yet
241 // ensure that we have a valid face name in our font information:
242 // GetFaceName() will try to retrieve it from our HFONT and save it if
246 return m_nativeFontInfo
;
249 void SetNativeFontInfo(const wxNativeFontInfo
& nativeFontInfo
)
253 m_nativeFontInfo
= nativeFontInfo
;
257 // common part of all ctors
259 const wxSize
& pixelSize
,
260 bool sizeUsingPixels
,
265 const wxString
& faceName
,
266 wxFontEncoding encoding
);
268 void Init(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0);
270 void AllocIfNeeded() const
273 const_cast<wxFontRefData
*>(this)->Alloc();
276 // retrieve the face name really being used by the font: this is used to
277 // get the face name selected by the system when we don't specify it (but
278 // use just the family for example)
279 wxString
GetMSWFaceName() const
282 SelectInHDC
selectFont(hdc
, m_hFont
);
284 UINT otmSize
= GetOutlineTextMetrics(hdc
, 0, NULL
);
287 wxLogLastError("GetOutlineTextMetrics(NULL)");
291 OUTLINETEXTMETRIC
* const
292 otm
= static_cast<OUTLINETEXTMETRIC
*>(malloc(otmSize
));
293 wxON_BLOCK_EXIT1( free
, otm
);
295 otm
->otmSize
= otmSize
;
296 if ( !GetOutlineTextMetrics(hdc
, otmSize
, otm
) )
298 wxLogLastError("GetOutlineTextMetrics()");
302 // in spite of its type, the otmpFamilyName field of OUTLINETEXTMETRIC
303 // gives an offset in _bytes_ of the face (not family!) name from the
304 // struct start while the name itself is an array of TCHARs
306 // FWIW otmpFaceName contains the same thing as otmpFamilyName followed
307 // by a possible " Italic" or " Bold" or something else suffix
308 return reinterpret_cast<wxChar
*>(otm
) +
309 wxPtrToUInt(otm
->otmpFamilyName
)/sizeof(wxChar
);
312 // are we using m_nativeFontInfo.lf.lfHeight for point size or pixel size?
313 bool m_sizeUsingPixels
;
315 // Windows font handle, created on demand in GetHFONT()
319 wxNativeFontInfo m_nativeFontInfo
;
322 #define M_FONTDATA ((wxFontRefData*)m_refData)
324 // ============================================================================
326 // ============================================================================
328 // ----------------------------------------------------------------------------
330 // ----------------------------------------------------------------------------
332 void wxFontRefData::Init(int pointSize
,
333 const wxSize
& pixelSize
,
334 bool sizeUsingPixels
,
339 const wxString
& faceName
,
340 wxFontEncoding encoding
)
344 m_sizeUsingPixels
= sizeUsingPixels
;
345 if ( m_sizeUsingPixels
)
346 SetPixelSize(pixelSize
);
348 SetPointSize(pointSize
);
352 SetUnderlined(underlined
);
354 // set the family/facename
356 if ( !faceName
.empty() )
357 SetFaceName(faceName
);
359 // deal with encoding now (it may override the font family and facename
360 // so do it after setting them)
361 SetEncoding(encoding
);
364 void wxFontRefData::Init(const wxNativeFontInfo
& info
, WXHFONT hFont
)
366 // hFont may be zero, or it be passed in case we really want to
367 // use the exact font created in the underlying system
368 // (for example where we can't guarantee conversion from HFONT
369 // to LOGFONT back to HFONT)
370 m_hFont
= (HFONT
)hFont
;
371 m_nativeFontInfo
= info
;
373 // TODO: m_sizeUsingPixels?
376 wxFontRefData::~wxFontRefData()
381 bool wxFontRefData::Alloc()
383 m_hFont
= ::CreateFontIndirect(&m_nativeFontInfo
.lf
);
386 wxLogLastError(wxT("CreateFont"));
393 void wxFontRefData::Free()
397 if ( !::DeleteObject(m_hFont
) )
399 wxLogLastError(wxT("DeleteObject(font)"));
406 // ----------------------------------------------------------------------------
408 // ----------------------------------------------------------------------------
410 void wxNativeFontInfo::Init()
414 // we get better font quality if we use PROOF_QUALITY instead of
415 // DEFAULT_QUALITY but some fonts (e.g. "Terminal 6pt") are not available
416 // then so we allow to set a global option to choose between quality and
417 // wider font selection
419 lf
.lfQuality
= CLEARTYPE_QUALITY
;
421 lf
.lfQuality
= wxSystemOptions::GetOptionInt("msw.font.no-proof-quality")
427 int wxNativeFontInfo::GetPointSize() const
429 // FIXME: using the screen here results in incorrect font size calculation
431 const int ppInch
= ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY
);
433 // BC++ 2007 doesn't provide abs(long) overload, hence the cast
434 return (int) (((72.0*abs((int)lf
.lfHeight
)) / (double) ppInch
) + 0.5);
437 wxSize
wxNativeFontInfo::GetPixelSize() const
440 ret
.SetHeight(abs((int)lf
.lfHeight
));
441 ret
.SetWidth(lf
.lfWidth
);
445 wxFontStyle
wxNativeFontInfo::GetStyle() const
447 return lf
.lfItalic
? wxFONTSTYLE_ITALIC
: wxFONTSTYLE_NORMAL
;
450 wxFontWeight
wxNativeFontInfo::GetWeight() const
452 if ( lf
.lfWeight
<= 300 )
453 return wxFONTWEIGHT_LIGHT
;
455 if ( lf
.lfWeight
>= 600 )
456 return wxFONTWEIGHT_BOLD
;
458 return wxFONTWEIGHT_NORMAL
;
461 bool wxNativeFontInfo::GetUnderlined() const
463 return lf
.lfUnderline
!= 0;
466 wxString
wxNativeFontInfo::GetFaceName() const
468 return lf
.lfFaceName
;
471 wxFontFamily
wxNativeFontInfo::GetFamily() const
475 // extract family from pitch-and-family
476 switch ( lf
.lfPitchAndFamily
& ~PITCH_MASK
)
479 family
= wxFONTFAMILY_UNKNOWN
;
483 family
= wxFONTFAMILY_ROMAN
;
487 family
= wxFONTFAMILY_SWISS
;
491 family
= wxFONTFAMILY_SCRIPT
;
495 family
= wxFONTFAMILY_MODERN
;
499 family
= wxFONTFAMILY_DECORATIVE
;
503 wxFAIL_MSG( "unknown LOGFONT::lfFamily value" );
504 family
= wxFONTFAMILY_UNKNOWN
;
505 // just to avoid a warning
511 wxFontEncoding
wxNativeFontInfo::GetEncoding() const
513 return wxGetFontEncFromCharSet(lf
.lfCharSet
);
516 void wxNativeFontInfo::SetPointSize(int pointsize
)
518 // FIXME: using the screen here results in incorrect font size calculation
520 const int ppInch
= ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY
);
522 lf
.lfHeight
= -(int)((pointsize
*((double)ppInch
)/72.0) + 0.5);
525 void wxNativeFontInfo::SetPixelSize(const wxSize
& pixelSize
)
527 // MSW accepts both positive and negative heights here but they mean
528 // different things: positive specifies the cell height while negative
529 // specifies the character height. We used to just pass the value to MSW
530 // unchanged but changed the behaviour for positive values in 2.9.1 to
531 // match other ports and, more importantly, the expected behaviour. So now
532 // passing the negative height doesn't make sense at all any more but we
533 // still accept it for compatibility with the existing code which worked
534 // around the wrong interpretation of the height argument in older wxMSW
535 // versions by passing a negative value explicitly itself.
536 lf
.lfHeight
= -abs(pixelSize
.GetHeight());
537 lf
.lfWidth
= pixelSize
.GetWidth();
540 void wxNativeFontInfo::SetStyle(wxFontStyle style
)
545 wxFAIL_MSG( "unknown font style" );
548 case wxFONTSTYLE_NORMAL
:
552 case wxFONTSTYLE_ITALIC
:
553 case wxFONTSTYLE_SLANT
:
559 void wxNativeFontInfo::SetWeight(wxFontWeight weight
)
564 wxFAIL_MSG( "unknown font weight" );
567 case wxFONTWEIGHT_NORMAL
:
568 lf
.lfWeight
= FW_NORMAL
;
571 case wxFONTWEIGHT_LIGHT
:
572 lf
.lfWeight
= FW_LIGHT
;
575 case wxFONTWEIGHT_BOLD
:
576 lf
.lfWeight
= FW_BOLD
;
581 void wxNativeFontInfo::SetUnderlined(bool underlined
)
583 lf
.lfUnderline
= underlined
;
586 bool wxNativeFontInfo::SetFaceName(const wxString
& facename
)
588 wxStrlcpy(lf
.lfFaceName
, facename
.c_str(), WXSIZEOF(lf
.lfFaceName
));
592 void wxNativeFontInfo::SetFamily(wxFontFamily family
)
594 BYTE ff_family
= FF_DONTCARE
;
598 case wxFONTFAMILY_SCRIPT
:
599 ff_family
= FF_SCRIPT
;
602 case wxFONTFAMILY_DECORATIVE
:
603 ff_family
= FF_DECORATIVE
;
606 case wxFONTFAMILY_ROMAN
:
607 ff_family
= FF_ROMAN
;
610 case wxFONTFAMILY_TELETYPE
:
611 case wxFONTFAMILY_MODERN
:
612 ff_family
= FF_MODERN
;
615 case wxFONTFAMILY_SWISS
:
616 case wxFONTFAMILY_DEFAULT
:
617 ff_family
= FF_SWISS
;
620 case wxFONTFAMILY_UNKNOWN
:
621 wxFAIL_MSG( "invalid font family" );
625 wxCHECK_RET( ff_family
!= FF_DONTCARE
, "unknown wxFontFamily" );
627 lf
.lfPitchAndFamily
= (BYTE
)(DEFAULT_PITCH
) | ff_family
;
629 // reset the facename so that CreateFontIndirect() will automatically choose a
630 // face name based only on the font family.
631 lf
.lfFaceName
[0] = '\0';
634 void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding
)
636 wxNativeEncodingInfo info
;
637 if ( !wxGetNativeFontEncoding(encoding
, &info
) )
640 if ( wxFontMapper::Get()->GetAltForEncoding(encoding
, &info
) )
642 if ( !info
.facename
.empty() )
644 // if we have this encoding only in some particular facename, use
645 // the facename - it is better to show the correct characters in a
646 // wrong facename than unreadable text in a correct one
647 SetFaceName(info
.facename
);
651 #endif // wxUSE_FONTMAP
653 // unsupported encoding, replace with the default
654 info
.charset
= DEFAULT_CHARSET
;
658 lf
.lfCharSet
= (BYTE
)info
.charset
;
661 bool wxNativeFontInfo::FromString(const wxString
& s
)
665 wxStringTokenizer
tokenizer(s
, wxS(";"), wxTOKEN_RET_EMPTY_ALL
);
668 wxString token
= tokenizer
.GetNextToken();
669 if ( token
!= wxS('0') )
672 token
= tokenizer
.GetNextToken();
673 if ( !token
.ToLong(&l
) )
677 token
= tokenizer
.GetNextToken();
678 if ( !token
.ToLong(&l
) )
682 token
= tokenizer
.GetNextToken();
683 if ( !token
.ToLong(&l
) )
687 token
= tokenizer
.GetNextToken();
688 if ( !token
.ToLong(&l
) )
690 lf
.lfOrientation
= l
;
692 token
= tokenizer
.GetNextToken();
693 if ( !token
.ToLong(&l
) )
697 token
= tokenizer
.GetNextToken();
698 if ( !token
.ToLong(&l
) )
700 lf
.lfItalic
= (BYTE
)l
;
702 token
= tokenizer
.GetNextToken();
703 if ( !token
.ToLong(&l
) )
705 lf
.lfUnderline
= (BYTE
)l
;
707 token
= tokenizer
.GetNextToken();
708 if ( !token
.ToLong(&l
) )
710 lf
.lfStrikeOut
= (BYTE
)l
;
712 token
= tokenizer
.GetNextToken();
713 if ( !token
.ToLong(&l
) )
715 lf
.lfCharSet
= (BYTE
)l
;
717 token
= tokenizer
.GetNextToken();
718 if ( !token
.ToLong(&l
) )
720 lf
.lfOutPrecision
= (BYTE
)l
;
722 token
= tokenizer
.GetNextToken();
723 if ( !token
.ToLong(&l
) )
725 lf
.lfClipPrecision
= (BYTE
)l
;
727 token
= tokenizer
.GetNextToken();
728 if ( !token
.ToLong(&l
) )
730 lf
.lfQuality
= (BYTE
)l
;
732 token
= tokenizer
.GetNextToken();
733 if ( !token
.ToLong(&l
) )
735 lf
.lfPitchAndFamily
= (BYTE
)l
;
737 if ( !tokenizer
.HasMoreTokens() )
740 // the face name may be empty
741 SetFaceName(tokenizer
.GetNextToken());
746 wxString
wxNativeFontInfo::ToString() const
750 s
.Printf(wxS("%d;%ld;%ld;%ld;%ld;%ld;%d;%d;%d;%d;%d;%d;%d;%d;%s"),
751 0, // version, in case we want to change the format later
770 // ----------------------------------------------------------------------------
772 // ----------------------------------------------------------------------------
774 wxFont::wxFont(const wxString
& fontdesc
)
776 wxNativeFontInfo info
;
777 if ( info
.FromString(fontdesc
) )
781 bool wxFont::Create(const wxNativeFontInfo
& info
, WXHFONT hFont
)
785 m_refData
= new wxFontRefData(info
, hFont
);
787 return RealizeResource();
790 bool wxFont::DoCreate(int pointSize
,
791 const wxSize
& pixelSize
,
792 bool sizeUsingPixels
,
797 const wxString
& faceName
,
798 wxFontEncoding encoding
)
802 // wxDEFAULT is a valid value for the font size too so we must treat it
803 // specially here (otherwise the size would be 70 == wxDEFAULT value)
804 if ( pointSize
== wxDEFAULT
)
806 pointSize
= wxNORMAL_FONT
->GetPointSize();
809 m_refData
= new wxFontRefData(pointSize
, pixelSize
, sizeUsingPixels
,
810 family
, style
, weight
,
811 underlined
, faceName
, encoding
);
813 return RealizeResource();
820 // ----------------------------------------------------------------------------
821 // real implementation
822 // ----------------------------------------------------------------------------
824 wxGDIRefData
*wxFont::CreateGDIRefData() const
826 return new wxFontRefData();
829 wxGDIRefData
*wxFont::CloneGDIRefData(const wxGDIRefData
*data
) const
831 return new wxFontRefData(*static_cast<const wxFontRefData
*>(data
));
834 bool wxFont::RealizeResource()
836 // NOTE: the GetHFONT() call automatically triggers a reallocation of
837 // the HFONT if necessary (will do nothing if we already have the resource);
838 // it returns NULL only if there is a failure in wxFontRefData::Alloc()...
839 return GetHFONT() != NULL
;
842 bool wxFont::FreeResource(bool WXUNUSED(force
))
852 WXHANDLE
wxFont::GetResourceHandle() const
854 return (WXHANDLE
)GetHFONT();
857 WXHFONT
wxFont::GetHFONT() const
859 // NOTE: wxFontRefData::GetHFONT() will automatically call
860 // wxFontRefData::Alloc() if necessary
861 return M_FONTDATA
? M_FONTDATA
->GetHFONT() : 0;
864 bool wxFont::IsFree() const
866 return M_FONTDATA
&& !M_FONTDATA
->HasHFONT();
869 // ----------------------------------------------------------------------------
870 // change font attribute: we recreate font when doing it
871 // ----------------------------------------------------------------------------
873 void wxFont::SetPointSize(int pointSize
)
878 M_FONTDATA
->SetPointSize(pointSize
);
881 void wxFont::SetPixelSize(const wxSize
& pixelSize
)
885 M_FONTDATA
->SetPixelSize(pixelSize
);
888 void wxFont::SetFamily(wxFontFamily family
)
892 M_FONTDATA
->SetFamily(family
);
895 void wxFont::SetStyle(wxFontStyle style
)
899 M_FONTDATA
->SetStyle(style
);
902 void wxFont::SetWeight(wxFontWeight weight
)
906 M_FONTDATA
->SetWeight(weight
);
909 bool wxFont::SetFaceName(const wxString
& faceName
)
913 if ( !M_FONTDATA
->SetFaceName(faceName
) )
916 // NB: using win32's GetObject() API on M_FONTDATA->GetHFONT()
917 // to retrieve a LOGFONT and then compare lf.lfFaceName
918 // with given facename is not reliable at all:
919 // Windows copies the facename given to ::CreateFontIndirect()
920 // without any validity check.
921 // Thus we use wxFontBase::SetFaceName to check if facename
923 return wxFontBase::SetFaceName(faceName
);
926 void wxFont::SetUnderlined(bool underlined
)
930 M_FONTDATA
->SetUnderlined(underlined
);
933 void wxFont::SetEncoding(wxFontEncoding encoding
)
937 M_FONTDATA
->SetEncoding(encoding
);
940 void wxFont::DoSetNativeFontInfo(const wxNativeFontInfo
& info
)
944 M_FONTDATA
->SetNativeFontInfo(info
);
947 // ----------------------------------------------------------------------------
949 // ----------------------------------------------------------------------------
951 int wxFont::GetPointSize() const
953 wxCHECK_MSG( IsOk(), 0, wxT("invalid font") );
955 return M_FONTDATA
->GetPointSize();
958 wxSize
wxFont::GetPixelSize() const
960 wxCHECK_MSG( IsOk(), wxDefaultSize
, wxT("invalid font") );
962 return M_FONTDATA
->GetPixelSize();
965 bool wxFont::IsUsingSizeInPixels() const
967 wxCHECK_MSG( IsOk(), 0, wxT("invalid font") );
969 return M_FONTDATA
->IsUsingSizeInPixels();
972 wxFontFamily
wxFont::DoGetFamily() const
974 return M_FONTDATA
->GetFamily();
977 wxFontStyle
wxFont::GetStyle() const
979 wxCHECK_MSG( IsOk(), wxFONTSTYLE_MAX
, wxT("invalid font") );
981 return M_FONTDATA
->GetStyle();
984 wxFontWeight
wxFont::GetWeight() const
986 wxCHECK_MSG( IsOk(), wxFONTWEIGHT_MAX
, wxT("invalid font") );
988 return M_FONTDATA
->GetWeight();
991 bool wxFont::GetUnderlined() const
993 wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
995 return M_FONTDATA
->GetUnderlined();
998 wxString
wxFont::GetFaceName() const
1000 wxCHECK_MSG( IsOk(), wxEmptyString
, wxT("invalid font") );
1002 return M_FONTDATA
->GetFaceName();
1005 wxFontEncoding
wxFont::GetEncoding() const
1007 wxCHECK_MSG( IsOk(), wxFONTENCODING_DEFAULT
, wxT("invalid font") );
1009 return M_FONTDATA
->GetEncoding();
1012 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
1014 return IsOk() ? &(M_FONTDATA
->GetNativeFontInfo()) : NULL
;
1017 bool wxFont::IsFixedWidth() const
1019 wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
1021 // LOGFONT doesn't contain the correct pitch information so we need to call
1022 // GetTextMetrics() to get it
1024 SelectInHDC
selectFont(hdc
, M_FONTDATA
->GetHFONT());
1027 if ( !::GetTextMetrics(hdc
, &tm
) )
1029 wxLogLastError(wxT("GetTextMetrics"));
1033 // Quoting MSDN description of TMPF_FIXED_PITCH: "Note very carefully that
1034 // those meanings are the opposite of what the constant name implies."
1035 return !(tm
.tmPitchAndFamily
& TMPF_FIXED_PITCH
);