Changeset 6a87f28 in mainline for uspace/lib/gfxfont/src/font.c


Ignore:
Timestamp:
2021-02-25T16:48:13Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bac8acab
Parents:
26853ebc
Message:

First attempt at printing text in text-mode via GFX

File:
1 edited

Legend:

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

    r26853ebc r6a87f28  
    180180}
    181181
     182/** Create dummy font for printing text in text mode.
     183 *
     184 * @param tface Typeface
     185 * @param rfont Place to store pointer to new font
     186 *
     187 * @return EOK on success, EINVAL if parameters are invald,
     188 *         ENOMEM if insufficient resources, EIO if graphic device connection
     189 *         was lost
     190 */
     191errno_t gfx_font_create_textmode(gfx_typeface_t *tface, gfx_font_t **rfont)
     192{
     193        gfx_font_props_t props;
     194        gfx_font_metrics_t metrics;
     195
     196        gfx_font_props_init(&props);
     197        props.size = 1;
     198        props.flags = gff_text_mode;
     199
     200        gfx_font_metrics_init(&metrics);
     201        metrics.ascent = 0;
     202        metrics.descent = 0;
     203        metrics.leading = 1;
     204
     205        return gfx_font_create(tface, &props, &metrics, rfont);
     206}
     207
    182208/** Open font.
    183209 *
     
    229255void gfx_font_get_metrics(gfx_font_t *font, gfx_font_metrics_t *metrics)
    230256{
    231         *metrics = font->metrics;
     257        if (font != NULL) {
     258                *metrics = font->metrics;
     259        } else {
     260                metrics->ascent = 0;
     261                metrics->descent = 0;
     262                metrics->leading = 1;
     263        }
    232264}
    233265
Note: See TracChangeset for help on using the changeset viewer.