PC Review


Reply
Thread Tools Rate Thread

Calculate Width of String, not Length? 'Em' not 'Kearning'?

 
 
Matt
Guest
Posts: n/a
 
      13th Sep 2011
I know to find the Length of a string, you can use the LEN() formula.
Is there a way to calculate the Width of a string in pixels or some
other units of measurement?

For example, look at these five letter words below, they all have the
same number of letters, but because some letters are wider than
others, the total width of the word on the screen/page is wider.
Like, the capital letter W is wider than the capital letter I.

SILLY
FILES
INDEX
PRICE
WHITE
BUNNY
HARSH
RANGE
HORSE
AGGRO
WHALE

(you can see, depending on the font you're viewing this list in, that
the words at the top of this list are slightly shorter in pixel or em
width, and the words at the bottom are wider. if my phrase/string
contains multiple wider characters, it throws me over limit)

My end result requires me to print all-caps text on a small tag, and I
thought the LEN of 36 was the limit, but it actually depends on the
width of each letter and if the phrase has too many wider letters, it
runs off the page, regardless if it is less than 36 characters or not.

From what I hear, I'm looking for the "Em" measurement?
http://en.wikipedia.org/wiki/Em_(typography)

Any ideas?
 
Reply With Quote
 
 
 
 
Matt
Guest
Posts: n/a
 
      13th Sep 2011
On Sep 13, 2:34*pm, Ron Rosenfeld <r...@nospam.net> wrote:
> On Tue, 13 Sep 2011 11:15:40 -0700 (PDT), Matt <mcvanoli...@gmail.com> wrote:
> >I know to find the Length of a string, you can use the LEN() formula.
> >Is there a way to calculate the Width of a string in pixels or some
> >other units of measurement?

>
> >For example, look at these five letter words below, they all have the
> >same number of letters, but because some letters are wider than
> >others, the total width of the word on the screen/page is wider.
> >Like, the capital letter W is wider than the capital letter I.

>
> >SILLY
> >FILES
> >INDEX
> >PRICE
> >WHITE
> >BUNNY
> >HARSH
> >RANGE
> >HORSE
> >AGGRO
> >WHALE

>
> >(you can see, depending on the font you're viewing this list in, that
> >the words at the top of this list are slightly shorter in pixel or em
> >width, and the words at the bottom are wider. if my phrase/string
> >contains multiple wider characters, it throws me over limit)

>
> >My end result requires me to print all-caps text on a small tag, and I
> >thought the LEN of 36 was the limit, but it actually depends on the
> >width of each letter and if the phrase has too many wider letters, it
> >runs off the page, regardless if it is less than 36 characters or not.

>
> >From what I hear, I'm looking for the "Em" measurement?
> >http://en.wikipedia.org/wiki/Em_(typography)

>
> >Any ideas?

>
> I would just use a fixed pitch font


I had thought of a font change, but the tags have restricted
parameters and I have dozens of fonts to go through and I’m not sure
if the client will accept a drastic change to the tag template.
 
Reply With Quote
 
Matt
Guest
Posts: n/a
 
      13th Sep 2011
On Sep 13, 3:43*pm, GS <gesan...@netscape.net> wrote:
> Matt formulated the question :
>
>
>
>
>
>
>
>
>
> > On Sep 13, 2:34*pm, Ron Rosenfeld <r...@nospam.net> wrote:
> >> On Tue, 13 Sep 2011 11:15:40 -0700 (PDT), Matt <mcvanoli...@gmail.com>
> >> wrote:
> >>> I know to find the Length of a string, you can use the LEN() formula.
> >>> Is there a way to calculate the Width of a string in pixels or some
> >>> other units of measurement?

>
> >>> For example, look at these five letter words below, they all have the
> >>> same number of letters, but because some letters are wider than
> >>> others, the total width of the word on the screen/page is wider.
> >>> Like, the capital letter W is wider than the capital letter I.
> >>> SILLY
> >>> FILES
> >>> INDEX
> >>> PRICE
> >>> WHITE
> >>> BUNNY
> >>> HARSH
> >>> RANGE
> >>> HORSE
> >>> AGGRO
> >>> WHALE

>
> >>> (you can see, depending on the font you're viewing this list in, that
> >>> the words at the top of this list are slightly shorter in pixel or em
> >>> width, and the words at the bottom are wider. if my phrase/string
> >>> contains multiple wider characters, it throws me over limit)
> >>> My end result requires me to print all-caps text on a small tag, and I
> >>> thought the LEN of 36 was the limit, but it actually depends on the
> >>> width of each letter and if the phrase has too many wider letters, it
> >>> runs off the page, regardless if it is less than 36 characters or not..
> >>> From what I hear, I'm looking for the "Em" measurement?
> >>>http://en.wikipedia.org/wiki/Em_(typography)
> >>> Any ideas?

>
> >> I would just use a fixed pitch font

>
> > I had thought of a font change, but the tags have restricted
> > parameters and I have dozens of fonts to go through and I’m not sure
> > if the client will accept a drastic change to the tag template.

>
> If a font size where 36 characters falls of the printed page then...
>
> * Either:
> * * use a smaller font
>
> * * adjust page margins
>
> * * do both the above
>
> * OR:
>
> * * set PageSetup to print 1 page wide and leave PagesTall empty.
>
> --
> Garry
>
> Free usenet access athttp://www.eternal-september.org
> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>
> --- Posted via news://freenews.netfront.net/ - Complaints to n...@netfront.net ---


Although that would be good advice for a regular word processing
program, I'm using specific barcode/price tag printing software which
is more restrictive on requirements and parameters and doesn't give me
much wiggle room.

My resources are limited and the printing software isn't that
versatile, so I prefer to use Excel. I've figured out a way to give me
the approximate width of each string, but there is a margin of error
so I've decided I'll do a few trial runs to see if this margin of
error is acceptable (or how to accommodate it) and then I'll just run
with it. I need to have these all printed by this time tomorrow.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate string width in inches nzDec01 Neal Zimm Microsoft Excel Programming 2 4th Dec 2008 07:20 PM
How to Calculate String Length in Bytes? PJ Olson Microsoft C# .NET 2 24th Dec 2004 06:58 PM
Calculate the appropriete width of string if RichTextBox Marcin Waligora Microsoft Dot NET Framework Forms 1 26th Oct 2004 01:05 PM
how to control string length for full-width and half-width characters Russell Microsoft Dot NET 0 4th Jun 2004 05:20 AM
calculate the text string length Julia Microsoft Access Queries 1 7th Dec 2003 09:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:43 PM.