Skip to content

Commit

Permalink
cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Sep 10, 2023
1 parent 53c1d44 commit b1181f5
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions coders/wmf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,8 @@ static void ipa_draw_text(wmfAPI *API, wmfDrawText_t *draw_text)
/* Choose bounding box and calculate its width and height */
#if !defined(MAGICKCORE_WMF_DELEGATE)
{
double dx,
double
dx,
dy;

if (draw_text->flags)
Expand Down Expand Up @@ -1517,9 +1518,16 @@ static void ipa_draw_text(wmfAPI *API, wmfDrawText_t *draw_text)

font = WMF_DC_FONT(draw_text->dc);

if (!draw_text->str)
return;


/* Convert font_height to equivalent pointsize */
pointsize = util_pointsize(API, font, draw_text->str, draw_text->font_height);

if (pointsize <= 0.0)
return;

/* Save graphic wand */
(void) PushDrawingWand(WmfDrawingWand);

Expand Down Expand Up @@ -1563,12 +1571,9 @@ static void ipa_draw_text(wmfAPI *API, wmfDrawText_t *draw_text)
text_width = metrics.width *(ddata->scale_y / ddata->scale_x);

#if defined(MAGICKCORE_WMF_DELEGATE)
point.x=(MagickRealType) ((MagickRealType) point.x-
(MagickRealType) text_width/2.0);
point.x -= (float) (text_width / 2.0);
#else
point.x=(MagickRealType) ((MagickRealType) point.x+
(MagickRealType) bbox_width/2.0-(MagickRealType) text_width/
2.0);
point.x += (float) (bbox_width / 2.0 - text_width / 2.0);
#endif
}
}
Expand Down Expand Up @@ -1664,9 +1669,9 @@ static void ipa_draw_text(wmfAPI *API, wmfDrawText_t *draw_text)
if (metrics.underline_thickness < 1.5)
line_height *= 0.55;
ulTL.x = 0;
ulTL.y = fabs(metrics.descent) - line_height;
ulBR.x = metrics.width;
ulBR.y = fabs(metrics.descent);
ulTL.y = (float) fabs(metrics.descent) - line_height;
ulBR.x = (float) metrics.width;
ulBR.y = (float) fabs(metrics.descent);

DrawRectangle(WmfDrawingWand,
XC(ulTL.x), YC(ulTL.y), XC(ulBR.x), YC(ulBR.y));
Expand Down

0 comments on commit b1181f5

Please sign in to comment.