Changeset 83b4a13b in mainline
- Timestamp:
- 2020-10-05T10:07:05Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 25f2983b
- Parents:
- 49382384
- git-author:
- Jiri Svoboda <jiri@…> (2020-10-03 10:06:51)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-10-05 10:07:05)
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/fontedit/fontedit.c
r49382384 r83b4a13b 110 110 } 111 111 112 /** Adjust font ascent. 113 * 114 * @param fedit Font editor 115 */ 116 static void font_edit_adjust_ascent(font_edit_t *fedit, gfx_coord_t change) 117 { 118 gfx_font_metrics_t fmetrics; 119 120 gfx_font_get_metrics(fedit->font, &fmetrics); 121 fmetrics.ascent += change; 122 (void) gfx_font_set_metrics(fedit->font, &fmetrics); 123 124 printf("New ascent: %d\n", fmetrics.ascent); 125 font_edit_paint(fedit); 126 } 127 128 /** Adjust font descent. 129 * 130 * @param fedit Font editor 131 */ 132 static void font_edit_adjust_descent(font_edit_t *fedit, gfx_coord_t change) 133 { 134 gfx_font_metrics_t fmetrics; 135 136 gfx_font_get_metrics(fedit->font, &fmetrics); 137 fmetrics.descent += change; 138 (void) gfx_font_set_metrics(fedit->font, &fmetrics); 139 140 printf("New descent: %d\n", fmetrics.descent); 141 font_edit_paint(fedit); 142 } 143 144 /** Adjust font leading. 145 * 146 * @param fedit Font editor 147 */ 148 static void font_edit_adjust_leading(font_edit_t *fedit, gfx_coord_t change) 149 { 150 gfx_font_metrics_t fmetrics; 151 152 gfx_font_get_metrics(fedit->font, &fmetrics); 153 fmetrics.leading += change; 154 (void) gfx_font_set_metrics(fedit->font, &fmetrics); 155 156 printf("New leading: %d\n", fmetrics.leading); 157 font_edit_paint(fedit); 158 } 159 112 160 /** Handle font editor position event. 113 161 * … … 216 264 case KC_4: 217 265 font_edit_adjust_advance(fedit, +1); 266 break; 267 case KC_5: 268 font_edit_adjust_ascent(fedit, -1); 269 break; 270 case KC_6: 271 font_edit_adjust_ascent(fedit, +1); 272 break; 273 case KC_7: 274 font_edit_adjust_descent(fedit, -1); 275 break; 276 case KC_8: 277 font_edit_adjust_descent(fedit, +1); 278 break; 279 case KC_9: 280 font_edit_adjust_leading(fedit, -1); 281 break; 282 case KC_0: 283 font_edit_adjust_leading(fedit, +1); 218 284 break; 219 285 case KC_X: … … 432 498 gfx_rect_t rect; 433 499 gfx_rect_t grect; 500 gfx_font_metrics_t fmetrics; 434 501 gfx_glyph_metrics_t gmetrics; 435 502 errno_t rc; 436 503 int x, y; 437 504 int pix; 505 506 /* Display font baseline, ascent, descent, leading */ 507 508 gfx_font_get_metrics(fedit->font, &fmetrics); 509 510 rc = gfx_color_new_rgb_i16(0, 0x4000, 0x4000, &color); 511 if (rc != EOK) 512 goto error; 513 514 rc = gfx_set_color(fedit->gc, color); 515 if (rc != EOK) 516 goto error; 517 518 font_edit_gpix_to_disp(fedit, 0, 0, &rect); 519 rect.p1.x += 100; 520 521 rc = gfx_fill_rect(fedit->gc, &rect); 522 if (rc != EOK) 523 goto error; 524 525 font_edit_gpix_to_disp(fedit, 0, -fmetrics.ascent, &rect); 526 rect.p1.x += 100; 527 528 rc = gfx_fill_rect(fedit->gc, &rect); 529 if (rc != EOK) 530 goto error; 531 532 font_edit_gpix_to_disp(fedit, 0, fmetrics.descent, &rect); 533 rect.p1.x += 100; 534 535 rc = gfx_fill_rect(fedit->gc, &rect); 536 if (rc != EOK) 537 goto error; 538 539 font_edit_gpix_to_disp(fedit, 0, fmetrics.descent + 540 fmetrics.leading, &rect); 541 rect.p1.x += 100; 542 543 rc = gfx_fill_rect(fedit->gc, &rect); 544 if (rc != EOK) 545 goto error; 546 547 gfx_color_delete(color); 548 549 /* Display glyph */ 438 550 439 551 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color); … … 464 576 465 577 gfx_color_delete(color); 578 466 579 467 580 /* Display glyph origin and advance */
Note:
See TracChangeset
for help on using the changeset viewer.