Changeset 2cc1ec0 in mainline for uspace/lib/gui/label.c


Ignore:
Timestamp:
2014-08-27T21:23:01Z (11 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a9763c6
Parents:
613d644
Message:

Refactor drawing of fonts into multiple layers.

This will need further work to split glyph resolution
process to separate functions in order to support ligatures,
addition of kerning support, separate text layout functions,
etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gui/label.c

    r613d644 r2cc1ec0  
    3838#include <drawctx.h>
    3939#include <surface.h>
     40#include <font/embedded.h>
     41#include <errno.h>
    4042#include "window.h"
    4143#include "label.h"
     
    5860        sysarg_t cpt_width;
    5961        sysarg_t cpt_height;
    60         font_get_box(&lbl->font, lbl->caption, &cpt_width, &cpt_height);
     62        font_get_box(lbl->font, lbl->caption, &cpt_width, &cpt_height);
    6163       
    6264        if ((widget->width >= cpt_width) && (widget->height >= cpt_height)) {
     
    6567               
    6668                drawctx_set_source(&drawctx, &lbl->text);
    67                 drawctx_set_font(&drawctx, &lbl->font);
     69                drawctx_set_font(&drawctx, lbl->font);
    6870               
    6971                if (lbl->caption)
     
    8486                sysarg_t cpt_width;
    8587                sysarg_t cpt_height;
    86                 font_get_box(&lbl->font, lbl->caption, &cpt_width, &cpt_height);
     88                font_get_box(lbl->font, lbl->caption, &cpt_width, &cpt_height);
    8789               
    8890                lbl->widget.width_min = cpt_width + 4;
     
    99101        widget_deinit(&lbl->widget);
    100102        free(lbl->caption);
    101         font_release(&lbl->font);
     103        font_release(lbl->font);
    102104}
    103105
     
    161163                lbl->caption = str_dup(caption);
    162164       
    163         font_init(&lbl->font, FONT_DECODER_EMBEDDED, NULL, points);
     165        int rc = embedded_font_create(&lbl->font, points);
     166        if (rc != EOK) {
     167                free(lbl->caption);
     168                lbl->caption = NULL;
     169                return false;
     170        }
    164171       
    165172        sysarg_t cpt_width;
    166173        sysarg_t cpt_height;
    167         font_get_box(&lbl->font, lbl->caption, &cpt_width, &cpt_height);
     174        font_get_box(lbl->font, lbl->caption, &cpt_width, &cpt_height);
    168175       
    169176        lbl->widget.width_min = cpt_width + 4;
Note: See TracChangeset for help on using the changeset viewer.