Typical Palm OS devices have displays of 160x160 or 320x320
pixels. Comparable Windows Mobile devices have displays of
240x240 or 480x480 pixels. (All of these display densities
are envisaged in the Palm APIs, where they are referred to
as single-, double-, one-and-a-half- and triple-density,
respectively.) Historically, Palm OS devices have only
supported single- and double-density. (Although Handera
produced one-and-a-half density devices for a time.)
StyleTap Platform software allows Palm applications to
run at all four densities (on Windows Mobile devices).
While StyleTap does various automatic scaling
operations to make old applications fill new,
high-density displays, new applications will obviously
look best when they use native high-density bitmaps
(and fonts, if the application wishes to provide its
own fonts).
PilRC 3.2 already supports the creation of font
families that contain single- and double- density fonts
and bitmap families that contain single-,
one-and-a-half- and double-density bitmaps.
This patch extends PilRC 3.2 to allow font families and
bitmap families of all four densities. The patched
version produces binary resources that are fully
compatible with existing Palm OS devices. The input
syntax changes are trivial additions to the existing
syntax for font and bitmap families.
The patch file was created using "diff -ruN" against
PilRC 3.2 files bitmap.h bitmap.c font.c pilrc.h and
pilrc.c.
Extends PilRC 3.2 for high-density fonts and bitmaps
Logged In: YES
user_id=18252
Your patch does not work, at least if many characters have
an odd width. I found out that rowWords[densityTemp] need
to be set differently:
Around lines 910 in font.c remove all the code that
computes rowWords[densityTemp] and replace it with:
rowWords [densityIndexTemp] = ScaleUp(densityTemp,
header[h_rowWords]+1)-1;
Not sure about +1/-1, but I think for 1.5xdensity we need
to round up, not down.
Then it still does not work: The character bitmap is
reconstructed correctly, but instead of 'A' I get 'C'.
I think this is also due to constantly rounding down.
Logged In: YES
user_id=33270
This patch was developed in a bit of a vacuum. We are not
aware of any current Palm OS devices that support
one-and-a-half density displays. However, the Palm
documentation (http://www.palmos.com /dev /support /docs
/constructor /CGR_Fonts.html) states that you should
multiply the single density size by 1.5 and round down, not up.
Can you tell me what tools or environment you are using to
test the font family that you are creating with the patched
version of PilRC? If there is a standard implementation
other than StyleTap, we would like to know about it.
Thanks.
Mike Waters
Logged In: YES
user_id=18252
After some try and error process I got font working. BTW I
use the Palm OS 5.3 Simulator to test it.
mwaters is right, the font width must be 1.5x rounded
*down*, but there are other places where we need to round
*up*. Here is the result:
If a character starts in the character bitmap at position
"x" in 1xdensity it must start at position scaleUp(x)
(rounded down) in high-density bitmap, e.g. if all
characters have width "5" and thus start at 0,5,10,15,20,...
in low-density, they must be 7 pixels wide and start at
0,7,15,22,30,... in high-density. The current patch wrongly
puts them at 0,7,14,21,28,... though.
The variable rowwords is only stored for 1x density in the
font resource. The high-density bitmaps must be stored with
rowwords set to scaleUp(rowwords) but rounded *up*. One
needs to round up, because otherwise the bitmap would not
always fit.
Now I just have to clean up my patch.
Logged In: YES
user_id=18252
I cannot upload new patches and do not want to open a new
patch item with the same content. So I put my patch here
http://hoenicke.ath.cx/pilrc/pilrc-density-jh.diff
It's based on Styletap's patch. The file font.c was heavily
changed. I did not thoroughly test this patch, so I can
only say that it works for my particular font :)