summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_font_main.c
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2015-03-19 19:02:02 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-03-19 19:02:03 +0900
commite197f8804f9a2bded1f7a0e5bccf5fb33c415d77 (patch)
tree72640ffb0fcc3b80a6addc7190bb7d503521cb31 /src/lib/evas/common/evas_font_main.c
parent6616d11619796eb94755ac62f193dc4ec17c2b48 (diff)
evas: Support bitmap embedded color font.
Summary: Add the code for getting bitmap buffers from embedded color font, And draw the bitmap buffers as images. For drawing the bitmap buffers as images, evas_common_draw_context_font_ext_set internal API is changed to pass additional gl engine functions. T2139 @feature Test Plan: 1. Set a bitmap embedded color font to textblock. 2. Set a unicode emoticon text. 3. See the result. Please check the sample unicode in the following link. http://www.fileformat.info/info/unicode/char/1f3af/index.htm http://www.fileformat.info/info/unicode/char/1f555/index.htm http://www.fileformat.info/info/unicode/char/2600/index.htm http://www.fileformat.info/info/unicode/char/263a/index.htm Reviewers: tasn, woohyun, jpeg, raster Reviewed By: raster Subscribers: herdsman, cedric Differential Revision: https://phab.enlightenment.org/D2084
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_font_main.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/lib/evas/common/evas_font_main.c b/src/lib/evas/common/evas_font_main.c
index 97961d002c..7562d28a88 100644
--- a/src/lib/evas/common/evas_font_main.c
+++ b/src/lib/evas/common/evas_font_main.c
@@ -371,6 +371,12 @@ _glyph_free(RGBA_Font_Glyph *fg)
371 371
372 if (fg->glyph_out) 372 if (fg->glyph_out)
373 { 373 {
374 if ((!fg->glyph_out->rle) && (!fg->glyph_out->bitmap.rle_alloc))
375 {
376 FT_BitmapGlyph fbg = (FT_BitmapGlyph)fg->glyph;
377 FT_Bitmap_Done(evas_ft_lib, &(fbg->bitmap));
378 }
379
374 if ((fg->glyph_out->rle) && (fg->glyph_out->bitmap.rle_alloc)) 380 if ((fg->glyph_out->rle) && (fg->glyph_out->bitmap.rle_alloc))
375 free(fg->glyph_out->rle); 381 free(fg->glyph_out->rle);
376 fg->glyph_out->rle = NULL; 382 fg->glyph_out->rle = NULL;
@@ -501,8 +507,10 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx)
501 evas_common_font_int_reload(fi); 507 evas_common_font_int_reload(fi);
502 FTLOCK(); 508 FTLOCK();
503 error = FT_Load_Glyph(fi->src->ft.face, idx, 509 error = FT_Load_Glyph(fi->src->ft.face, idx,
504 FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP | 510 (FT_HAS_COLOR(fi->src->ft.face) ?
505 hintflags[fi->hinting]); 511 (FT_LOAD_COLOR | hintflags[fi->hinting]) :
512 (FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP | hintflags[fi->hinting])));
513
506 FTUNLOCK(); 514 FTUNLOCK();
507 if (error) 515 if (error)
508 { 516 {
@@ -617,16 +625,25 @@ evas_common_font_int_cache_glyph_render(RGBA_Font_Glyph *fg)
617 fi->usage += size; 625 fi->usage += size;
618 if (fi->inuse) evas_common_font_int_use_increase(size); 626 if (fi->inuse) evas_common_font_int_use_increase(size);
619 627
620 fg->glyph_out->rle = evas_common_font_glyph_compress 628 if (!FT_HAS_COLOR(fi->src->ft.face))
621 (fbg->bitmap.buffer, fbg->bitmap.num_grays, fbg->bitmap.pixel_mode, 629 {
622 fbg->bitmap.pitch, fbg->bitmap.width, fbg->bitmap.rows, 630 fg->glyph_out->rle = evas_common_font_glyph_compress
623 &(fg->glyph_out->rle_size)); 631 (fbg->bitmap.buffer, fbg->bitmap.num_grays, fbg->bitmap.pixel_mode,
632 fbg->bitmap.pitch, fbg->bitmap.width, fbg->bitmap.rows,
633 &(fg->glyph_out->rle_size));
634 fg->glyph_out->bitmap.rle_alloc = EINA_TRUE;
624 635
625 fg->glyph_out->bitmap.buffer = NULL; 636 fg->glyph_out->bitmap.buffer = NULL;
626 637
627 // this may be technically incorrect as we go and free a bitmap buffer 638 // this may be technically incorrect as we go and free a bitmap buffer
628 // behind the ftglyph's back... 639 // behind the ftglyph's back...
629 FT_Bitmap_Done(evas_ft_lib, &(fbg->bitmap)); 640 FT_Bitmap_Done(evas_ft_lib, &(fbg->bitmap));
641 }
642 else
643 {
644 fg->glyph_out->rle = NULL;
645 fg->glyph_out->bitmap.rle_alloc = EINA_FALSE;
646 }
630 647
631 return EINA_TRUE; 648 return EINA_TRUE;
632} 649}