-
- "ScreenMedium", "medium",
- "ScreenBold", "bold",
- "ScreenLight", "light",
- "ScreenStraight", "r",
- "ScreenItalic", "i",
- "ScreenSlant", "o",
-
- "ScreenDefaultBase", "*-times",
-
- "ScreenRomanBase", "*-times",
- "ScreenDecorativeBase", "*-helvetica",
- "ScreenModernBase", "*-courier",
- "ScreenTeletypeBase", "*-lucidatypewriter",
- "ScreenSwissBase", "*-lucida",
- "ScreenScriptBase", "*-zapfchancery",
-
- "ScreenStdSuffix", "-${Screen$[weight]}-${Screen$[style]}"
- "-normal-*-*-%d-*-*-*-*-*-*",
-
- "Screen___",
- "-${ScreenDefaultBase}${ScreenStdSuffix}",
- "ScreenRoman__",
- "-${ScreenRomanBase}${ScreenStdSuffix}",
- "ScreenDecorative__",
- "-${ScreenDecorativeBase}${ScreenStdSuffix}",
- "ScreenModern__",
- "-${ScreenModernBase}${ScreenStdSuffix}",
- "ScreenTeletype__",
- "-${ScreenTeletypeBase}${ScreenStdSuffix}",
- "ScreenSwiss__",
- "-${ScreenSwissBase}${ScreenStdSuffix}",
- "ScreenScript__",
- "-${ScreenScriptBase}${ScreenStdSuffix}",
- (char *) NULL
-};
-
-enum {wxWEIGHT_NORMAL, wxWEIGHT_BOLD, wxWEIGHT_LIGHT, wxNUM_WEIGHTS};
-enum {wxSTYLE_NORMAL, wxSTYLE_ITALIC, wxSTYLE_SLANT, wxNUM_STYLES};
-
-static int WCoordinate(int w)
-{
- switch (w)
- {
- case wxBOLD: return wxWEIGHT_BOLD;
- case wxLIGHT: return wxWEIGHT_LIGHT;
- case wxNORMAL:
- default: return wxWEIGHT_NORMAL;
- }
-};
-
-static int SCoordinate(int s)
-{
- switch (s)
- {
- case wxITALIC: return wxSTYLE_ITALIC;
- case wxSLANT: return wxSTYLE_SLANT;
- case wxNORMAL:
- default: return wxSTYLE_NORMAL;
- }
-};
-
-//-----------------------------------------------------------------------------
-// wxSuffixMap
-//-----------------------------------------------------------------------------
-
-class wxSuffixMap
-{
-public:
- ~wxSuffixMap();
-
- inline char *GetName(int weight, int style)
- {
- return ( map [WCoordinate(weight)] [SCoordinate(style)] );
- }
-
- char *map[wxNUM_WEIGHTS][wxNUM_STYLES];
- void Initialize(const char *, const char *);
-};
-
-static void SearchResource(const char *prefix, const char **names, int count, char **v)
-{
- int k, i, j;
- char resource[1024], **defaults, *internal;
-
- k = 1 << count;
-
- *v = (char *) NULL;
- internal = (char *) NULL;
-
- for (i = 0; i < k; i++)
- {
- strcpy(resource, prefix);
- for (j = 0; j < count; j++)
- {
- // upon failure to find a matching fontname
- // in the default fonts above, we substitute more
- // and more values by _ so that at last ScreenMyFontBoldNormal
- // would turn into Screen___ and this will then get
- // converted to -${ScreenDefaultBase}${ScreenStdSuffix}
-
- if (!(i & (1 << j)))
- strcat(resource, names[j]);
- else
- strcat(resource, "_");
- }
-
- // we previously search the Xt-resources here
-
- if (!internal)
- {
- defaults = font_defaults;
- while (*defaults)
- {
- if (!strcmp(*defaults, resource))
- {
- internal = defaults[1];
- break;
- }
- defaults += 2;
- }
- }
- }
-
- if (internal)
- {
- if ((strcmp(internal,"-${ScreenDefaultBase}${ScreenStdSuffix}") == 0) &&
- (strcmp(names[0], "Default") != 0))
- {
- // we did not find any font name in the standard list.
- // this can (hopefully does) mean that someone supplied
- // the facename in the wxFont constructor so we insert
- // it here
-
- strcpy( resource,"-*-" ); // any producer
- strcat( resource, names[0] ); // facename
- strcat( resource, "${ScreenStdSuffix}" ); // add size params later on
- *v = copystring(resource);
- }
- else
- {
- *v = copystring(internal);
- }
- }