summaryrefslogtreecommitdiff
path: root/legacy/edje/src/lib/edje_text.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2009-12-09 15:44:54 +0000
committerCedric BAIL <cedric.bail@free.fr>2009-12-09 15:44:54 +0000
commitb32c9a3eae1dcbbb3da84bf760016275784ea9b9 (patch)
tree7a4995ac68e5fe7f27bfe7727599dd2fbd49a488 /legacy/edje/src/lib/edje_text.c
parent63d651b7ada7e49acad5a35b80370385a1a1cbd4 (diff)
* edje: Add Fixed Point Math support to Edje.
You can try it by passing --enable-fixed-point to the configure. It will produce an ABI/API compatible Edje library that use internally Eina_F32p32 instead of double. It will load Eina_F32p32 instead of double from eet file (thanks to eet ability to convert them on the fly), so edje file are compatible between fixed point and floating point version. This patch touch almost all internal calc of Edje, I did test it with elementary_test, enlightenment and all my test apps, but it could certainly break some of your preferred Edje file. If you see any unexpected behaviour please report them to me as soon as possible. Note: For devs, I put few macros in edje_private.h that should now be used when doing calc in Edje, please use them so that Fixed Point doesn't break in the futur. SVN revision: 44323
Diffstat (limited to 'legacy/edje/src/lib/edje_text.c')
-rw-r--r--legacy/edje/src/lib/edje_text.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/legacy/edje/src/lib/edje_text.c b/legacy/edje/src/lib/edje_text.c
index e33cbc8..ea59e16 100644
--- a/legacy/edje/src/lib/edje_text.c
+++ b/legacy/edje/src/lib/edje_text.c
@@ -114,15 +114,15 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
114 char *buf; 114 char *buf;
115 int c1 = -1, c2 = -1, loop = 0, extra; 115 int c1 = -1, c2 = -1, loop = 0, extra;
116 size_t orig_len; 116 size_t orig_len;
117 double sc; 117 FLOAT_T sc;
118 118
119 sc = ed->scale; 119 sc = ed->scale;
120 if (sc == 0.0) sc = _edje_scale; 120 if (sc == ZERO) sc = _edje_scale;
121 121
122 *free_text = 0; 122 *free_text = 0;
123 if (sw <= 1) return ""; 123 if (sw <= 1) return "";
124 124
125 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 125 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
126 evas_object_text_font_set(ep->object, font, size); 126 evas_object_text_font_set(ep->object, font, size);
127 evas_object_text_text_set(ep->object, text); 127 evas_object_text_text_set(ep->object, text);
128 128
@@ -302,7 +302,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
302 Evas_Coord tw, th; 302 Evas_Coord tw, th;
303 Evas_Coord sw, sh; 303 Evas_Coord sw, sh;
304 int inlined_font = 0, free_text = 0; 304 int inlined_font = 0, free_text = 0;
305 double sc; 305 FLOAT_T sc;
306 306
307 sc = ed->scale; 307 sc = ed->scale;
308 if (sc == 0.0) sc = _edje_scale; 308 if (sc == 0.0) sc = _edje_scale;
@@ -389,7 +389,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
389 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 389 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
390 else evas_object_text_font_source_set(ep->object, NULL); 390 else evas_object_text_font_source_set(ep->object, NULL);
391 391
392 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 392 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
393 evas_object_text_font_set(ep->object, font, size); 393 evas_object_text_font_set(ep->object, font, size);
394 evas_object_text_text_set(ep->object, text); 394 evas_object_text_text_set(ep->object, text);
395 part_get_geometry(ep, &tw, &th); 395 part_get_geometry(ep, &tw, &th);
@@ -406,7 +406,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
406 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 406 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
407 else evas_object_text_font_source_set(ep->object, NULL); 407 else evas_object_text_font_source_set(ep->object, NULL);
408 408
409 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 409 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
410 evas_object_text_font_set(ep->object, font, size); 410 evas_object_text_font_set(ep->object, font, size);
411 part_get_geometry(ep, &tw, &th); 411 part_get_geometry(ep, &tw, &th);
412 if ((size > 0) && (tw == 0)) break; 412 if ((size > 0) && (tw == 0)) break;
@@ -425,7 +425,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
425 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 425 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
426 else evas_object_text_font_source_set(ep->object, NULL); 426 else evas_object_text_font_source_set(ep->object, NULL);
427 427
428 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 428 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
429 evas_object_text_font_set(ep->object, font, size); 429 evas_object_text_font_set(ep->object, font, size);
430 part_get_geometry(ep, &tw, &th); 430 part_get_geometry(ep, &tw, &th);
431 if ((size > 0) && (tw == 0)) break; 431 if ((size > 0) && (tw == 0)) break;
@@ -443,7 +443,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
443 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 443 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
444 else evas_object_text_font_source_set(ep->object, NULL); 444 else evas_object_text_font_source_set(ep->object, NULL);
445 445
446 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 446 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
447 evas_object_text_font_set(ep->object, font, size); 447 evas_object_text_font_set(ep->object, font, size);
448 evas_object_text_text_set(ep->object, text); 448 evas_object_text_text_set(ep->object, text);
449 part_get_geometry(ep, &tw, &th); 449 part_get_geometry(ep, &tw, &th);
@@ -464,7 +464,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
464 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 464 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
465 else evas_object_text_font_source_set(ep->object, NULL); 465 else evas_object_text_font_source_set(ep->object, NULL);
466 466
467 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 467 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
468 evas_object_text_font_set(ep->object, font, size); 468 evas_object_text_font_set(ep->object, font, size);
469 part_get_geometry(ep, &tw, &th); 469 part_get_geometry(ep, &tw, &th);
470 if ((size > 0) && (th == 0)) break; 470 if ((size > 0) && (th == 0)) break;
@@ -475,7 +475,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
475 { 475 {
476 int current; 476 int current;
477 477
478 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 478 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
479 evas_object_text_font_set(ep->object, font, 10); 479 evas_object_text_font_set(ep->object, font, 10);
480 part_get_geometry(ep, &tw, &th); 480 part_get_geometry(ep, &tw, &th);
481 481
@@ -500,7 +500,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
500 { 500 {
501 current = (top + bottom) / 2; 501 current = (top + bottom) / 2;
502 502
503 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 503 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
504 evas_object_text_font_set(ep->object, font, current); 504 evas_object_text_font_set(ep->object, font, current);
505 part_get_geometry(ep, &tw, &th); 505 part_get_geometry(ep, &tw, &th);
506 506
@@ -514,7 +514,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
514 { 514 {
515 current++; 515 current++;
516 516
517 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 517 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
518 evas_object_text_font_set(ep->object, font, current); 518 evas_object_text_font_set(ep->object, font, current);
519 part_get_geometry(ep, &tw, &th); 519 part_get_geometry(ep, &tw, &th);
520 } while (th <= sh); 520 } while (th <= sh);
@@ -546,12 +546,12 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
546 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 546 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
547 else evas_object_text_font_source_set(ep->object, NULL); 547 else evas_object_text_font_source_set(ep->object, NULL);
548 548
549 if (ep->part->scale) evas_object_scale_set(ep->object, sc); 549 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
550 evas_object_text_font_set(ep->object, font, size); 550 evas_object_text_font_set(ep->object, font, size);
551 evas_object_text_text_set(ep->object, text); 551 evas_object_text_text_set(ep->object, text);
552 part_get_geometry(ep, &tw, &th); 552 part_get_geometry(ep, &tw, &th);
553 ep->text.offset.x = ((sw - tw) * params->type.text.align.x); 553 ep->text.offset.x = TO_INT(SCALE(params->type.text.align.x, (sw - tw)));
554 ep->text.offset.y = ((sh - th) * params->type.text.align.y); 554 ep->text.offset.y = TO_INT(SCALE(params->type.text.align.y, (sh - th)));
555 555
556 evas_object_move(ep->object, 556 evas_object_move(ep->object,
557 ed->x + params->x + ep->text.offset.x, 557 ed->x + params->x + ep->text.offset.x,