2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Graphics function TextLength()
8 #include "graphics_intern.h"
11 #define NUMCHARS(tf) ((tf->tf_HiChar - tf->tf_LoChar) + 2)
13 /*****************************************************************************
16 #include <graphics/rastport.h>
17 #include <proto/graphics.h>
19 AROS_LH3(WORD
, TextLength
,
22 AROS_LHA(struct RastPort
*, rp
, A1
),
23 AROS_LHA(CONST_STRPTR
, string
, A0
),
24 AROS_LHA(ULONG
, count
, D0
),
27 struct GfxBase
*, GfxBase
, 9, Graphics
)
46 29-10-95 digulla automatically created from
47 graphics_lib.fd and clib/graphics_protos.h
49 *****************************************************************************/
52 AROS_LIBBASE_EXT_DECL(struct GfxBase
*,GfxBase
)
54 struct TextFont
*tf
= rp
->Font
;
57 if ((tf
->tf_Flags
& FPF_PROPORTIONAL
) || tf
->tf_CharKern
|| tf
->tf_CharSpace
)
60 WORD defaultidx
= NUMCHARS(tf
) - 1; /* Last glyph is the default glyph */
63 for(strlen
= 0; count
; count
--)
67 if ( c
< tf
->tf_LoChar
|| c
> tf
->tf_HiChar
)
73 idx
= c
- tf
->tf_LoChar
;
76 strlen
+= ((WORD
*)tf
->tf_CharKern
)[idx
];
77 strlen
+= ((WORD
*)tf
->tf_CharSpace
)[idx
];
78 strlen
+= rp
->TxSpacing
;
83 strlen
= count
* (tf
->tf_XSize
+ rp
->TxSpacing
);