Changeset 9c7dc8e in mainline for uspace/lib/ui/src/resource.c


Ignore:
Timestamp:
2021-03-01T10:50:25Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cd74fa8
Parents:
77ffa01
git-author:
Jiri Svoboda <jiri@…> (2021-02-28 10:50:05)
git-committer:
Jiri Svoboda <jiri@…> (2021-03-01 10:50:25)
Message:

Print text as text in textmode UI. Make calculator smaller in text mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/resource.c

    r77ffa01 r9c7dc8e  
    5050 *
    5151 * @param gc Graphic context
     52 * @param textmode @c true if running in text mode
    5253 * @param rresource Place to store pointer to new UI resource
    5354 * @return EOK on success, ENOMEM if out of memory
    5455 */
    55 errno_t ui_resource_create(gfx_context_t *gc, ui_resource_t **rresource)
     56errno_t ui_resource_create(gfx_context_t *gc, bool textmode,
     57    ui_resource_t **rresource)
    5658{
    5759        ui_resource_t *resource;
     
    8385                return ENOMEM;
    8486
    85         rc = gfx_typeface_open(gc, ui_typeface_path, &tface);
    86         if (rc != EOK)
    87                 goto error;
    88 
    89         finfo = gfx_typeface_first_font(tface);
    90         if (finfo == NULL) {
    91                 rc = EIO;
    92                 goto error;
     87        if (textmode) {
     88                /* Create dummy font for text mode */
     89                rc = gfx_typeface_create(gc, &tface);
     90                if (rc != EOK)
     91                        goto error;
     92
     93                rc = gfx_font_create_textmode(tface, &font);
     94                if (rc != EOK)
     95                        goto error;
     96        } else {
     97                rc = gfx_typeface_open(gc, ui_typeface_path, &tface);
     98                if (rc != EOK)
     99                        goto error;
     100
     101                finfo = gfx_typeface_first_font(tface);
     102                if (finfo == NULL) {
     103                        rc = EIO;
     104                        goto error;
     105                }
     106
     107                rc = gfx_font_open(finfo, &font);
     108                if (rc != EOK)
     109                        goto error;
    93110        }
    94 
    95         rc = gfx_font_open(finfo, &font);
    96         if (rc != EOK)
    97                 goto error;
    98111
    99112        rc = gfx_color_new_rgb_i16(0, 0, 0, &btn_frame_color);
     
    177190        resource->tface = tface;
    178191        resource->font = font;
     192        resource->textmode = textmode;
    179193
    180194        resource->btn_frame_color = btn_frame_color;
Note: See TracChangeset for help on using the changeset viewer.