]> git.imager.perl.org - imager.git/blobdiff - freetyp2.c
think about 0.47
[imager.git] / freetyp2.c
index bdcf63d293da342d7cbc55e127a02f7a4c24efbd..687e26859efdedec61255de38384b2ae1f42ad31 100644 (file)
@@ -388,21 +388,25 @@ i_ft2_bbox(FT2_Fonthandle *handle, double cheight, double cwidth,
       /* last character 
        handle the case where the right the of the character overlaps the 
        right*/
-      rightb = gm->horiAdvance - gm->horiBearingX - gm->width;
-      if (rightb > 0)
-        rightb = 0;
+      rightb = (gm->horiAdvance - gm->horiBearingX - gm->width)/64;
+      /*if (rightb > 0)
+        rightb = 0;*/
     }
   }
 
   bbox[BBOX_NEG_WIDTH] = start;
   bbox[BBOX_GLOBAL_DESCENT] = handle->face->size->metrics.descender / 64;
-  bbox[BBOX_POS_WIDTH] = width - rightb;
+  bbox[BBOX_POS_WIDTH] = width;
+  if (rightb < 0)
+    bbox[BBOX_POS_WIDTH] -= rightb;
   bbox[BBOX_GLOBAL_ASCENT] = handle->face->size->metrics.ascender / 64;
   bbox[BBOX_DESCENT] = descent;
   bbox[BBOX_ASCENT] = ascent;
   bbox[BBOX_ADVANCE_WIDTH] = width;
+  bbox[BBOX_RIGHT_BEARING] = rightb;
+  mm_log((1, " bbox=> negw=%d glob_desc=%d pos_wid=%d glob_asc=%d desc=%d asc=%d adv_width=%d rightb=%d\n", bbox[0], bbox[1], bbox[2], bbox[3], bbox[4], bbox[5], bbox[6], bbox[7]));
 
-  return BBOX_ADVANCE_WIDTH + 1;
+  return BBOX_RIGHT_BEARING + 1;
 }
 
 /*
@@ -766,6 +770,7 @@ Returns non-zero on success.
 =cut
 */
 
+int
 i_ft2_cp(FT2_Fonthandle *handle, i_img *im, int tx, int ty, int channel,
          double cheight, double cwidth, char const *text, int len, int align,
          int aa, int vlayout, int utf8) {
@@ -1004,7 +1009,7 @@ i_ft2_glyph_name(FT2_Fonthandle *handle, unsigned long ch, char *name_buf,
     if (error) {
       ft2_push_message(error);
       *name_buf = '\0';
-      return;
+      return 0;
     }
     if (*name_buf) {
       return strlen(name_buf) + 1;