MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / FontView

Function FontView

legacy/FontEditor/FontCreate.cpp:521–587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521void FontView(const char *fnt_file_name) {
522 tFontTemplate ft;
523 int new_font_handle;
524
525 new_font_handle = grfont_Load((char *)fnt_file_name);
526 if (new_font_handle < 0) {
527 Error("Couldn't load font %s.", fnt_file_name);
528 }
529 grfont_LoadTemplate((char *)fnt_file_name, &ft);
530
531 ddio_KeyFlush();
532 // print out stats.
533 while (1) {
534 int x, y, i;
535
536 FontDoIO();
537
538 if (ddio_KeyInKey() == KEY_ENTER) {
539 break;
540 }
541
542 rend_StartFrame(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
543 grtext_SetParameters(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
544 grtext_SetFont(System_font_handle);
545 grtext_SetColor(GR_WHITE);
546 rend_ClearScreen(GR_BLACK);
547
548 grtext_Printf(0, 12, "Font:\2\65 %s", fnt_file_name);
549 grtext_Printf(0, 28, "Type:\2\65 %s, %s, %s", (ft.monochromatic ? "MONO" : "COLOR"),
550 (ft.proportional ? "PROPORTIONAL" : "FIXED WIDTH"), (ft.newstyle ? "4444" : "1555"));
551 grtext_Printf(0, 40, "Ascii:\2\65 %d to %d", ft.min_ascii, ft.max_ascii);
552 grtext_Printf(0, 52, "Maxwidth:\2\65 %d", ft.ch_maxwidth);
553 grtext_Printf(0, 64, "Maxheight:\2\65 %d", ft.ch_height);
554
555 if (ft.ffi2) {
556 grtext_Printf(0, 76, "Tracking:\2\65 %d", (int)ft.ch_tracking);
557 }
558
559 grtext_Printf(0, FIXED_SCREEN_HEIGHT - 20, "Press ENTER to quit.");
560
561 // spew new font.
562 x = 10;
563 y = 120;
564 grtext_SetFont(new_font_handle);
565
566 for (i = ft.min_ascii; i <= ft.max_ascii; i++) {
567 char str[2];
568 str[0] = i;
569 str[1] = 0;
570
571 if ((x + grfont_GetCharWidth(new_font_handle, i)) > FIXED_SCREEN_WIDTH) {
572 x = 10;
573 y += grfont_GetHeight(new_font_handle) + 1;
574 }
575
576 grtext_Puts(x, y, str);
577 x += grfont_GetCharWidth(new_font_handle, i) + 1;
578 }

Callers 1

WinMainFunction · 0.85

Calls 15

grfont_LoadFunction · 0.85
ErrorFunction · 0.85
grfont_LoadTemplateFunction · 0.85
ddio_KeyFlushFunction · 0.85
FontDoIOFunction · 0.85
ddio_KeyInKeyFunction · 0.85
grtext_SetParametersFunction · 0.85
grtext_SetFontFunction · 0.85
grtext_SetColorFunction · 0.85
grtext_PrintfFunction · 0.85
grfont_GetCharWidthFunction · 0.85
grfont_GetHeightFunction · 0.85

Tested by

no test coverage detected