summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/engines
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-06-13 00:54:27 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-06-13 00:54:27 +0000
commit6746b071d18d1c23460b8d1adc4cb2fd53a5697f (patch)
tree2949047ddca49ec0121d35f50010333ebce3a268 /legacy/evas/src/lib/engines
parent0d33c5eb19936df7b215fb299f6aa28b331f2cc1 (diff)
and in my continuing foxes for bitmap font loading... correctly chose
the closest of N sizes. SVN revision: 72055
Diffstat (limited to 'legacy/evas/src/lib/engines')
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_load.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_font_load.c b/legacy/evas/src/lib/engines/common/evas_font_load.c
index 4a0375121d..8e0bc15ea6 100644
--- a/legacy/evas/src/lib/engines/common/evas_font_load.c
+++ b/legacy/evas/src/lib/engines/common/evas_font_load.c
@@ -378,41 +378,46 @@ evas_common_font_int_load_complete(RGBA_Font_Int *fi)
378 fi->real_size = fi->size * 64; 378 fi->real_size = fi->size * 64;
379 error = FT_Set_Char_Size(fi->src->ft.face, 0, fi->real_size, font_dpi, font_dpi); 379 error = FT_Set_Char_Size(fi->src->ft.face, 0, fi->real_size, font_dpi, font_dpi);
380 if (error) 380 if (error)
381 { 381 error = FT_Set_Pixel_Sizes(fi->src->ft.face, 0, fi->real_size);
382 fi->real_size = fi->size;
383 error = FT_Set_Pixel_Sizes(fi->src->ft.face, 0, fi->real_size);
384 }
385 FTUNLOCK(); 382 FTUNLOCK();
386 if (error) 383 if (error)
387 { 384 {
388 int i; 385 int i, maxd = 0x7fffffff;
389 int chosen_size = 0; 386 int chosen_size = 0;
390 int chosen_width = 0; 387 int chosen_size2 = 0;
391 388
392 for (i = 0; i < fi->src->ft.face->num_fixed_sizes; i++) 389 for (i = 0; i < fi->src->ft.face->num_fixed_sizes; i++)
393 { 390 {
394 int s; 391 int s, cd;
395 int d, cd; 392
396 393 s = fi->src->ft.face->available_sizes[i].size;
397 s = fi->src->ft.face->available_sizes[i].height; 394 cd = chosen_size - fi->real_size;
398 cd = chosen_size - fi->size;
399 if (cd < 0) cd = -cd; 395 if (cd < 0) cd = -cd;
400 d = s - fi->size; 396 if (cd < maxd)
401 if (d < 0) d = -d; 397 {
402 if (d < cd) 398 maxd = cd;
403 {
404 chosen_width = fi->src->ft.face->available_sizes[i].width;
405 chosen_size = s; 399 chosen_size = s;
400 chosen_size2 = fi->src->ft.face->available_sizes[i].y_ppem;
401 if (maxd == 0) break;
406 } 402 }
407 if (d == 0) break;
408 } 403 }
409 fi->real_size = chosen_size; 404 fi->real_size = chosen_size;
410 FTLOCK(); 405 FTLOCK();
411 error = FT_Set_Pixel_Sizes(fi->src->ft.face, chosen_width, fi->real_size); 406 error = FT_Set_Pixel_Sizes(fi->src->ft.face, 0, fi->real_size);
412 FTUNLOCK(); 407 FTUNLOCK();
413 if (error) 408 if (error)
414 { 409 {
415 /* couldn't choose the size anyway... what now? */ 410 error = FT_Set_Char_Size(fi->src->ft.face, 0, fi->real_size, font_dpi, font_dpi);
411 if (error)
412 {
413 /* hack around broken fonts */
414 fi->real_size = (chosen_size2 / 64) * 60;
415 error = FT_Set_Char_Size(fi->src->ft.face, 0, fi->real_size, font_dpi, font_dpi);
416 if (error)
417 {
418 /* couldn't choose the size anyway... what now? */
419 }
420 }
416 } 421 }
417 } 422 }
418 fi->src->current_size = 0; 423 fi->src->current_size = 0;