Fixed warning and kerning
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/src/FTFace.cpp b/src/FTFace.cpp
index 1e6acde..4ae397f 100755
--- a/src/FTFace.cpp
+++ b/src/FTFace.cpp
@@ -68,7 +68,7 @@ bool FTFace::Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes
FT_Open_Args open;
open.flags = (FT_Open_Flags)1; // FT_OPEN_MEMORY;
- open.memory_base = pBufferBytes;
+ open.memory_base = (FT_Byte *)pBufferBytes;
open.memory_size = bufferSizeInBytes;
err = FT_Attach_Stream( *ftFace, &open);
@@ -112,21 +112,23 @@ unsigned int FTFace::CharIndex( unsigned int index) const
FTPoint FTFace::KernAdvance( unsigned int index1, unsigned int index2)
{
- FT_Vector kernAdvance;
- kernAdvance.x = 0;
- kernAdvance.y = 0;
-
+ float x, y;
+ x = y = 0.0f;
+
if( FT_HAS_KERNING((*ftFace)) && index1 && index2)
{
+ FT_Vector kernAdvance;
+ kernAdvance.x = kernAdvance.y = 0;
+
err = FT_Get_Kerning( *ftFace, index1, index2, ft_kerning_unfitted, &kernAdvance);
if( !err)
{
- kernAdvance.x /= 64;
- kernAdvance.y /= 64;
+ x = static_cast<float>( kernAdvance.x) / 64;
+ y = static_cast<float>( kernAdvance.y) / 64;
}
}
- return FTPoint( kernAdvance);
+ return FTPoint( x, y, 0.0);
}