summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_font_main.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-05-10 17:44:30 +0100
committerTom Hacohen <tom@stosb.com>2013-05-10 17:48:26 +0100
commitcc4cf7786595710b5c53a80dd61bc632cf682ac5 (patch)
treeb8979cc12220bba087f067eb683e5ba5c9b3fff5 /src/lib/evas/common/evas_font_main.c
parent7d5583530e8a7f72f44d2d2dd476ea3ce0ee5666 (diff)
Evas font/text: Fixed an issue with asc/desc calculation in text object.
Added font_int asc/desc getters in order to achieve that. Thanks to MinSu Seo for reporting.
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_font_main.c73
1 files changed, 32 insertions, 41 deletions
diff --git a/src/lib/evas/common/evas_font_main.c b/src/lib/evas/common/evas_font_main.c
index ef1fb2b0c9..43d467c0b9 100644
--- a/src/lib/evas/common/evas_font_main.c
+++ b/src/lib/evas/common/evas_font_main.c
@@ -73,36 +73,9 @@ evas_common_font_font_all_unload(void)
73} 73}
74 74
75EAPI int 75EAPI int
76evas_common_font_ascent_get(RGBA_Font *fn) 76evas_common_font_instance_ascent_get(RGBA_Font_Int *fi)
77{ 77{
78 int val; 78 int val;
79 RGBA_Font_Int *fi;
80
81// evas_common_font_size_use(fn);
82#if 0
83 {
84 Eina_List *l;
85
86 EINA_LIST_FOREACH(fn->fonts, l, fi)
87 {
88 if (!fi->src->ft.face) continue;
89 if (fi->src->current_size != fi->size)
90 {
91 FTLOCK();
92 FT_Activate_Size(fi->ft.size);
93 FTUNLOCK();
94 fi->src->current_size = fi->size;
95 }
96 val = (int)fi->src->ft.face->size->metrics.ascender;
97 if (fi->src->ft.face->units_per_EM == 0)
98 return val;
99 dv = (fi->src->ft.orig_upem * 2048) / fi->src->ft.face->units_per_EM;
100 ret = (val * fi->src->ft.face->size->metrics.y_scale) / (dv * dv);
101 printf(" ==== %p: %i\n", fi, ret);
102 }
103 }
104#endif
105 fi = fn->fonts->data;
106 evas_common_font_int_reload(fi); 79 evas_common_font_int_reload(fi);
107 if (fi->src->current_size != fi->size) 80 if (fi->src->current_size != fi->size)
108 { 81 {
@@ -126,13 +99,9 @@ evas_common_font_ascent_get(RGBA_Font *fn)
126} 99}
127 100
128EAPI int 101EAPI int
129evas_common_font_descent_get(RGBA_Font *fn) 102evas_common_font_instance_descent_get(RGBA_Font_Int *fi)
130{ 103{
131 int val; 104 int val;
132 RGBA_Font_Int *fi;
133
134// evas_common_font_size_use(fn);
135 fi = fn->fonts->data;
136 evas_common_font_int_reload(fi); 105 evas_common_font_int_reload(fi);
137 if (fi->src->current_size != fi->size) 106 if (fi->src->current_size != fi->size)
138 { 107 {
@@ -151,14 +120,11 @@ evas_common_font_descent_get(RGBA_Font *fn)
151} 120}
152 121
153EAPI int 122EAPI int
154evas_common_font_max_ascent_get(RGBA_Font *fn) 123evas_common_font_instance_max_ascent_get(RGBA_Font_Int *fi)
155{ 124{
156 int val, dv; 125 int val, dv;
157 int ret; 126 int ret;
158 RGBA_Font_Int *fi;
159 127
160// evas_common_font_size_use(fn);
161 fi = fn->fonts->data;
162 evas_common_font_int_reload(fi); 128 evas_common_font_int_reload(fi);
163 if (fi->src->current_size != fi->size) 129 if (fi->src->current_size != fi->size)
164 { 130 {
@@ -181,14 +147,11 @@ evas_common_font_max_ascent_get(RGBA_Font *fn)
181} 147}
182 148
183EAPI int 149EAPI int
184evas_common_font_max_descent_get(RGBA_Font *fn) 150evas_common_font_instance_max_descent_get(RGBA_Font_Int *fi)
185{ 151{
186 int val, dv; 152 int val, dv;
187 int ret; 153 int ret;
188 RGBA_Font_Int *fi;
189 154
190// evas_common_font_size_use(fn);
191 fi = fn->fonts->data;
192 evas_common_font_int_reload(fi); 155 evas_common_font_int_reload(fi);
193 if (fi->src->current_size != fi->size) 156 if (fi->src->current_size != fi->size)
194 { 157 {
@@ -211,6 +174,34 @@ evas_common_font_max_descent_get(RGBA_Font *fn)
211} 174}
212 175
213EAPI int 176EAPI int
177evas_common_font_ascent_get(RGBA_Font *fn)
178{
179// evas_common_font_size_use(fn);
180 return evas_common_font_instance_ascent_get(fn->fonts->data);
181}
182
183EAPI int
184evas_common_font_descent_get(RGBA_Font *fn)
185{
186// evas_common_font_size_use(fn);
187 return evas_common_font_instance_descent_get(fn->fonts->data);
188}
189
190EAPI int
191evas_common_font_max_ascent_get(RGBA_Font *fn)
192{
193// evas_common_font_size_use(fn);
194 return evas_common_font_instance_max_ascent_get(fn->fonts->data);
195}
196
197EAPI int
198evas_common_font_max_descent_get(RGBA_Font *fn)
199{
200// evas_common_font_size_use(fn);
201 return evas_common_font_instance_max_descent_get(fn->fonts->data);
202}
203
204EAPI int
214evas_common_font_get_line_advance(RGBA_Font *fn) 205evas_common_font_get_line_advance(RGBA_Font *fn)
215{ 206{
216 int val; 207 int val;