Changes in uspace/app/fontedit/fontedit.c [211fd68:266ec54] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/fontedit/fontedit.c
r211fd68 r266ec54 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 167 167 } 168 168 169 /** Adjust font underline Y0.170 *171 * @param fedit Font editor172 */173 static void font_edit_adjust_underline_y0(font_edit_t *fedit,174 gfx_coord_t change)175 {176 gfx_font_metrics_t fmetrics;177 178 gfx_font_get_metrics(fedit->font, &fmetrics);179 fmetrics.underline_y0 += change;180 (void) gfx_font_set_metrics(fedit->font, &fmetrics);181 182 printf("New underline Y0: %d\n", fmetrics.underline_y0);183 font_edit_paint(fedit);184 }185 186 /** Adjust font underline Y1.187 *188 * @param fedit Font editor189 */190 static void font_edit_adjust_underline_y1(font_edit_t *fedit,191 gfx_coord_t change)192 {193 gfx_font_metrics_t fmetrics;194 195 gfx_font_get_metrics(fedit->font, &fmetrics);196 fmetrics.underline_y1 += change;197 (void) gfx_font_set_metrics(fedit->font, &fmetrics);198 199 printf("New underline Y1: %d\n", fmetrics.underline_y1);200 font_edit_paint(fedit);201 }202 203 169 /** Handle font editor close event. 204 170 * … … 348 314 font_edit_adjust_leading(fedit, +1); 349 315 break; 350 case KC_U:351 font_edit_adjust_underline_y0(fedit, -1);352 break;353 case KC_I:354 font_edit_adjust_underline_y0(fedit, +1);355 break;356 case KC_O:357 font_edit_adjust_underline_y1(fedit, -1);358 break;359 case KC_P:360 font_edit_adjust_underline_y1(fedit, +1);361 break;362 316 case KC_X: 363 317 (void) gfx_glyph_bmp_clear(fedit->gbmp); … … 492 446 * @param fedit Font editor 493 447 * @param x Starting X coordinate 494 * @param y Starting Y coordinate 495 * @param color Color 448 * @Param y Starting Y coordinate 496 449 * @param str String 497 450 */ 498 451 static errno_t font_edit_paint_preview_str(font_edit_t *fedit, 499 gfx_coord_t x, gfx_coord_t y, gfx_color_t *color,const char *str)452 gfx_coord_t x, gfx_coord_t y, const char *str) 500 453 { 501 454 gfx_text_fmt_t fmt; … … 503 456 504 457 gfx_text_fmt_init(&fmt); 505 fmt.font = fedit->font;506 fmt.color = color;507 458 508 459 pos.x = x; 509 460 pos.y = y; 510 461 511 return gfx_puttext( &pos, &fmt, str);462 return gfx_puttext(fedit->font, &pos, &fmt, str); 512 463 } 513 464 … … 529 480 goto error; 530 481 531 rc = font_edit_paint_preview_str(fedit, 20, 20, color,482 rc = font_edit_paint_preview_str(fedit, 20, 20, 532 483 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); 533 484 if (rc != EOK) 534 485 goto error; 535 486 536 rc = font_edit_paint_preview_str(fedit, 20, 40, color,487 rc = font_edit_paint_preview_str(fedit, 20, 40, 537 488 "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG"); 538 489 if (rc != EOK) 539 490 goto error; 540 491 541 rc = font_edit_paint_preview_str(fedit, 20, 60, color,492 rc = font_edit_paint_preview_str(fedit, 20, 60, 542 493 "abcdefghijklmnopqrstuvwxyz"); 543 494 if (rc != EOK) 544 495 goto error; 545 496 546 rc = font_edit_paint_preview_str(fedit, 20, 80, color,497 rc = font_edit_paint_preview_str(fedit, 20, 80, 547 498 "the quick brown fox jumps over the lazy dog"); 548 499 if (rc != EOK) 549 500 goto error; 550 501 551 rc = font_edit_paint_preview_str(fedit, 20, 100, color,502 rc = font_edit_paint_preview_str(fedit, 20, 100, 552 503 "0123456789,./<>?;'\\:\"|[]{}`~!@#$%^&*()-_=+"); 553 504 if (rc != EOK) … … 568 519 gfx_color_t *color = NULL; 569 520 gfx_rect_t rect; 570 gfx_rect_t rect2;571 521 gfx_rect_t grect; 572 522 gfx_font_metrics_t fmetrics; … … 612 562 fmetrics.leading, &rect); 613 563 rect.p1.x += 100; 614 615 rc = gfx_fill_rect(fedit->gc, &rect);616 if (rc != EOK)617 goto error;618 619 gfx_color_delete(color);620 621 /* Display underline */622 623 rc = gfx_color_new_rgb_i16(0x4000, 0x4000, 0, &color);624 if (rc != EOK)625 goto error;626 627 rc = gfx_set_color(fedit->gc, color);628 if (rc != EOK)629 goto error;630 631 font_edit_gpix_to_disp(fedit, 0, fmetrics.underline_y0, &rect);632 font_edit_gpix_to_disp(fedit, 10, fmetrics.underline_y1, &rect2);633 rect.p1 = rect2.p0;634 564 635 565 rc = gfx_fill_rect(fedit->gc, &rect); … … 787 717 * to rect 788 718 */ 789 ui_wdecor_rect_from_app( ui,params.style, &rect, &wrect);719 ui_wdecor_rect_from_app(params.style, &rect, &wrect); 790 720 off = wrect.p0; 791 721 gfx_rect_rtranslate(&off, &wrect, ¶ms.rect);
Note:
See TracChangeset
for help on using the changeset viewer.