Loading configure.ac +3 −1 Original line number Diff line number Diff line ## ExampleLib Example: an example of using Automake to link with a library AC_INIT([freetype-gl], [1.6], [bernd@net2o.de], [freetype-gl for Linux/Android], AC_INIT([freetype-gl], [1.7], [bernd@net2o.de], [freetype-gl for Linux/Android], [https://github.com/forthy42/freetype-gl]) AC_PREREQ([2.59]) AM_INIT_AUTOMAKE([1.10 -Wall no-define]) Loading @@ -18,7 +18,9 @@ case $CC in esac >conftest.$ac_ext echo -n "checking include directory for ft2build.h... " FTINC=`eval $ac_compiler -E -Wp,-v conftest.$ac_ext 2>&1 | grep '^ ' | while read i; do test -f $i/freetype2/ft2build.h && echo -I$i/freetype2; done` echo "$FTINC" rm conftest.$ac_ext SOURCE_PATH_SIZE=0 #$(echo $PWD | wc -c) Loading texture-font.c +54 −21 Original line number Diff line number Diff line Loading @@ -259,12 +259,38 @@ texture_font_set_size ( texture_font_t *self, float size ) return 1; } // -------------------------------------------------- void texture_font_init_size( texture_font_t * self) { FT_Size_Metrics metrics; self->underline_position = self->face->underline_position / (float)(HRESf*HRESf) * self->size; self->underline_position = roundf( self->underline_position ); if( self->underline_position > -2 ) { self->underline_position = -2.0; } self->underline_thickness = self->face->underline_thickness / (float)(HRESf*HRESf) * self->size; self->underline_thickness = roundf( self->underline_thickness ); if( self->underline_thickness < 1 ) { self->underline_thickness = 1.0; } metrics = self->face->size->metrics; self->ascender = (metrics.ascender >> 6) / 100.f; self->descender = (metrics.descender >> 6) / 100.f; self->height = (metrics.height >> 6) / 100.f; self->linegap = self->height - self->ascender + self->descender; } // ------------------------------------------------------ texture_font_init --- static int texture_font_init(texture_font_t *self) { FT_Size_Metrics metrics; assert(self->atlas); assert(self->size > 0); assert((self->location == TEXTURE_FONT_FILE && self->filename) Loading Loading @@ -294,25 +320,7 @@ texture_font_init(texture_font_t *self) if (!texture_font_load_face(self, self->size * 100.f)) return -1; self->underline_position = self->face->underline_position / (float)(HRESf*HRESf) * self->size; self->underline_position = roundf( self->underline_position ); if( self->underline_position > -2 ) { self->underline_position = -2.0; } self->underline_thickness = self->face->underline_thickness / (float)(HRESf*HRESf) * self->size; self->underline_thickness = roundf( self->underline_thickness ); if( self->underline_thickness < 1 ) { self->underline_thickness = 1.0; } metrics = self->face->size->metrics; self->ascender = (metrics.ascender >> 6) / 100.f; self->descender = (metrics.descender >> 6) / 100.f; self->height = (metrics.height >> 6) / 100.f; self->linegap = self->height - self->ascender + self->descender; texture_font_init_size( self ); if (!texture_font_set_size(self, self->size)) return -1; Loading Loading @@ -398,6 +406,31 @@ texture_font_new_from_memory(texture_atlas_t *atlas, float pt_size, return self; } // ----------------------------------------------------- texture_font_clone --- texture_font_t * texture_font_clone( texture_font_t *old, float pt_size) { texture_font_t *self; self = calloc(1, sizeof(*self)); if (!self) { freetype_gl_error( Out_Of_Memory, "line %d: No more memory for allocating data\n", __LINE__); return NULL; } memcpy(self, old, sizeof(*self)); self->glyphs = vector_new(sizeof(texture_glyph_t *)); if(!texture_font_set_size ( self, pt_size * 100.f )) return NULL; texture_font_init_size( self ); if(!texture_font_set_size ( self, pt_size )) return NULL; return self; } // ----------------------------------------------------- texture_font_close --- void Loading texture-font.h +10 −0 Original line number Diff line number Diff line Loading @@ -459,6 +459,16 @@ typedef struct texture_font_t const void *memory_base, size_t memory_size ); /** * Clone the freetype-gl font and set a different size * * @param self a valid texture font * @param size the new size of the font */ texture_font_t * texture_font_clone( texture_font_t *old, float pt_size); /** * Close the freetype structures from a font and the associated library * Loading Loading
configure.ac +3 −1 Original line number Diff line number Diff line ## ExampleLib Example: an example of using Automake to link with a library AC_INIT([freetype-gl], [1.6], [bernd@net2o.de], [freetype-gl for Linux/Android], AC_INIT([freetype-gl], [1.7], [bernd@net2o.de], [freetype-gl for Linux/Android], [https://github.com/forthy42/freetype-gl]) AC_PREREQ([2.59]) AM_INIT_AUTOMAKE([1.10 -Wall no-define]) Loading @@ -18,7 +18,9 @@ case $CC in esac >conftest.$ac_ext echo -n "checking include directory for ft2build.h... " FTINC=`eval $ac_compiler -E -Wp,-v conftest.$ac_ext 2>&1 | grep '^ ' | while read i; do test -f $i/freetype2/ft2build.h && echo -I$i/freetype2; done` echo "$FTINC" rm conftest.$ac_ext SOURCE_PATH_SIZE=0 #$(echo $PWD | wc -c) Loading
texture-font.c +54 −21 Original line number Diff line number Diff line Loading @@ -259,12 +259,38 @@ texture_font_set_size ( texture_font_t *self, float size ) return 1; } // -------------------------------------------------- void texture_font_init_size( texture_font_t * self) { FT_Size_Metrics metrics; self->underline_position = self->face->underline_position / (float)(HRESf*HRESf) * self->size; self->underline_position = roundf( self->underline_position ); if( self->underline_position > -2 ) { self->underline_position = -2.0; } self->underline_thickness = self->face->underline_thickness / (float)(HRESf*HRESf) * self->size; self->underline_thickness = roundf( self->underline_thickness ); if( self->underline_thickness < 1 ) { self->underline_thickness = 1.0; } metrics = self->face->size->metrics; self->ascender = (metrics.ascender >> 6) / 100.f; self->descender = (metrics.descender >> 6) / 100.f; self->height = (metrics.height >> 6) / 100.f; self->linegap = self->height - self->ascender + self->descender; } // ------------------------------------------------------ texture_font_init --- static int texture_font_init(texture_font_t *self) { FT_Size_Metrics metrics; assert(self->atlas); assert(self->size > 0); assert((self->location == TEXTURE_FONT_FILE && self->filename) Loading Loading @@ -294,25 +320,7 @@ texture_font_init(texture_font_t *self) if (!texture_font_load_face(self, self->size * 100.f)) return -1; self->underline_position = self->face->underline_position / (float)(HRESf*HRESf) * self->size; self->underline_position = roundf( self->underline_position ); if( self->underline_position > -2 ) { self->underline_position = -2.0; } self->underline_thickness = self->face->underline_thickness / (float)(HRESf*HRESf) * self->size; self->underline_thickness = roundf( self->underline_thickness ); if( self->underline_thickness < 1 ) { self->underline_thickness = 1.0; } metrics = self->face->size->metrics; self->ascender = (metrics.ascender >> 6) / 100.f; self->descender = (metrics.descender >> 6) / 100.f; self->height = (metrics.height >> 6) / 100.f; self->linegap = self->height - self->ascender + self->descender; texture_font_init_size( self ); if (!texture_font_set_size(self, self->size)) return -1; Loading Loading @@ -398,6 +406,31 @@ texture_font_new_from_memory(texture_atlas_t *atlas, float pt_size, return self; } // ----------------------------------------------------- texture_font_clone --- texture_font_t * texture_font_clone( texture_font_t *old, float pt_size) { texture_font_t *self; self = calloc(1, sizeof(*self)); if (!self) { freetype_gl_error( Out_Of_Memory, "line %d: No more memory for allocating data\n", __LINE__); return NULL; } memcpy(self, old, sizeof(*self)); self->glyphs = vector_new(sizeof(texture_glyph_t *)); if(!texture_font_set_size ( self, pt_size * 100.f )) return NULL; texture_font_init_size( self ); if(!texture_font_set_size ( self, pt_size )) return NULL; return self; } // ----------------------------------------------------- texture_font_close --- void Loading
texture-font.h +10 −0 Original line number Diff line number Diff line Loading @@ -459,6 +459,16 @@ typedef struct texture_font_t const void *memory_base, size_t memory_size ); /** * Clone the freetype-gl font and set a different size * * @param self a valid texture font * @param size the new size of the font */ texture_font_t * texture_font_clone( texture_font_t *old, float pt_size); /** * Close the freetype structures from a font and the associated library * Loading