Changeset 4583015 in mainline for uspace/lib/ui/src/entry.c


Ignore:
Timestamp:
2022-03-07T16:10:44Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ca2680d
Parents:
5c27e77
Message:

Add font to gfx_text_fmt_t

This is quite logical and saves us one argument that we need to pass to
all text formatting functions.

File:
1 edited

Legend:

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

    r5c27e77 r4583015  
    314314
    315315        gfx_text_fmt_init(&fmt);
     316        fmt.font = res->font;
    316317        fmt.color = res->entry_fg_color;
    317318        fmt.halign = gfx_halign_left;
     
    329330        entry->text[off1] = '\0';
    330331
    331         rc = gfx_puttext(res->font, &pos, &fmt, entry->text);
     332        rc = gfx_puttext(&pos, &fmt, entry->text);
    332333        if (rc != EOK) {
    333334                (void) gfx_set_clip_rect(res->gc, NULL);
     
    335336        }
    336337
    337         gfx_text_cont(res->font, &pos, &fmt, entry->text, &cpos, &cfmt);
     338        gfx_text_cont(&pos, &fmt, entry->text, &cpos, &cfmt);
    338339        entry->text[off1] = c;
    339340
     
    345346                cfmt.color = res->entry_sel_text_fg_color;
    346347
    347                 gfx_text_rect(res->font, &cpos, &cfmt, entry->text + off1, &sel);
     348                gfx_text_rect(&cpos, &cfmt, entry->text + off1, &sel);
    348349                sel.p0.x -= ui_entry_sel_hpad;
    349350                sel.p0.y -= ui_entry_sel_vpad;
     
    359360                        goto error;
    360361
    361                 rc = gfx_puttext(res->font, &cpos, &cfmt, entry->text + off1);
     362                rc = gfx_puttext(&cpos, &cfmt, entry->text + off1);
    362363                if (rc != EOK) {
    363364                        (void) gfx_set_clip_rect(res->gc, NULL);
     
    365366                }
    366367
    367                 gfx_text_cont(res->font, &cpos, &cfmt, entry->text + off1,
    368                     &cpos, &cfmt);
     368                gfx_text_cont(&cpos, &cfmt, entry->text + off1, &cpos, &cfmt);
    369369
    370370                entry->text[off2] = c;
     
    374374        cfmt.color = res->entry_fg_color;
    375375
    376         rc = gfx_puttext(res->font, &cpos, &cfmt, entry->text + off2);
     376        rc = gfx_puttext(&cpos, &cfmt, entry->text + off2);
    377377        if (rc != EOK) {
    378378                (void) gfx_set_clip_rect(res->gc, NULL);
     
    421421
    422422        gfx_text_fmt_init(&fmt);
     423        fmt.font = res->font;
    423424        fmt.halign = gfx_halign_left;
    424425        fmt.valign = gfx_valign_top;
    425426
    426         return gfx_text_find_pos(res->font, &geom.text_pos, &fmt,
    427             entry->text, fpos);
     427        return gfx_text_find_pos(&geom.text_pos, &fmt, entry->text, fpos);
    428428}
    429429
     
    11111111                anchor.y = 0;
    11121112                gfx_text_fmt_init(&fmt);
     1113                fmt.font = res->font;
    11131114                fmt.halign = entry->halign;
    1114                 gfx_text_start_pos(res->font, &anchor, &fmt, entry->text,
    1115                     &tpos);
     1115                gfx_text_start_pos(&anchor, &fmt, entry->text, &tpos);
    11161116                entry->scroll_pos = tpos.x - geom.text_rect.p0.x;
    11171117        } else if (geom.text_pos.x + width < geom.text_rect.p1.x &&
Note: See TracChangeset for help on using the changeset viewer.