Width of Text String in Twips/Pixels/Points?

Width of Text String in Twips/Pixels/Points?

Anonymous
Not applicable
309 Views
3 Replies
Message 1 of 4

Width of Text String in Twips/Pixels/Points?

Anonymous
Not applicable
Hi All,

I'm trying to determine the width of a text sting of a given font so as to
create a box just big enough to fit the text string in. Much as the "mtext"
command would do. The value I'm looking for would be something like the
width property of a text box set to autosize. I'm looking at an API function
named "GetCharWidth32". That function is of course expecting the string as
an argument, but there is no mention of what the font or point size is. Can
anyone point me in the right direction on what I must do to predict the
physical (measured) width of any text string before I place it into Autocad?

Thanks in advance,

Gary
0 Likes
310 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Look at Thisdrawing.Utility.GetBoundingBox method
Hope that helps

Gary McMaster wrote in message
news:3084AB645C57E54B42A1E1C40DC01BF2@in.WebX.SaUCah8kaAW...
> Hi All,
>
> I'm trying to determine the width of a text sting of a given font so as to
> create a box just big enough to fit the text string in. Much as the
"mtext"
> command would do. The value I'm looking for would be something like the
> width property of a text box set to autosize. I'm looking at an API
function
> named "GetCharWidth32". That function is of course expecting the string as
> an argument, but there is no mention of what the font or point size is.
Can
> anyone point me in the right direction on what I must do to predict the
> physical (measured) width of any text string before I place it into
Autocad?
>
> Thanks in advance,
>
> Gary
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
Gary

Do either of these help?
http://msdn.microsoft.com/library/psdk/gdi/fontext_56yb.htm
http://msdn.microsoft.com/library/psdk/gdi/fontext_5cz6.htm
or
--
Kent Keller

Check out the Mechanical Desktop FAQ @
http://mymcad.com/
"Gary McMaster" wrote in message
news:3084AB645C57E54B42A1E1C40DC01BF2@in.WebX.SaUCah8kaAW...
> Hi All,
>
> I'm trying to determine the width of a text sting of a given font so as to
> create a box just big enough to fit the text string in. Much as the "mtext"
> command would do. The value I'm looking for would be something like the
> width property of a text box set to autosize. I'm looking at an API function
> named "GetCharWidth32". That function is of course expecting the string as
> an argument, but there is no mention of what the font or point size is. Can
> anyone point me in the right direction on what I must do to predict the
> physical (measured) width of any text string before I place it into Autocad?
>
> Thanks in advance,
>
> Gary
>
0 Likes
Message 4 of 4

Anonymous
Not applicable
Thanks guys. I'm interested in studying any possibility. I have something
working, but its kinda like a sausage ... you don't want to know what's in
it.

Gary
0 Likes