Use true font names and automatically register font names on native platforms

This commit is contained in:
Joshua Granick
2014-11-01 09:44:59 -07:00
parent facc1a20c1
commit fe17a43f72
7 changed files with 169 additions and 83 deletions

View File

@@ -52,6 +52,7 @@ namespace lime {
Font (const char *fontFace);
value Decompose (int em);
value GetFamilyName ();
void LoadGlyphs (const char *glyphs);
void LoadRange (unsigned long start, unsigned long end);
value RenderToImage (ImageBuffer *image);

View File

@@ -118,6 +118,18 @@ namespace lime {
}
value lime_font_get_family_name (value fontHandle) {
#ifdef LIME_FREETYPE
Font *font = (Font*)(intptr_t)val_float (fontHandle);
return font->GetFamilyName ();
#else
return alloc_null ();
#endif
}
value lime_font_load (value fontFace) {
#ifdef LIME_FREETYPE
@@ -389,6 +401,7 @@ namespace lime {
DEFINE_PRIM (lime_application_get_ticks, 0);
DEFINE_PRIM (lime_audio_load, 1);
DEFINE_PRIM (lime_font_create_image, 1);
DEFINE_PRIM (lime_font_get_family_name, 1);
DEFINE_PRIM (lime_font_load, 1);
DEFINE_PRIM (lime_font_load_glyphs, 3);
DEFINE_PRIM (lime_font_load_range, 4);

View File

@@ -522,6 +522,13 @@ namespace lime {
}
value Font::GetFamilyName () {
return alloc_wstring (get_familyname_from_sfnt_name (face));
}
bool Font::InsertCodepoint (unsigned long codepoint) {
GlyphInfo info;