Font sizes for PDA browsers

design

#1

I’ve been trying formatting the White Pass NWAC snotel data in a compact form for my Palm Pilot, but I’ve had some problems.

For some reason the output from http://www.nwac.us/products/OSOWPS has a .txt extension on it, so my Palm Pilot PDA browser, Blazer, doesn’t want to display it. Instead I have to save the file and figure out some way to view it off line. I thought it would be an interesting exercise in php to take output from NW Avalanche Center for the White Pass snow pack and reformat it a little more compact for my PDA. I can screen scrape the file with curl and get the relevant data, but I’m having a hard time getting the Blazer browser to process my formatting tags correctly, and without a non proportional font, the columns get out of line. It looks good on my desktop in Firefox (see http://ykfp.org/php/nwac/getwhitepass.php, but Blazer is funny. It has two font size options that are set with pull down menus, small or large, and although some of my formatting tabs like bold seem to work, neither of the font choices seem to be monospace. I’ve tried monospace font specifications in the CSS setting and inside the

 tags, but it’s not working.

There are other browsers for Palm available, and so far Opera mini has worked best. ISilo seems to be more of a html reader, and Xiino gives me line wrap problems. Although Opera and Xiino seem to display the text as non-proportional, both of these browsers seem to have a small set of font sizes and ignore my font-size settings.

White Pass snow
<?php
// Paul Huffman, 1-2-2008

//retrieve the White Pass text file from NWAC
$theurl=“http://www.nwac.us/products/OSOWPS”;

$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $theurl);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);
//Trim feed to useful data
$cStartStr = “MM”;
$cEndStr= " ";
//$cUsefulContents=stristr($contents,$cStartStr);
$cPageTail = stristr($contents, $cStartStr);
$nUsefulDataEndPos = strpos($cPageTail, $cEndStr);
$cUsefulData = substr($cPageTail, 0, $nUsefulDataEndPos);
// display file
echo “White Pass Ski Area, Washington
”;
echo $cUsefulData;

?>

This signature line intentionally blank.


#2

I’ve done a bit of Googling, and it is clear that the Blazer browser does not support monospaced fonts. So here’s a radical idea (raw script, example):<?php header("Content-type: image/png"); $url = "http://www.nwac.us/products/OSOWPS"; $ch = curl_init(); $timeout = 10; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $text = curl_exec($ch); curl_close($ch); $im = imagecreatetruecolor(560, 600); $backgroundcolor = imagecolorallocate($im, 255, 255, 255); $foregroundcolor = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 559, 599, $backgroundcolor); $font = 'cour.ttf'; $fontsize = 9; // size in points imagettftext($im, $fontsize, 0, 0, 0, $foregroundcolor, $font, $text); imagepng($im); imagedestroy($im); ?>You’ll need to upload whichever font you want to use, and my version is the original unformatted data from the last time I helped you with this. It’s very rough and ready, but you get the idea.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#3

Thanks. I didn’t know about that approach, to place the text in am image. Courier bold 7 point seems to be about right for my PDA and Blazer. Now I’ll see if I can trim off the top and bottom lines as I had before.

I thought I had asked about this before on this forum, but I couldn’t find it with the Search function in this forum. Then I saw that there was a pull down option to search by user name.

I tried to find out more about Blazer and couldn’t. I asked Palm tech support and it took a little more than a month to get back to me with a really lame response:
"Thank you for contacting Palm Technical Support. My name is Janice and I understand that you are developing a script for a webpage and you would like to know if we have a list of what fonts are available for Blazer.

Paul, unfortunately, we do have any information about the font types available in Blazer. In order to best assist you, we suggest that you contact Blazer."

I know you get what you pay for when you get free advice, but how the heck to I contact Blazer except through Palm? It’s a Palm product, isn’t it?

This signature line intentionally blank.