473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

String Of Text (Number of Pixels / Pixel Size / Pixel Length)

If I'm putting together a list of links and I want to get add each
item one at a time inside a foreach($aNames as $sName) loop,
is there an easy way to get the number of pixels that the $aName
takes up?

For instance, in creating a set of links...

foreach($aLinks as $sLink) {
if ((pixelsize($sLink, $sFont, $iFontSize) . pixelsize($sHTML . " ", $sFont, $iFontSize)) < 400) {
$sHTML .= " " . $sLink;
} else {
$sHTML .= "<br />\n" . $sLink;
}
}

The goal is to keep the whole link on one and only one line letting
the browser automatically break up any given link.

Thanks,

Jim Carlock
Post replies to the newsgroup.
Mar 11 '06 #1
1 6964
"Jim Carlock" <an*******@127.0.0.1> wrote:

If I'm putting together a list of links and I want to get add each
item one at a time inside a foreach($aNames as $sName) loop,
is there an easy way to get the number of pixels that the $aName
takes up?


No. Indeed, there is no guarantee that your page will be rendered in a
pixel-based browser at all.

The general rule is that you worry about the content, and allow the browser
to worry about the details of presentation.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Mar 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Simon Wigzell | last post by:
I am adapting a javascript pulldown menu system to my dynamic website generator - the arrays that hold the menu items information are read from a database and will be different for different users...
9
by: Jonathan Joseph | last post by:
I have a laptop with a very high pixel density (1920x1200) in a 15.5" monitor. Therfore, in my web browser (Mozilla) I set the minimum and default font sizes I want to see to be 24 pixels. ...
3
by: Nathan Sokalski | last post by:
I am using GDI+ to generate buttons in my application. Because I want the left and right edges of the buttons to be a certain number of pixels from the start and end of the text, I need to know (or...
2
by: melanieab | last post by:
Hi, Is there an easy way to say, on textboxHover, if the text inside the box isn't completely visible, have a popup tool come up showing the complete contents of the box? I'm guessing I need to...
7
by: Yeah | last post by:
Ever since I upgraded my Windows display to 120 DPI (kind of a necessary change), fonts have been clearer and graphics have been crisper. However, the 25% automatic increase in the text size on my...
6
by: kklickman | last post by:
I've got a page with two columns: one floats left, the other doesn't float. The page displays fine in Netscape no matter what. In IE (both 6 and 7), it looks fine as long as the browser window is...
7
by: carterweb | last post by:
This is how I do it now. 1. Determine the dimensions of the rectangle. 2. Set a my font size to a fixed maximum size. 3. Apply the font my string and measure the string using the graphics...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
1
by: dantz | last post by:
Hi everyone, I have a textbox which is multiline and wordwrap is true. I did not set any scrollbar because I want to show it manually (using different buttons) The textbox will sometimes have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.