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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Carlock

    #1

    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($sL ink, $sFont, $iFontSize) . pixelsize($sHTM L . " ", $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.


  • Tim Roberts

    #2
    Re: String Of Text (Number of Pixels / Pixel Size / Pixel Length)

    "Jim Carlock" <anonymous@127. 0.0.1> wrote:[color=blue]
    >
    >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?[/color]

    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, timr@probo.com
    Providenza & Boekelheide, Inc.

    Comment

    Working...