Changeset 400a16d in mainline


Ignore:
Timestamp:
2021-09-03T09:27:57Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
81d3612
Parents:
f7c12b3
git-author:
Jiri Svoboda <jiri@…> (2021-09-02 17:26:05)
git-committer:
Jiri Svoboda <jiri@…> (2021-09-03 09:27:57)
Message:

Clarify right/bottom-aligned text position and fix off-by-ones

Location:
uspace
Files:
4 edited

Legend:

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

    rf7c12b3 r400a16d  
    706706                goto error;
    707707
    708         pos.x = rect.p1.x - 1;
     708        pos.x = rect.p1.x;
    709709        pos.y = rect.p0.y;
    710710        fmt.halign = gfx_halign_right;
     
    729729                goto error;
    730730
    731         pos.x = rect.p1.x - 1;
     731        pos.x = rect.p1.x;
    732732        pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
    733733        fmt.halign = gfx_halign_right;
     
    746746
    747747        pos.x = (rect.p0.x + rect.p1.x - 1) / 2;
    748         pos.y = rect.p1.y - 1;
     748        pos.y = rect.p1.y;
    749749        fmt.halign = gfx_halign_center;
    750750        rc = gfx_puttext(font, &pos, &fmt, "Bottom center");
     
    752752                goto error;
    753753
    754         pos.x = rect.p1.x - 1;
    755         pos.y = rect.p1.y - 1;
     754        pos.x = rect.p1.x;
     755        pos.y = rect.p1.y;
    756756        fmt.halign = gfx_halign_right;
    757757        rc = gfx_puttext(font, &pos, &fmt, "Bottom right");
  • uspace/lib/gfxfont/include/types/gfx/text.h

    rf7c12b3 r400a16d  
    4242/** Text horizontal alignment */
    4343typedef enum {
    44         /** Align text left */
     44        /** Align text left (start at anchor point) */
    4545        gfx_halign_left,
    46         /** Align text on the center */
     46        /** Align text on the center (center around anchor point) */
    4747        gfx_halign_center,
    48         /** Align text right */
     48        /** Align text right (end just before anchor point) */
    4949        gfx_halign_right,
    5050        /** Justify text on both left and right edge */
     
    5454/** Text vertical alignment */
    5555typedef enum {
    56         /** Align top */
     56        /** Align top (starts at anchor point) */
    5757        gfx_valign_top,
    58         /** Align center */
     58        /** Align center (centered around anchor point) */
    5959        gfx_valign_center,
    60         /** Align bottom */
     60        /** Align bottom (end just before anchor point) */
    6161        gfx_valign_bottom,
    6262        /** Align to baseline */
  • uspace/lib/gfxfont/src/text.c

    rf7c12b3 r400a16d  
    191191                        break;
    192192                case gfx_halign_right:
    193                         spos->x -= width - 1;
     193                        spos->x -= width;
    194194                        break;
    195195                default:
     
    210210                        break;
    211211                case gfx_valign_bottom:
    212                         cpos.y -= fmetrics.descent;
     212                        cpos.y -= fmetrics.descent + 1;
    213213                        break;
    214214                default:
  • uspace/lib/ui/src/wdecor.c

    rf7c12b3 r400a16d  
    345345                        geom->title_bar_rect.p0 = geom->interior_rect.p0;
    346346                        geom->title_bar_rect.p1.x = geom->interior_rect.p1.x;
    347                         geom->title_bar_rect.p1.y = geom->interior_rect.p0.y
    348                             + wdecor_tbar_h;
     347                        geom->title_bar_rect.p1.y = geom->interior_rect.p0.y +
     348                            wdecor_tbar_h;
    349349                }
    350350
Note: See TracChangeset for help on using the changeset viewer.