ok and METRIC then! :)
[profile/ivi/evas.git] / src / lib / engines / common / evas_font_private.h
1 #ifndef _EVAS_FONT_PRIVATE_H
2 # define _EVAS_FONT_PRIVATE_H
3 #include "evas_font_ot.h"
4
5 #ifdef BUILD_PTHREAD
6 extern LK(lock_font_draw); // for freetype2 API calls
7 extern LK(lock_bidi); // for fribidi API calls
8 extern LK(lock_ot); // for harfbuzz calls
9 #  define FTLOCK()   LKL(lock_font_draw)
10 #  define FTUNLOCK() LKU(lock_font_draw)
11
12 #  define BIDILOCK()   LKL(lock_bidi)
13 #  define BIDIUNLOCK() LKU(lock_bidi)
14
15 /* Macros for text walking */
16 #  define OTLOCK()   LKL(lock_ot)
17 #  define OTUNLOCK() LKU(lock_ot)
18 #else
19 #  define FTLOCK()
20 #  define FTUNLOCK()
21
22 #  define BIDILOCK()
23 #  define BIDIUNLOCK()
24
25 /* Macros for text walking */
26 #  define OTLOCK()
27 #  define OTUNLOCK()
28 #endif
29
30 void evas_common_font_source_unload(RGBA_Font_Source *fs);
31 void evas_common_font_source_reload(RGBA_Font_Source *fs);
32
33 void evas_common_font_int_promote(RGBA_Font_Int *fi);
34 void evas_common_font_int_use_increase(int size);
35 void evas_common_font_int_use_trim(void);
36 void evas_common_font_int_unload(RGBA_Font_Int *fi);
37 void evas_common_font_int_reload(RGBA_Font_Int *fi);
38
39 /* 6th bit is on is the same as frac part >= 0.5 */
40 # define EVAS_FONT_ROUND_26_6_TO_INT(x) \
41    (((x + 0x20) & -0x40) >> 6)
42
43 # define EVAS_FONT_CHARACTER_IS_INVISIBLE(x) ( \
44       ((0x200C <= (x)) && ((x) <= 0x200D)) || /* ZWNJ..ZWH */ \
45       ((0x200E <= (x)) && ((x) <= 0x200F)) || /* BIDI stuff */ \
46       ((0x202A <= (x)) && ((x) <= 0x202E)) /* BIDI stuff */ \
47       )
48
49 # if 1
50 // do proper round (up or down like 1.4 -> 1 and 1.6 -> 2 etc
51 #  define FONT_METRIC_CONV(val, dv, scale) \
52    (((long long)((val) * (scale)) + (long long)((dv) * (dv) / 2LL)) \
53      / (long long)((dv) * (dv)))
54 #  define FONT_METRIC_ROUNDUP(val) \
55    (((val) + 31) >> 6)
56 # else
57 // truncate/round down
58 #  define FONT_METRIC_CONV(val, dv, scale) \
59    (((val) * (scale)) / ((dv) * (dv)))
60 #  define FONT_METRIC_ROUNDUP(val) \
61    ((val) >> 6)
62 # endif
63
64 # include "evas_font_default_walk.x"
65 #endif /* !_EVAS_FONT_PRIVATE_H */