add Init_FreeType() in Font.cc
This commit is contained in:
parent
abf21b4b73
commit
40719e085a
20
src/Font.cc
20
src/Font.cc
@ -1,9 +1,29 @@
|
|||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
#include "ruby.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
#define round_up_26_6(val) (((val) + 63) >> 6u)
|
#define round_up_26_6(val) (((val) + 63) >> 6u)
|
||||||
|
|
||||||
|
static FT_Library ft;
|
||||||
|
|
||||||
|
static void Init_FreeType()
|
||||||
|
{
|
||||||
|
static bool initialized = false;
|
||||||
|
|
||||||
|
if (initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (FT_Init_FreeType(&ft) != 0)
|
||||||
|
{
|
||||||
|
rb_raise(rb_eRuntimeError, "Error initializing FreeType");
|
||||||
|
}
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
Font::Font()
|
Font::Font()
|
||||||
{
|
{
|
||||||
m_loaded = false;
|
m_loaded = false;
|
||||||
|
@ -13,7 +13,7 @@ typedef struct
|
|||||||
|
|
||||||
static VALUE ruby_class;
|
static VALUE ruby_class;
|
||||||
|
|
||||||
static void Init_SDL(void)
|
static void Init_SDL()
|
||||||
{
|
{
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user