Changeset 38a4b6d in mainline


Ignore:
Timestamp:
2020-09-30T19:46:07Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d884672
Parents:
7358f5b
Message:

Preview more characters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/fontedit/fontedit.c

    r7358f5b r38a4b6d  
    5353        glyph_scale = 8,
    5454        glyph_orig_x = 100,
    55         glyph_orig_y = 100
     55        glyph_orig_y = 200
    5656};
    5757
     
    346346}
    347347
    348 /** Paint font preview.
     348/** Paint font preview string.
    349349 *
    350350 * @param fedit Font editor
    351  */
    352 static errno_t font_edit_paint_preview(font_edit_t *fedit)
     351 * @param x Starting X coordinate
     352 * @Param y Starting Y coordinate
     353 * @param str String
     354 */
     355static errno_t font_edit_paint_preview_str(font_edit_t *fedit,
     356    gfx_coord_t x, gfx_coord_t y, const char *str)
    353357{
    354358        gfx_glyph_metrics_t gmetrics;
    355359        size_t stradv;
    356360        const char *cp;
     361        gfx_coord2_t pos;
    357362        gfx_glyph_t *glyph;
    358         gfx_coord2_t pos;
    359         errno_t rc;
    360 
    361         cp = "ABCD";
    362         pos.x = 20;
    363         pos.y = 20;
     363        errno_t rc;
     364
     365        pos.x = x;
     366        pos.y = y;
     367        cp = str;
    364368
    365369        while (*cp != '\0') {
     
    379383                pos.x += gmetrics.advance;
    380384        }
     385
     386        return EOK;
     387}
     388
     389/** Paint font preview.
     390 *
     391 * @param fedit Font editor
     392 */
     393static errno_t font_edit_paint_preview(font_edit_t *fedit)
     394{
     395        errno_t rc;
     396
     397        rc = font_edit_paint_preview_str(fedit, 20, 20,
     398            "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
     399        if (rc != EOK)
     400                return rc;
     401
     402        rc = font_edit_paint_preview_str(fedit, 20, 40,
     403            "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG");
     404        if (rc != EOK)
     405                return rc;
     406
     407        rc = font_edit_paint_preview_str(fedit, 20, 60,
     408            "abcdefghijklmnopqrstuvwxyz");
     409        if (rc != EOK)
     410                return rc;
     411
     412        rc = font_edit_paint_preview_str(fedit, 20, 80,
     413            "the quick brown fox jumps over the lazy dog");
     414        if (rc != EOK)
     415                return rc;
    381416
    382417        return EOK;
Note: See TracChangeset for help on using the changeset viewer.