1 /**
2  ** propwdt.c ---- calculate the width of a string using a proportional font
3  **
4  ** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
5  ** [e-mail: csaba@vuse.vanderbilt.edu]
6  **
7  ** This file is part of the GRX graphics library.
8  **
9  ** The GRX graphics library is free software; you can redistribute it
10  ** and/or modify it under some conditions; see the "copying.grx" file
11  ** for details.
12  **
13  ** This library is distributed in the hope that it will be useful,
14  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  **
17  **/
18 
19 #include "libgrx.h"
20 
GrProportionalTextWidth(const GrFont * font,const void * text,int len,int type)21 int GrProportionalTextWidth(const GrFont *font,const void *text,int len,int type)
22 {
23 	char *txp = (char *)text;
24 	int   wdt = 0;
25 	while(--len >= 0) {
26 	    wdt += GrFontCharWidth(font,GR_TEXTSTR_CODE(txp,type));
27 	    txp += GR_TEXTCHR_SIZE(type);
28 	}
29 	return(wdt);
30 }
31 
32 
33 
34 
35