Changeset 06b8383 in mainline for uspace/lib/gfxfont/test/glyph_bmp.c


Ignore:
Timestamp:
2020-08-18T11:32:59Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20d0098
Parents:
d2100e2
git-author:
Jiri Svoboda <jiri@…> (2020-08-17 18:32:40)
git-committer:
Jiri Svoboda <jiri@…> (2020-08-18 11:32:59)
Message:

Introduce typeface

In other words a font family.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfxfont/test/glyph_bmp.c

    rd2100e2 r06b8383  
    3131#include <gfx/glyph.h>
    3232#include <gfx/glyph_bmp.h>
     33#include <gfx/typeface.h>
    3334#include <pcut/pcut.h>
    3435
     
    7071PCUT_TEST(open_close)
    7172{
     73        gfx_font_props_t fprops;
    7274        gfx_font_metrics_t fmetrics;
     75        gfx_typeface_t *tface;
    7376        gfx_font_t *font;
    7477        gfx_glyph_metrics_t gmetrics;
     
    8285        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    8386
     87        rc = gfx_typeface_create(gc, &tface);
     88        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     89
     90        gfx_font_props_init(&fprops);
    8491        gfx_font_metrics_init(&fmetrics);
    85         rc = gfx_font_create(gc, &fmetrics, &font);
     92        rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
    8693        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    8794
     
    102109        gfx_glyph_destroy(glyph);
    103110
    104         gfx_font_destroy(font);
     111        gfx_font_close(font);
     112        gfx_typeface_destroy(tface);
    105113        rc = gfx_context_delete(gc);
    106114        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     
    110118PCUT_TEST(save)
    111119{
     120        gfx_font_props_t fprops;
    112121        gfx_font_metrics_t fmetrics;
     122        gfx_typeface_t *tface;
    113123        gfx_font_t *font;
    114124        gfx_glyph_metrics_t gmetrics;
     
    123133        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    124134
     135        rc = gfx_typeface_create(gc, &tface);
     136        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     137
     138        gfx_font_props_init(&fprops);
    125139        gfx_font_metrics_init(&fmetrics);
    126         rc = gfx_font_create(gc, &fmetrics, &font);
     140        rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
    127141        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    128142
     
    174188        gfx_glyph_destroy(glyph);
    175189
    176         gfx_font_destroy(font);
     190        gfx_font_close(font);
     191        gfx_typeface_destroy(tface);
    177192        rc = gfx_context_delete(gc);
    178193        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     
    182197PCUT_TEST(getpix)
    183198{
     199        gfx_font_props_t fprops;
    184200        gfx_font_metrics_t fmetrics;
     201        gfx_typeface_t *tface;
    185202        gfx_font_t *font;
    186203        gfx_glyph_metrics_t gmetrics;
     
    195212        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    196213
     214        rc = gfx_typeface_create(gc, &tface);
     215        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     216
     217        gfx_font_props_init(&fprops);
    197218        gfx_font_metrics_init(&fmetrics);
    198         rc = gfx_font_create(gc, &fmetrics, &font);
     219        rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
    199220        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    200221
     
    218239        gfx_glyph_destroy(glyph);
    219240
    220         gfx_font_destroy(font);
     241        gfx_font_close(font);
     242        gfx_typeface_destroy(tface);
    221243        rc = gfx_context_delete(gc);
    222244        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     
    226248PCUT_TEST(setpix_flip)
    227249{
     250        gfx_font_props_t fprops;
    228251        gfx_font_metrics_t fmetrics;
     252        gfx_typeface_t *tface;
    229253        gfx_font_t *font;
    230254        gfx_glyph_metrics_t gmetrics;
     
    239263        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    240264
     265        rc = gfx_typeface_create(gc, &tface);
     266        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     267
     268        gfx_font_props_init(&fprops);
    241269        gfx_font_metrics_init(&fmetrics);
    242         rc = gfx_font_create(gc, &fmetrics, &font);
     270        rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
    243271        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    244272
     
    274302        gfx_glyph_destroy(glyph);
    275303
    276         gfx_font_destroy(font);
     304        gfx_font_close(font);
     305        gfx_typeface_destroy(tface);
    277306        rc = gfx_context_delete(gc);
    278307        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     
    282311PCUT_TEST(setpix_externd)
    283312{
     313        gfx_font_props_t fprops;
    284314        gfx_font_metrics_t fmetrics;
     315        gfx_typeface_t *tface;
    285316        gfx_font_t *font;
    286317        gfx_glyph_metrics_t gmetrics;
     
    296327        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    297328
     329        rc = gfx_typeface_create(gc, &tface);
     330        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     331
     332        gfx_font_props_init(&fprops);
    298333        gfx_font_metrics_init(&fmetrics);
    299         rc = gfx_font_create(gc, &fmetrics, &font);
     334        rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
    300335        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    301336
     
    343378        gfx_glyph_destroy(glyph);
    344379
    345         gfx_font_destroy(font);
     380        gfx_font_close(font);
     381        gfx_typeface_destroy(tface);
    346382        rc = gfx_context_delete(gc);
    347383        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
Note: See TracChangeset for help on using the changeset viewer.