Changeset d884672 in mainline for uspace/lib/gfxfont/src/glyph.c


Ignore:
Timestamp:
2020-09-30T20:26:24Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c9748a4
Parents:
38a4b6d
Message:

Need to set rectangle/origin for new glyph

Otherwise, having unsaved glyphs would lead to corruption once another
glyph is created, edited and saved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfxfont/src/glyph.c

    r38a4b6d rd884672  
    3838#include <errno.h>
    3939#include <gfx/bitmap.h>
     40#include <gfx/font.h>
    4041#include <gfx/glyph.h>
    4142#include <io/pixelmap.h>
     
    7374{
    7475        gfx_glyph_t *glyph;
     76        gfx_glyph_t *last;
    7577        errno_t rc;
    7678
     
    8890        }
    8991
     92        last = gfx_font_last_glyph(font);
     93
    9094        glyph->metrics = *metrics;
    9195        list_append(&glyph->lglyphs, &glyph->font->glyphs);
    9296        list_initialize(&glyph->patterns);
     97
     98        if (last != NULL)
     99                glyph->rect.p0.x = last->rect.p1.x;
     100        else
     101                glyph->rect.p0.x = 0;
     102
     103        glyph->rect.p0.y = 0;
     104        glyph->rect.p1.x = glyph->rect.p0.x;
     105        glyph->rect.p1.y = glyph->rect.p1.y;
     106
     107        glyph->origin.x = glyph->rect.p0.x;
     108        glyph->origin.y = glyph->rect.p0.y;
     109
    93110        *rglyph = glyph;
    94111        return EOK;
Note: See TracChangeset for help on using the changeset viewer.