Change Font.getChar* to Font.getGlyph* (makes more sense) and remove unused Glyph/GlyphIndex classes

This commit is contained in:
Joshua Granick
2015-03-12 22:19:49 -07:00
parent 7aaaa16ada
commit 168473e5c2
6 changed files with 66 additions and 152 deletions

View File

@@ -141,30 +141,6 @@ namespace lime {
}
value lime_font_get_char_index (value fontHandle, value character) {
#ifdef LIME_FREETYPE
Font *font = (Font*)(intptr_t)val_float (fontHandle);
return alloc_int (font->GetCharIndex ((char*)val_string (character)));
#else
return alloc_int (-1);
#endif
}
value lime_font_get_char_indices (value fontHandle, value characters) {
#ifdef LIME_FREETYPE
Font *font = (Font*)(intptr_t)val_float (fontHandle);
return font->GetCharIndices ((char*)val_string (characters));
#else
return alloc_null ();
#endif
}
value lime_font_get_descender (value fontHandle) {
#ifdef LIME_FREETYPE
@@ -189,6 +165,30 @@ namespace lime {
}
value lime_font_get_glyph_index (value fontHandle, value character) {
#ifdef LIME_FREETYPE
Font *font = (Font*)(intptr_t)val_float (fontHandle);
return alloc_int (font->GetGlyphIndex ((char*)val_string (character)));
#else
return alloc_int (-1);
#endif
}
value lime_font_get_glyph_indices (value fontHandle, value characters) {
#ifdef LIME_FREETYPE
Font *font = (Font*)(intptr_t)val_float (fontHandle);
return font->GetGlyphIndices ((char*)val_string (characters));
#else
return alloc_null ();
#endif
}
value lime_font_get_glyph_metrics (value fontHandle, value index) {
#ifdef LIME_FREETYPE
@@ -669,10 +669,10 @@ namespace lime {
DEFINE_PRIM (lime_application_update, 1);
DEFINE_PRIM (lime_audio_load, 1);
DEFINE_PRIM (lime_font_get_ascender, 1);
DEFINE_PRIM (lime_font_get_char_index, 2);
DEFINE_PRIM (lime_font_get_char_indices, 2);
DEFINE_PRIM (lime_font_get_descender, 1);
DEFINE_PRIM (lime_font_get_family_name, 1);
DEFINE_PRIM (lime_font_get_glyph_index, 2);
DEFINE_PRIM (lime_font_get_glyph_indices, 2);
DEFINE_PRIM (lime_font_get_glyph_metrics, 2);
DEFINE_PRIM (lime_font_get_height, 1);
DEFINE_PRIM (lime_font_get_num_glyphs, 1);

View File

@@ -631,34 +631,6 @@ namespace lime {
}
int Font::GetCharIndex (char* character) {
long charCode = readNextChar (character);
return FT_Get_Char_Index ((FT_Face)face, charCode);
}
value Font::GetCharIndices (char* characters) {
value indices = alloc_array (0);
unsigned long character;
int index;
while (*characters != 0) {
character = readNextChar (characters);
index = FT_Get_Char_Index ((FT_Face)face, character);
val_array_push (indices, alloc_int (index));
}
return indices;
}
int Font::GetDescender () {
return ((FT_Face)face)->descender;
@@ -721,6 +693,34 @@ namespace lime {
}
int Font::GetGlyphIndex (char* character) {
long charCode = readNextChar (character);
return FT_Get_Char_Index ((FT_Face)face, charCode);
}
value Font::GetGlyphIndices (char* characters) {
value indices = alloc_array (0);
unsigned long character;
int index;
while (*characters != 0) {
character = readNextChar (characters);
index = FT_Get_Char_Index ((FT_Face)face, character);
val_array_push (indices, alloc_int (index));
}
return indices;
}
value Font::GetGlyphMetrics (int index) {
initialize ();