/* * listfonts - list installed fonts * (c) 2004, François Revol, revol@free.fr * released under the MIT licence. * compile with: make listfonts LDFLAGS=-lbe */ #include #include #include int32 th(void *arg) { be_app->Lock(); be_app->Run(); } int main(int argc, char **argv) { int32 family_count, f; font_family family; int32 style_count, s; font_style style; uint16 face; uint32 flags; BApplication app("application/x-vnd.mmu_man.listfonts"); resume_thread(spawn_thread(th, "be_app", B_NORMAL_PRIORITY, NULL)); be_app->Unlock(); family_count = count_font_families(); for (f = 0; f < family_count; f++) { if (get_font_family(f, &family) < B_OK) continue; //printf("%s\n", family); style_count = count_font_styles(family); for (s = 0; s < style_count; s++) { if (get_font_style(family, s, &style, &face, &flags) < B_OK) continue; printf("\t%s/%s\t", family, style); BFont f; f.SetFamilyAndStyle(family, style); //f.PrintToStream(); printf("\tface=%08lx ", face); printf("\t%s", (flags & B_IS_FIXED)?"fixed ":""); #ifndef B_BEOS_VERSION_DANO /* seems R5 is broken there :-( locks up on 'a> recv' */ printf("\t%s", (flags & B_HAS_TUNED_FONT)?"hastuned ":""); #else if (flags & B_HAS_TUNED_FONT) { int32 i; int32 tunedcount = f.CountTuned(); printf("%d tuned: ", tunedcount); //puts(""); #if 1 for (i = 0; i < tunedcount; i++) { tuned_font_info tfi; f.GetTunedInfo(i, &tfi); printf("{%f, %f, %f, %08lx, %x} ", tfi.size, tfi.shear, tfi.rotation, tfi.flags, tfi.face); //puts(""); } #endif } #endif //printf("\tFlags=%08lx ", f.Flags()); printf("\tspacing=%d ", f.Spacing()); printf("\tencoding=%d ", f.Encoding()); puts(""); } } be_app->Lock(); be_app->Quit(); return 0; }