drawinfospace function now matches zr's recent changes
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
#include FT_GLYPH_H
|
#include FT_GLYPH_H
|
||||||
|
#include <freetype/ttnameid.h>
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
@@ -179,6 +180,12 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
|
|||||||
FT_GlyphSlot glyph;
|
FT_GlyphSlot glyph;
|
||||||
FT_UInt glyph_index;
|
FT_UInt glyph_index;
|
||||||
FT_Outline ftoutline;
|
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 scale= 1. / 1024.; //needs text_height from metrics to make a standard linedist
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
@@ -198,11 +205,27 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
|
|||||||
|
|
||||||
if(err) return NULL;
|
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
|
// allocate blender font
|
||||||
vfd= MEM_callocN(sizeof(*vfd), "FTVFontData");
|
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)
|
// extract generic ascii character range (needs international support, dynamic loading of chars, etcetc)
|
||||||
for(i = myMIN_ASCII; i <= myMAX_ASCII; i++) {
|
for(i = myMIN_ASCII; i <= myMAX_ASCII; i++) {
|
||||||
int *npoints; //total points of each contour
|
int *npoints; //total points of each contour
|
||||||
@@ -387,6 +410,11 @@ static int check_freetypefont(PackedFile * pf)
|
|||||||
FT_Face face;
|
FT_Face face;
|
||||||
FT_GlyphSlot glyph;
|
FT_GlyphSlot glyph;
|
||||||
FT_UInt glyph_index;
|
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;
|
int success = 0;
|
||||||
|
|
||||||
@@ -400,6 +428,23 @@ static int check_freetypefont(PackedFile * pf)
|
|||||||
error("This is not a valid font");
|
error("This is not a valid font");
|
||||||
}
|
}
|
||||||
else {
|
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' );
|
glyph_index = FT_Get_Char_Index( face, 'A' );
|
||||||
err = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP );
|
err = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP );
|
||||||
if(err) success = 0;
|
if(err) success = 0;
|
||||||
|
@@ -55,7 +55,7 @@ extern void allqueue(unsigned short event, short val);
|
|||||||
extern void allspace(unsigned short event, short val);
|
extern void allspace(unsigned short event, short val);
|
||||||
extern void copy_view3d_lock(short val);
|
extern void copy_view3d_lock(short val);
|
||||||
extern void drawemptyspace(struct ScrArea *sa, void *spacedata);
|
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 duplicatespacelist(struct ScrArea *area, struct ListBase *lb1, struct ListBase *lb2);
|
||||||
extern void extern_set_butspace(int fkey);
|
extern void extern_set_butspace(int fkey);
|
||||||
extern void force_draw(void);
|
extern void force_draw(void);
|
||||||
|
@@ -1291,7 +1291,7 @@ void space_sound_button_function(int event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void drawinfospace(void)
|
void drawinfospace(ScrArea *sa, void *spacedata)
|
||||||
{
|
{
|
||||||
uiBlock *block;
|
uiBlock *block;
|
||||||
float fac;
|
float fac;
|
||||||
|
Reference in New Issue
Block a user