]> git.imager.perl.org - imager.git/blobdiff - fontft1.c
avoid a possible sign-extension for offsets/sizes in SGI
[imager.git] / fontft1.c
index 6af95e8da815e2bbec93c79f28479af5b6153e89..50602902d3c9ef750c23e426fb33ce4d0283aef4 100644 (file)
--- a/fontft1.c
+++ b/fontft1.c
@@ -371,6 +371,7 @@ i_tt_new(const char *fontname) {
   /* load the typeface */
   error = TT_Open_Face( tteng->engine, fontname, &handle->face );
   if ( error ) {
+    myfree(handle);
     if ( error == TT_Err_Could_Not_Open_File ) {
       mm_log((1, "Could not find/open %s.\n", fontname ));
     }
@@ -612,7 +613,7 @@ i_tt_get_glyph( TT_Fonthandle *handle, int inst, unsigned long j) {
   if ( LTT_hinted ) load_flags |= TTLOAD_HINT_GLYPH;
   
   if ( !TT_VALID(handle->char_map) ) {
-    code = (j - ' ' + 1) < 0 ? 0 : (j - ' ' + 1);
+    code = (j < ' ' - 1)  ? 0 : (j - (' ' - 1));
     if ( code >= handle->properties.num_Glyphs ) code = 0;
   } else code = TT_Char_Index( handle->char_map, j );
   
@@ -686,7 +687,7 @@ i_tt_has_chars(TT_Fonthandle *handle, char const *text, size_t len, int utf8,
       index = TT_Char_Index(handle->char_map, c);
     }
     else {
-      index = (c - ' ' + 1) < 0 ? 0 : (c - ' ' + 1);
+      index = (c < ' ' - 1) ? 0 : (c - (' ' - 1));
       if (index >= handle->properties.num_Glyphs)
         index = 0;
     }
@@ -971,7 +972,7 @@ interface for generating single channel raster of text (internal)
 
 static
 int
-i_tt_rasterize( TT_Fonthandle *handle, TT_Raster_Map *bit, i_img_dim cords[6], double points, char const* txt, size_t len, int smooth, int utf8 ) {
+i_tt_rasterize( TT_Fonthandle *handle, TT_Raster_Map *bit, i_img_dim *cords, double points, char const* txt, size_t len, int smooth, int utf8 ) {
   int inst;
   i_img_dim width, height;
   TT_Raster_Map small_bit;
@@ -1107,7 +1108,7 @@ Function to get texts bounding boxes given the instance of the font (internal)
 
 static
 undef_int
-i_tt_bbox_inst( TT_Fonthandle *handle, int inst ,const char *txt, size_t len, i_img_dim cords[BOUNDING_BOX_COUNT], int utf8 ) {
+i_tt_bbox_inst( TT_Fonthandle *handle, int inst ,const char *txt, size_t len, i_img_dim *cords, int utf8 ) {
   int upm, casc, cdesc, first;
   
   int start    = 0;
@@ -1206,7 +1207,7 @@ Interface to get a strings bounding box
 */
 
 undef_int
-i_tt_bbox( TT_Fonthandle *handle, double points,const char *txt,size_t len,i_img_dim cords[6], int utf8) {
+i_tt_bbox( TT_Fonthandle *handle, double points,const char *txt,size_t len,i_img_dim *cords, int utf8) {
   int inst;
 
   i_clear_error();