diff options
author | Rob Haarsma <phaseIV@zonnet.nl> | 2003-05-04 15:20:14 +0400 |
---|---|---|
committer | Rob Haarsma <phaseIV@zonnet.nl> | 2003-05-04 15:20:14 +0400 |
commit | 77650127fd9c10eeacb32b4b8e4d535821d65ee8 (patch) | |
tree | b9b18307c072c48d4d7155a0b60d60684985789d /source | |
parent | ad3a972a258cc47d873ed4020202a8261476bdb3 (diff) |
drawinfospace function now matches zr's recent changes
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/freetypefont.c | 49 | ||||
-rw-r--r-- | source/blender/include/BIF_space.h | 2 | ||||
-rw-r--r-- | source/blender/src/space.c | 2 |
3 files changed, 49 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index fefcd80188a..2cd0896d4ba 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -38,6 +38,7 @@ #include <ft2build.h> #include FT_FREETYPE_H #include FT_GLYPH_H +#include <freetype/ttnameid.h> #include "MEM_guardedalloc.h" @@ -179,6 +180,12 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) FT_GlyphSlot glyph; FT_UInt glyph_index; FT_Outline ftoutline; + FT_CharMap found = 0; + FT_CharMap charmap; + FT_UShort my_platform_id = TT_PLATFORM_MICROSOFT; + FT_UShort my_encoding_id = TT_MS_ID_UNICODE_CS; + int n; + float scale= 1. / 1024.; //needs text_height from metrics to make a standard linedist float dx, dy; @@ -198,11 +205,27 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) if(err) return NULL; + for ( n = 0; n < face->num_charmaps; n++ ) + { + charmap = face->charmaps[n]; + if ( charmap->platform_id == my_platform_id && + charmap->encoding_id == my_encoding_id ) + { + found = charmap; + break; + } + } + + if ( !found ) { return NULL; } + + /* now, select the charmap for the face object */ + err = FT_Set_Charmap( face, found ); + if ( err ) { return NULL; } + + // allocate blender font vfd= MEM_callocN(sizeof(*vfd), "FTVFontData"); -//FT_Set_Charmap(face, ft_encoding_symbol); - // extract generic ascii character range (needs international support, dynamic loading of chars, etcetc) for(i = myMIN_ASCII; i <= myMAX_ASCII; i++) { int *npoints; //total points of each contour @@ -387,6 +410,11 @@ static int check_freetypefont(PackedFile * pf) FT_Face face; FT_GlyphSlot glyph; FT_UInt glyph_index; + FT_CharMap charmap; + FT_CharMap found; + FT_UShort my_platform_id = TT_PLATFORM_MICROSOFT; + FT_UShort my_encoding_id = TT_MS_ID_UNICODE_CS; + int n; int success = 0; @@ -400,6 +428,23 @@ static int check_freetypefont(PackedFile * pf) error("This is not a valid font"); } else { + for ( n = 0; n < face->num_charmaps; n++ ) + { + charmap = face->charmaps[n]; + if ( charmap->platform_id == my_platform_id && + charmap->encoding_id == my_encoding_id ) + { + found = charmap; + break; + } + } + + if ( !found ) { return 0; } + + /* now, select the charmap for the face object */ + err = FT_Set_Charmap( face, found ); + if ( err ) { return 0; } + glyph_index = FT_Get_Char_Index( face, 'A' ); err = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP ); if(err) success = 0; diff --git a/source/blender/include/BIF_space.h b/source/blender/include/BIF_space.h index b5d1e3d4b40..2c6f6f1ecee 100644 --- a/source/blender/include/BIF_space.h +++ b/source/blender/include/BIF_space.h @@ -55,7 +55,7 @@ extern void allqueue(unsigned short event, short val); extern void allspace(unsigned short event, short val); extern void copy_view3d_lock(short val); extern void drawemptyspace(struct ScrArea *sa, void *spacedata); -extern void drawinfospace(void); +extern void drawinfospace(struct ScrArea *sa, void *spacedata); extern void duplicatespacelist(struct ScrArea *area, struct ListBase *lb1, struct ListBase *lb2); extern void extern_set_butspace(int fkey); extern void force_draw(void); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 4288c6a1075..3e159bd989c 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1291,7 +1291,7 @@ void space_sound_button_function(int event) } -void drawinfospace(void) +void drawinfospace(ScrArea *sa, void *spacedata) { uiBlock *block; float fac; |