Changeset da15002 in mainline
- Timestamp:
- 2021-05-10T18:41:29Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 344f8b9, d091007
- Parents:
- 8dbd13d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r8dbd13d rda15002 605 605 gfx_color_t *color = NULL; 606 606 gfx_rect_t rect; 607 gfx_typeface_t *tface = NULL;608 gfx_font_info_t *finfo;609 gfx_font_t *font = NULL;610 607 gfx_coord2_t pos; 611 608 gfx_text_fmt_t fmt; … … 615 612 if (quit) 616 613 return EOK; 617 618 /* XXX Crude way of detecting text mode */619 if (w < 256) {620 /* Create dummy font for text mode */621 rc = gfx_typeface_create(gc, &tface);622 if (rc != EOK) {623 printf("Error creating typeface\n");624 goto error;625 }626 627 rc = gfx_font_create_textmode(tface, &font);628 if (rc != EOK) {629 printf("Error creating font\n");630 goto error;631 }632 } else {633 /* Load font */634 rc = gfx_typeface_open(gc, "/data/font/helena.tpf", &tface);635 if (rc != EOK) {636 printf("Error opening typeface\n");637 goto error;638 }639 640 finfo = gfx_typeface_first_font(tface);641 if (finfo == NULL) {642 printf("Typeface contains no font.\n");643 rc = ENOENT;644 goto error;645 }646 647 rc = gfx_font_open(finfo, &font);648 if (rc != EOK) {649 printf("Error opening font.\n");650 goto error;651 }652 }653 614 654 615 rc = demo_begin(gc, w, h, "Text rendering"); … … 801 762 } 802 763 803 gfx_font_close(font);804 gfx_typeface_destroy(tface);805 764 return EOK; 806 765 error: 807 if (font != NULL)808 gfx_font_close(font);809 if (tface != NULL)810 gfx_typeface_destroy(tface);811 766 return rc; 812 767 }
Note:
See TracChangeset
for help on using the changeset viewer.