Commit debc0b8f authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Stopped Images.c using Font SWIs instead of fm functions

parent a28afa84
......@@ -1461,6 +1461,9 @@ void fm_shutdown(void)
/* */
/* Pointer to an int, into which the */
/* calculated width is placed. */
/* */
/* Assume: The two int pointers may not be */
/* NULL. */
/*************************************************/
_kernel_oserror * fm_get_string_width(fm_face h, const char * s, int maxwid, int maxbytes,
......@@ -1545,9 +1548,11 @@ _kernel_oserror * fm_get_string_width(fm_face h, const char * s, int maxwid, int
/* The system font case. */
int wCurr, wLastSplit, oLastSplit, oCurr;
/* (Macro defined in FontManage.h). Important that we take */
/* account of rounding correctly - compare with formula in */
/* fm_puts(). */
int wChar = (FM_System_Size_X(h) * 10 / (128 * wimpt_dx())) * wimpt_dx() * 400;
wCurr = wLastSplit = oLastSplit = oCurr = 0;
......
......@@ -3027,7 +3027,7 @@ _kernel_oserror * image_redraw(browser_data * b, WimpRedrawWindowBlock * r, HStr
/* Have got some ALT text. First find out the bounding box */
/* needed to contain that text. */
int h, ymin, xpos, vcent, stringwidth, stringheight, size;
int h, xpos, vcent, stringwidth, stringheight, size, dummy;
BBox fbox;
BBox * ibox = NULL;
......@@ -3046,32 +3046,22 @@ _kernel_oserror * image_redraw(browser_data * b, WimpRedrawWindowBlock * r, HStr
/* Find the string width of the ALT text */
_swix(Font_SetFont, _IN(0), h);
_swix(Font_StringWidth,
_INR(1,5) | _OUT(2),
tp->text,
0x1000000,
0x1000000,
-1,
strlen(tp->text),
&stringwidth);
fm_get_string_width(h,
tp->text,
0x1000000,
strlen(tp->text),
-1,
&dummy,
&stringwidth
);
convert_to_os(stringwidth, &stringwidth);
/* Find the font height */
_swix(Font_ReadInfo,
_IN(0) | _OUT(2) | _OUT(4),
h,
&ymin, /* Font BBox ymin */
&stringheight); /* Font BBox ymax */
fm_font_box(h, &fbox);
stringheight -= ymin; /* So height = ymax - ymin */
stringheight = fbox.ymax - fbox.ymin;
/* Set xpos to the horizontal offset to plot at. */
/* Remember that 'box' contains the bottom */
......@@ -3080,7 +3070,7 @@ _kernel_oserror * image_redraw(browser_data * b, WimpRedrawWindowBlock * r, HStr
/* Similarly, centre vertically */
vcent = (box.ymax - stringheight) / 2 - ymin;
vcent = (box.ymax - stringheight) / 2 - fbox.ymin;
if (vcent <= 0) vcent = 10;
vcent += box.ymin;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment