< prev index next >
src/java.desktop/share/native/libfontmanager/freetypeScaler.c
Print this page
*** 43,53 ****
#define ftFixed1 (FT_Fixed) (1 << 16)
#define FloatToFTFixed(f) (FT_Fixed)((f) * (float)(ftFixed1))
#define FTFixedToFloat(x) ((x) / (float)(ftFixed1))
#define FT26Dot6ToFloat(x) ((x) / ((float) (1<<6)))
! #define ROUND(x) ((int) (x+0.5))
typedef struct {
/* Important note:
JNI forbids sharing same env between different threads.
We are safe, because pointer is overwritten every time we get into
--- 43,53 ----
#define ftFixed1 (FT_Fixed) (1 << 16)
#define FloatToFTFixed(f) (FT_Fixed)((f) * (float)(ftFixed1))
#define FTFixedToFloat(x) ((x) / (float)(ftFixed1))
#define FT26Dot6ToFloat(x) ((x) / ((float) (1<<6)))
! #define FT26Dot6ToInt(x) (((int)(x)) >> 6)
typedef struct {
/* Important note:
JNI forbids sharing same env between different threads.
We are safe, because pointer is overwritten every time we get into
*** 763,778 ****
glyphInfo->advanceY =
(float) (advh * FTFixedToFloat(context->transform.xy));
} else {
if (!ftglyph->advance.y) {
glyphInfo->advanceX =
! (float) ROUND(FT26Dot6ToFloat(ftglyph->advance.x));
glyphInfo->advanceY = 0;
} else if (!ftglyph->advance.x) {
glyphInfo->advanceX = 0;
glyphInfo->advanceY =
! (float) ROUND(FT26Dot6ToFloat(-ftglyph->advance.y));
} else {
glyphInfo->advanceX = FT26Dot6ToFloat(ftglyph->advance.x);
glyphInfo->advanceY = FT26Dot6ToFloat(-ftglyph->advance.y);
}
}
--- 763,778 ----
glyphInfo->advanceY =
(float) (advh * FTFixedToFloat(context->transform.xy));
} else {
if (!ftglyph->advance.y) {
glyphInfo->advanceX =
! (float) FT26Dot6ToInt(ftglyph->advance.x);
glyphInfo->advanceY = 0;
} else if (!ftglyph->advance.x) {
glyphInfo->advanceX = 0;
glyphInfo->advanceY =
! (float) FT26Dot6ToInt(-ftglyph->advance.y);
} else {
glyphInfo->advanceX = FT26Dot6ToFloat(ftglyph->advance.x);
glyphInfo->advanceY = FT26Dot6ToFloat(-ftglyph->advance.y);
}
}
< prev index next >