]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/font.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "font.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 extern wxFontNameDirectory
*wxTheFontNameDirectory
;
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
28 class wxFontRefData
: public wxObjectRefData
35 wxList m_scaled_xfonts
;
37 int m_family
, m_style
, m_weight
;
48 wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER
)
50 m_byXFontName
= FALSE
;
57 m_faceName
= (char *) NULL
;
58 m_font
= (GdkFont
*) NULL
;
61 wxFontRefData::~wxFontRefData(void)
63 wxNode
*node
= m_scaled_xfonts
.First();
66 GdkFont
*font
= (GdkFont
*)node
->Data();
67 wxNode
*next
= node
->Next();
68 gdk_font_unref( font
);
74 m_faceName
= (char *) NULL
;
76 if (m_font
) gdk_font_unref( m_font
);
79 //-----------------------------------------------------------------------------
81 #define M_FONTDATA ((wxFontRefData *)m_refData)
83 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
)
87 if (wxTheFontList
) wxTheFontList
->Append( this );
90 wxFont::wxFont( char *xFontName
)
92 if (!xFontName
) return;
94 m_refData
= new wxFontRefData();
96 M_FONTDATA
->m_byXFontName
= TRUE
;
97 M_FONTDATA
->m_font
= gdk_font_load( xFontName
);
100 wxFont::wxFont(int PointSize
, int FontIdOrFamily
, int Style
, int Weight
,
101 bool Underlined
, const char* Face
)
103 m_refData
= new wxFontRefData();
105 if ((M_FONTDATA
->m_faceName
= (Face
) ? copystring(Face
) : (char*)NULL
) )
107 M_FONTDATA
->m_fontId
= wxTheFontNameDirectory
->FindOrCreateFontId( Face
, FontIdOrFamily
);
108 M_FONTDATA
->m_family
= wxTheFontNameDirectory
->GetFamily( FontIdOrFamily
);
112 M_FONTDATA
->m_fontId
= FontIdOrFamily
;
113 M_FONTDATA
->m_family
= wxTheFontNameDirectory
->GetFamily( FontIdOrFamily
);
115 if (Style
== wxDEFAULT
) Style
= wxSWISS
;
116 M_FONTDATA
->m_style
= Style
;
117 if (Weight
== wxDEFAULT
) Weight
= wxNORMAL
;
118 M_FONTDATA
->m_weight
= Weight
;
119 if (PointSize
== wxDEFAULT
) PointSize
= 10;
120 M_FONTDATA
->m_pointSize
= PointSize
;
121 M_FONTDATA
->m_underlined
= Underlined
;
123 if (wxTheFontList
) wxTheFontList
->Append( this );
126 wxFont::wxFont(int PointSize
, const char *Face
, int Family
, int Style
,
127 int Weight
, bool Underlined
)
129 m_refData
= new wxFontRefData();
131 M_FONTDATA
->m_fontId
= wxTheFontNameDirectory
->FindOrCreateFontId( Face
, Family
);
132 M_FONTDATA
->m_faceName
= (Face
) ? copystring(Face
) : (char*)NULL
;
133 M_FONTDATA
->m_family
= wxTheFontNameDirectory
->GetFamily( M_FONTDATA
->m_fontId
);
134 M_FONTDATA
->m_style
= Style
;
135 M_FONTDATA
->m_weight
= Weight
;
136 M_FONTDATA
->m_pointSize
= PointSize
;
137 M_FONTDATA
->m_underlined
= Underlined
;
139 if (wxTheFontList
) wxTheFontList
->Append( this );
142 wxFont::wxFont( const wxFont
& font
)
146 if (wxTheFontList
) wxTheFontList
->Append( this );
149 wxFont::wxFont( const wxFont
* font
)
152 if (font
) Ref( *font
);
154 if (wxTheFontList
) wxTheFontList
->Append( this );
157 wxFont::~wxFont(void)
159 if (wxTheFontList
) wxTheFontList
->DeleteObject( this );
162 wxFont
& wxFont::operator = ( const wxFont
& font
)
164 if (*this == font
) return (*this);
169 bool wxFont::operator == ( const wxFont
& font
)
171 return m_refData
== font
.m_refData
;
174 bool wxFont::operator != ( const wxFont
& font
)
176 return m_refData
!= font
.m_refData
;
179 bool wxFont::Ok() const
181 return (m_refData
!= NULL
);
184 int wxFont::GetPointSize(void) const
188 wxFAIL_MSG( "invalid font" );
192 return M_FONTDATA
->m_pointSize
;
195 wxString
wxFont::GetFaceString(void) const
199 wxFAIL_MSG( "invalid font" );
203 wxString s
= wxTheFontNameDirectory
->GetFontName( M_FONTDATA
->m_fontId
);
207 wxString
wxFont::GetFaceName(void) const
211 wxFAIL_MSG( "invalid font" );
215 wxString s
= wxTheFontNameDirectory
->GetFontName( M_FONTDATA
->m_fontId
);
219 int wxFont::GetFamily(void) const
223 wxFAIL_MSG( "invalid font" );
227 return M_FONTDATA
->m_family
;
230 wxString
wxFont::GetFamilyString(void) const
234 wxFAIL_MSG( "invalid font" );
238 switch (M_FONTDATA
->m_family
)
240 case wxDECORATIVE
: return wxString("wxDECORATIVE");
241 case wxROMAN
: return wxString("wxROMAN");
242 case wxSCRIPT
: return wxString("wxSCRIPT");
243 case wxSWISS
: return wxString("wxSWISS");
244 case wxMODERN
: return wxString("wxMODERN");
245 case wxTELETYPE
: return wxString("wxTELETYPE");
246 default: return "wxDEFAULT";
252 int wxFont::GetFontId(void) const
256 wxFAIL_MSG( "invalid font" );
260 return M_FONTDATA
->m_fontId
; // stub
263 int wxFont::GetStyle(void) const
267 wxFAIL_MSG( "invalid font" );
271 return M_FONTDATA
->m_style
;
274 wxString
wxFont::GetStyleString(void) const
278 wxFAIL_MSG( "invalid font" );
282 switch (M_FONTDATA
->m_style
)
284 case wxNORMAL
: return wxString("wxNORMAL");
285 case wxSLANT
: return wxString("wxSLANT");
286 case wxITALIC
: return wxString("wxITALIC");
287 default: return wxString("wxDEFAULT");
290 return wxString("wxDEFAULT");
293 int wxFont::GetWeight(void) const
297 wxFAIL_MSG( "invalid font" );
301 return M_FONTDATA
->m_weight
;
304 wxString
wxFont::GetWeightString(void) const
308 wxFAIL_MSG( "invalid font" );
312 switch (M_FONTDATA
->m_weight
)
314 case wxNORMAL
: return wxString("wxNORMAL");
315 case wxBOLD
: return wxString("wxBOLD");
316 case wxLIGHT
: return wxString("wxLIGHT");
317 default: return wxString("wxDEFAULT");
320 return wxString("wxDEFAULT");
323 bool wxFont::GetUnderlined(void) const
327 wxFAIL_MSG( "invalid font" );
331 return M_FONTDATA
->m_underlined
;
334 //-----------------------------------------------------------------------------
335 // get internal representation of font
336 //-----------------------------------------------------------------------------
338 // local help function
339 static GdkFont
*wxLoadQueryNearestFont(int point_size
, int fontid
,
340 int style
, int weight
,
343 GdkFont
*wxFont::GetInternalFont(float scale
) const
347 wxFAIL_MSG( "invalid font" );
348 return (GdkFont
*) NULL
;
351 if (M_FONTDATA
->m_byXFontName
) return M_FONTDATA
->m_font
;
353 long int_scale
= long(scale
* 100.0 + 0.5); // key for fontlist
354 int point_scale
= (M_FONTDATA
->m_pointSize
* 10 * int_scale
) / 100;
355 GdkFont
*font
= (GdkFont
*) NULL
;
357 wxNode
*node
= M_FONTDATA
->m_scaled_xfonts
.Find(int_scale
);
360 font
= (GdkFont
*)node
->Data();
364 if ((int_scale
== 100) &&
365 (M_FONTDATA
->m_style
== wxSWISS
) &&
366 (M_FONTDATA
->m_pointSize
== 12) &&
367 (M_FONTDATA
->m_weight
== wxNORMAL
) &&
368 (M_FONTDATA
->m_underlined
== FALSE
) &&
369 (M_FONTDATA
->m_style
== wxNORMAL
))
371 font
= gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" );
375 font
= wxLoadQueryNearestFont( point_scale
, M_FONTDATA
->m_fontId
, M_FONTDATA
->m_style
,
376 M_FONTDATA
->m_weight
, M_FONTDATA
->m_underlined
);
378 M_FONTDATA
->m_scaled_xfonts
.Append( int_scale
, (wxObject
*)font
);
381 printf("could not load any font");
382 // wxError("could not load any font", "wxFont");
386 //-----------------------------------------------------------------------------
387 // local utilities to find a X font
388 //-----------------------------------------------------------------------------
390 static GdkFont
*wxLoadQueryFont(int point_size
, int fontid
, int style
,
391 int weight
, bool WXUNUSED(underlined
))
394 char *name
= wxTheFontNameDirectory
->GetScreenName( fontid
, weight
, style
);
397 name
= "-*-*-*-*-*-*-*-%d-*-*-*-*-*-*";
398 sprintf(buffer
, name
, point_size
);
400 return gdk_font_load( buffer
);
403 static GdkFont
*wxLoadQueryNearestFont(int point_size
, int fontid
,
404 int style
, int weight
,
409 font
= wxLoadQueryFont( point_size
, fontid
, style
, weight
, underlined
);
412 // search up and down by stepsize 10
413 int max_size
= point_size
+ 20 * (1 + (point_size
/180));
414 int min_size
= point_size
- 20 * (1 + (point_size
/180));
417 // Search for smaller size (approx.)
418 for (i
=point_size
-10; !font
&& i
>= 10 && i
>= min_size
; i
-= 10)
419 font
= wxLoadQueryFont(i
, fontid
, style
, weight
, underlined
);
420 // Search for larger size (approx.)
421 for (i
=point_size
+10; !font
&& i
<= max_size
; i
+= 10)
422 font
= wxLoadQueryFont(i
, fontid
, style
, weight
, underlined
);
423 // Try default family
424 if (!font
&& fontid
!= wxDEFAULT
)
425 font
= wxLoadQueryFont(point_size
, wxDEFAULT
, style
,
429 font
= wxLoadQueryFont(120, wxDEFAULT
, wxNORMAL
, wxNORMAL
,
435 //-----------------------------------------------------------------------------
436 // face names and index functions
437 //-----------------------------------------------------------------------------
439 static char *font_defaults
[] = {
440 "FamilyDefault", "Default",
441 "FamilyRoman", "Roman",
442 "FamilyDecorative", "Decorative",
443 "FamilyModern", "Modern",
444 "FamilyTeletype", "Teletype",
445 "FamilySwiss", "Swiss",
446 "FamilyScript", "Script",
452 "AfmItalic", "${AfmSlant}",
456 "AfmHelvetica", "Helv",
457 "AfmCourier", "Cour",
459 "Afm___", "${AfmTimes,$[weight],$[style]}",
461 "AfmTimes__", "${AfmTimes}${Afm$[weight]}${Afm$[style]}",
462 "AfmTimesMediumStraight", "${AfmTimes}${AfmRoman}",
463 "AfmTimesLightStraight", "${AfmTimes}${AfmRoman}",
464 "AfmTimes_Italic", "${AfmTimes}$[weight]${AfmItalic}",
465 "AfmTimes_Slant", "${AfmTimes}$[weight]${AfmItalic}",
467 "AfmSwiss__", "${AfmHelvetica}${Afm$[weight]}${Afm$[style]}",
468 "AfmModern__", "${AfmCourier}${Afm$[weight]}${Afm$[style]}",
470 "AfmTeletype__", "${AfmModern,$[weight],$[style]}",
472 "PostScriptMediumStraight", "",
473 "PostScriptMediumItalic", "-Oblique",
474 "PostScriptMediumSlant", "-Oblique",
475 "PostScriptLightStraight", "",
476 "PostScriptLightItalic", "-Oblique",
477 "PostScriptLightSlant", "-Oblique",
478 "PostScriptBoldStraight", "-Bold",
479 "PostScriptBoldItalic", "-BoldOblique",
480 "PostScriptBoldSlant", "-BoldOblique",
482 #if WX_NORMALIZED_PS_FONTS
483 "PostScript___", "${PostScriptTimes,$[weight],$[style]}",
485 "PostScriptRoman__", "${PostScriptTimes,$[weight],$[style]}",
486 "PostScript___", "LucidaSans${PostScript$[weight]$[style]}",
489 "PostScriptTimesMedium", "",
490 "PostScriptTimesLight", "",
491 "PostScriptTimesBold", "Bold",
493 "PostScriptTimes__", "Times${PostScript$[weight]$[style]}",
494 "PostScriptTimesMediumStraight", "Times-Roman",
495 "PostScriptTimesLightStraight", "Times-Roman",
496 "PostScriptTimes_Slant", "Times-${PostScriptTimes$[weight]}Italic",
497 "PostScriptTimes_Italic", "Times-${PostScriptTimes$[weight]}Italic",
499 "PostScriptSwiss__", "Helvetica${PostScript$[weight]$[style]}",
500 "PostScriptModern__", "Courier${PostScript$[weight]$[style]}",
502 "PostScriptTeletype__", "${PostScriptModern,$[weight],$[style]}",
504 #if !WX_NORMALIZED_PS_FONTS
505 "PostScriptScript__", "Zapf-Chancery-MediumItalic",
508 "ScreenMedium", "medium",
509 "ScreenBold", "bold",
510 "ScreenLight", "light",
511 "ScreenStraight", "r",
515 "ScreenDefaultBase", "misc-fixed",
516 "ScreenRomanBase", "*-times",
517 "ScreenDecorativeBase", "*-helvetica",
518 "ScreenModernBase", "*-courier",
519 "ScreenTeletypeBase", "*-lucidatypewriter",
520 "ScreenSwissBase", "*-lucida",
521 "ScreenScriptBase", "*-zapfchancery",
523 "ScreenStdSuffix", "-${Screen$[weight]}-${Screen$[style]}"
524 "-normal-*-*-%d-*-*-*-*-*-*",
527 "-${ScreenDefaultBase}${ScreenStdSuffix}",
529 "-${ScreenRomanBase}${ScreenStdSuffix}",
530 "ScreenDecorative__",
531 "-${ScreenDecorativeBase}${ScreenStdSuffix}",
533 "-${ScreenModernBase}${ScreenStdSuffix}",
535 "-${ScreenTeletypeBase}${ScreenStdSuffix}",
537 "-${ScreenSwissBase}${ScreenStdSuffix}",
539 "-${ScreenScriptBase}${ScreenStdSuffix}",
543 enum {wxWEIGHT_NORMAL
, wxWEIGHT_BOLD
, wxWEIGHT_LIGHT
, wxNUM_WEIGHTS
};
544 enum {wxSTYLE_NORMAL
, wxSTYLE_ITALIC
, wxSTYLE_SLANT
, wxNUM_STYLES
};
546 static int WCoordinate(int w
)
549 case wxBOLD
: return wxWEIGHT_BOLD
;
550 case wxLIGHT
: return wxWEIGHT_LIGHT
;
552 default: return wxWEIGHT_NORMAL
;
556 static int SCoordinate(int s
)
559 case wxITALIC
: return wxSTYLE_ITALIC
;
560 case wxSLANT
: return wxSTYLE_SLANT
;
562 default: return wxSTYLE_NORMAL
;
566 //-----------------------------------------------------------------------------
568 //-----------------------------------------------------------------------------
574 inline char *GetName(int weight
, int style
)
576 return ( map
[WCoordinate(weight
)] [SCoordinate(style
)] );
579 char *map
[wxNUM_WEIGHTS
][wxNUM_STYLES
];
580 void Initialize(const char *, const char *);
584 #define wxGetResource(a, b, c) 0
587 static void SearchResource(const char *prefix
, const char **names
, int count
, char **v
)
590 char resource
[1024], **defaults
, *internal
;
595 internal
= (char *) NULL
;
597 for (i
= 0; i
< k
; i
++) {
598 strcpy(resource
, prefix
);
599 for (j
= 0; j
< count
; j
++) {
601 strcat(resource
, names
[j
]);
603 strcat(resource
, "_");
605 if (wxGetResource(wxAPP_CLASS
, (char *)resource
, v
))
608 defaults
= font_defaults
;
610 if (!strcmp(*defaults
, resource
)) {
611 internal
= defaults
[1];
619 *v
= copystring(internal
);
622 wxSuffixMap::~wxSuffixMap(void)
626 for (k
= 0; k
< wxNUM_WEIGHTS
; ++k
)
627 for (j
= 0; j
< wxNUM_STYLES
; ++j
)
630 map
[k
][j
] = (char *) NULL
;
634 void wxSuffixMap::Initialize(const char *resname
, const char *devresname
)
636 const char *weight
, *style
;
639 const char *names
[3];
641 for (k
= 0; k
< wxNUM_WEIGHTS
; k
++) {
643 case wxWEIGHT_NORMAL
: weight
= "Medium"; break;
644 case wxWEIGHT_LIGHT
: weight
= "Light"; break;
646 default: weight
= "Bold";
648 for (j
= 0; j
< wxNUM_STYLES
; j
++) {
650 case wxSTYLE_NORMAL
: style
= "Straight"; break;
651 case wxSTYLE_ITALIC
: style
= "Italic"; break;
653 default: style
= "Slant";
659 SearchResource(devresname
, names
, 3, &v
);
661 /* Expand macros in the found string: */
663 int len
, closer
= 0, startpos
= 0;
665 len
= (v
? strlen(v
) : 0);
666 for (i
= 0; i
< len
; i
++) {
667 if (v
[i
] == '$' && ((v
[i
+1] == '[') || (v
[i
+1] == '{'))) {
669 closer
= (v
[i
+1] == '[') ? ']' : '}';
671 } else if (v
[i
] == closer
) {
673 const char *r
= (char *) NULL
; bool delete_r
= FALSE
;
676 name
= v
+ startpos
+ 2;
683 for (i
= 0, count
= 1; name
[i
]; i
++)
689 names
= new char*[count
];
691 for (i
= 0, count
= 1; i
< len
; i
++)
692 if (name
[i
] == ',') {
693 names
[count
++] = name
+ i
+ 1;
697 SearchResource("", (const char **)names
, count
, (char **)&r
);
702 for (i
= 0; i
< len
; i
++)
706 printf("Bad resource name \"%s\" in font lookup\n", name
);
708 } else if (!strcmp(name
, "weight")) {
710 } else if (!strcmp(name
, "style")) {
712 } else if (!strcmp(name
, "family")) {
716 printf("Bad font macro name \"%s\"\n", name
);
720 newstrlen
= strlen(r
);
721 char *naya
= new char[startpos
+ newstrlen
+ len
- i
];
722 memcpy(naya
, v
, startpos
);
723 memcpy(naya
+ startpos
, r
, newstrlen
);
724 memcpy(naya
+ startpos
+ newstrlen
, v
+ i
+ 1, len
- i
);
733 /* We have a final value: */
739 //-----------------------------------------------------------------------------
741 //-----------------------------------------------------------------------------
743 class wxFontNameItem
: public wxObject
{
744 DECLARE_DYNAMIC_CLASS(wxFontNameItem
)
746 wxFontNameItem(const char *name
, int id
, int family
);
749 inline char* GetScreenName(int w
, int s
) {return screen
.GetName(w
, s
);}
750 inline char* GetPostScriptName(int w
, int s
) {return printing
.GetName(w
, s
);}
751 inline char* GetAFMName(int w
, int s
) {return afm
.GetName(w
, s
);}
752 inline char* GetName(void) {return name
;}
753 inline int GetFamily(void) {return family
;}
754 inline int GetId(void) {return id
;}
755 inline bool IsRoman(void) {return isroman
;}
757 void Dump(ostream
& str
);
763 wxSuffixMap screen
, printing
, afm
;
767 IMPLEMENT_ABSTRACT_CLASS(wxFontNameItem
, wxObject
)
769 wxFontNameItem::wxFontNameItem(const char *Name
, int Id
, int Family
)
771 name
= copystring(Name
);
775 screen
. Initialize(name
, "Screen");
776 printing
.Initialize(name
, "PostScript");
777 afm
. Initialize(name
, "Afm");
780 wxFontNameItem::~wxFontNameItem(void)
784 name
= (char *) NULL
;
788 void wxFontNameItem::Dump(ostream
& str
)
790 str
<< "wxFontNameItem(" << name
<< ")";
794 //-----------------------------------------------------------------------------
796 //-----------------------------------------------------------------------------
798 IMPLEMENT_DYNAMIC_CLASS(wxFontNameDirectory
, wxObject
)
800 wxFontNameDirectory::wxFontNameDirectory(void)
802 table
= new wxHashTable(wxKEY_INTEGER
, 20);
806 wxFontNameDirectory::~wxFontNameDirectory()
808 // Cleanup wxFontNameItems allocated
810 wxNode
*node
= table
->Next();
812 wxFontNameItem
*item
= (wxFontNameItem
*)node
->Data();
814 node
= table
->Next();
819 int wxFontNameDirectory::GetNewFontId(void)
821 return (nextFontId
--);
824 void wxFontNameDirectory::Initialize()
826 Initialize(wxDEFAULT
, wxDEFAULT
, "Default");
827 Initialize(wxDECORATIVE
, wxDECORATIVE
, "Decorative");
828 Initialize(wxROMAN
, wxROMAN
, "Roman");
829 Initialize(wxMODERN
, wxMODERN
, "Modern");
830 Initialize(wxTELETYPE
, wxTELETYPE
, "Teletype");
831 Initialize(wxSWISS
, wxSWISS
, "Swiss");
832 Initialize(wxSCRIPT
, wxSCRIPT
, "Script");
835 void wxFontNameDirectory::Initialize(int fontid
, int family
, const char *resname
)
837 char *fam
, resource
[256];
839 sprintf(resource
, "Family%s", resname
);
840 SearchResource((const char *)resource
, (const char **) NULL
, 0, (char **)&fam
);
842 if (!strcmp(fam
, "Default")) family
= wxDEFAULT
;
843 else if (!strcmp(fam
, "Roman")) family
= wxROMAN
;
844 else if (!strcmp(fam
, "Decorative")) family
= wxDECORATIVE
;
845 else if (!strcmp(fam
, "Modern")) family
= wxMODERN
;
846 else if (!strcmp(fam
, "Teletype")) family
= wxTELETYPE
;
847 else if (!strcmp(fam
, "Swiss")) family
= wxSWISS
;
848 else if (!strcmp(fam
, "Script")) family
= wxSCRIPT
;
849 delete[] fam
; // free resource
851 table
->Put(fontid
, new wxFontNameItem(resname
, fontid
, family
));
854 int wxFontNameDirectory::FindOrCreateFontId(const char *name
, int family
)
858 // font exists -> return id
859 if ( (id
= GetFontId(name
)) ) return id
;
861 Initialize(id
=GetNewFontId(), family
, name
);
865 char *wxFontNameDirectory::GetScreenName(int fontid
, int weight
, int style
)
867 wxFontNameItem
*item
= (wxFontNameItem
*)table
->Get(fontid
); // find font
869 return item
->GetScreenName(weight
, style
);
870 // font does not exist
871 return (char *) NULL
;
874 char *wxFontNameDirectory::GetPostScriptName(int fontid
, int weight
, int style
)
876 wxFontNameItem
*item
= (wxFontNameItem
*)table
->Get(fontid
); // find font
878 return item
->GetPostScriptName(weight
, style
);
879 // font does not exist
880 return (char *) NULL
;
883 char *wxFontNameDirectory::GetAFMName(int fontid
, int weight
, int style
)
885 wxFontNameItem
*item
= (wxFontNameItem
*)table
->Get(fontid
); // find font
887 return item
->GetAFMName(weight
, style
);
888 // font does not exist
889 return (char *) NULL
;
892 char *wxFontNameDirectory::GetFontName(int fontid
)
894 wxFontNameItem
*item
= (wxFontNameItem
*)table
->Get(fontid
); // find font
896 return item
->GetName();
897 // font does not exist
898 return (char *) NULL
;
901 int wxFontNameDirectory::GetFontId(const char *name
)
907 while ( (node
= table
->Next()) ) {
908 wxFontNameItem
*item
= (wxFontNameItem
*)node
->Data();
909 if (!strcmp(name
, item
->name
))
912 // font does not exist
916 int wxFontNameDirectory::GetFamily(int fontid
)
918 wxFontNameItem
*item
= (wxFontNameItem
*)table
->Get(fontid
);
922 // font does not exist