Changeset 8bf9058 in mainline
- Timestamp:
- 2020-10-06T18:57:04Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0d62c10
- Parents:
- 74f59b7
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r74f59b7 r8bf9058 502 502 503 503 rect.p0.x = w / 20; 504 rect.p0.y = 3* h / 15;504 rect.p0.y = 2 * h / 15; 505 505 rect.p1.x = w - w / 20; 506 506 rect.p1.y = 5 * h / 15; … … 530 530 } 531 531 532 pos.x = (rect.p0.x + rect.p1.x ) / 2;532 pos.x = (rect.p0.x + rect.p1.x - 1) / 2; 533 533 pos.y = rect.p0.y; 534 534 fmt.halign = gfx_halign_center; … … 537 537 goto error; 538 538 539 pos.x = rect.p1.x ;539 pos.x = rect.p1.x - 1; 540 540 pos.y = rect.p0.y; 541 541 fmt.halign = gfx_halign_right; … … 547 547 548 548 pos.x = rect.p0.x; 549 pos.y = (rect.p0.y + rect.p1.y ) / 2;549 pos.y = (rect.p0.y + rect.p1.y - 1) / 2; 550 550 fmt.halign = gfx_halign_left; 551 551 rc = gfx_puttext(font, &pos, &fmt, "Center left"); … … 553 553 goto error; 554 554 555 pos.x = (rect.p0.x + rect.p1.x ) / 2;556 pos.y = (rect.p0.y + rect.p1.y ) / 2;555 pos.x = (rect.p0.x + rect.p1.x - 1) / 2; 556 pos.y = (rect.p0.y + rect.p1.y - 1) / 2; 557 557 fmt.halign = gfx_halign_center; 558 558 rc = gfx_puttext(font, &pos, &fmt, "Center"); … … 560 560 goto error; 561 561 562 pos.x = rect.p1.x ;563 pos.y = (rect.p0.y + rect.p1.y ) / 2;562 pos.x = rect.p1.x - 1; 563 pos.y = (rect.p0.y + rect.p1.y - 1) / 2; 564 564 fmt.halign = gfx_halign_right; 565 565 rc = gfx_puttext(font, &pos, &fmt, "Center right"); … … 570 570 571 571 pos.x = rect.p0.x; 572 pos.y = rect.p1.y ;572 pos.y = rect.p1.y - 1; 573 573 fmt.halign = gfx_halign_left; 574 574 rc = gfx_puttext(font, &pos, &fmt, "Bottom left"); … … 576 576 goto error; 577 577 578 pos.x = (rect.p0.x + rect.p1.x ) / 2;579 pos.y = rect.p1.y ;578 pos.x = (rect.p0.x + rect.p1.x - 1) / 2; 579 pos.y = rect.p1.y - 1; 580 580 fmt.halign = gfx_halign_center; 581 581 rc = gfx_puttext(font, &pos, &fmt, "Bottom center"); … … 583 583 goto error; 584 584 585 pos.x = rect.p1.x ;586 pos.y = rect.p1.y ;585 pos.x = rect.p1.x - 1; 586 pos.y = rect.p1.y - 1; 587 587 fmt.halign = gfx_halign_right; 588 588 rc = gfx_puttext(font, &pos, &fmt, "Bottom right"); -
uspace/lib/gfxfont/include/types/gfx/text.h
r74f59b7 r8bf9058 58 58 gfx_valign_center, 59 59 /** Align bottom */ 60 gfx_valign_bottom 60 gfx_valign_bottom, 61 /** Align to baseline */ 62 gfx_valign_baseline 61 63 } gfx_valign_t; 62 64 -
uspace/lib/gfxfont/src/text.c
r74f59b7 r8bf9058 123 123 124 124 /* Adjust position for vertical alignment */ 125 if (fmt->valign != gfx_valign_bottom) { 126 gfx_font_get_metrics(font, &fmetrics); 125 gfx_font_get_metrics(font, &fmetrics); 127 126 127 if (fmt->valign != gfx_valign_baseline) { 128 128 switch (fmt->valign) { 129 129 case gfx_valign_top: … … 133 133 cpos.y += fmetrics.ascent / 2; 134 134 break; 135 case gfx_valign_bottom: 136 cpos.y -= fmetrics.descent; 137 break; 135 138 default: 136 139 break;
Note:
See TracChangeset
for help on using the changeset viewer.