-/* This translates the NSFont into the numbers that aglUseFont() wants.
- */
-int
-jwxyz_font_info (Font f, int *size_ret, int *face_ret)
-{
- char *name = strdup (f->ps_name);
- char *dash = strchr (name, '-');
- int flags = 0;
- int size = f->size;
- if (dash) {
- // 0 = plain; 1=B; 2=I; 3=BI; 4=U; 5=UB; etc.
- if (strcasestr (dash, "bold")) flags |= 1;
- if (strcasestr (dash, "italic")) flags |= 2;
- if (strcasestr (dash, "oblique")) flags |= 2;
- *dash = 0;
- }
- NSString *nname = [NSString stringWithCString:name
- encoding:NSUTF8StringEncoding];
- ATSFontFamilyRef id =
- ATSFontFamilyFindFromName ((CFStringRef) nname, kATSOptionFlagsDefault);
-
-
- // WTF? aglUseFont gets a BadValue if size is small!!
- if (size < 9) size = 9;
-
- //NSLog (@"font %s %.1f => %d %d %d", f->ps_name, f->size, id, flags, size);
- Assert (id >= 0, "no ATS font family");
-
- *size_ret = size;
- *face_ret = flags;
- return id;
-}
-
-