Monday, April 12, 2010

Debian Kiosk

I have configured a kiosk using Debian GNU/Linux with blackbox window manager.

The challenges:
1. Touchscreen configuration.
2. Autometic login and start X server.
3. Start desired application for kiosk.
4. A boot splash for booting and shutdown.
1. Touchscreen configuration:
First, setup touchscreen driver and configure it according to your device specification.
I was using eGalax driver, which I have downloaded from

2. Automatic login:
Edit /etc/inittab and comment the following line:

#1:2345:respawn:/sbin/getty 38400 tty1
add the following line below:
1:2345:respawn:/bin/login -f USER_LOGIN tty1 /dev/tty1 2>&1 

Edit .bash_profile (create if require) and add the following line at bottom:

Blackbox window manager:
Edit ~/.xinitrc (or ~/.Xsession), create if require, and add the following line:
exec blackbox
3. Autostart application:
To autostart iceweasel/firefox:
Again edit ~/.xinitrc (or ~/.Xsession) and add the following line:
firefox &
exec blackbox

Install iceweasel/firefox plugin "R-kiosk" from

3. Bootsplash:
Install a bootsplash
apt-get install splashy
Create your own bootsplash and set it
# splashy_config -c
To enable splashy, you may need to edit grub.config and add the following after " quiet"
vga=791 splash

Tips and tricks:
"X: user not authorized to run the X server"
You can allow the user to use run startx by:
#dpkg-reconfigure x11-common
or edit  /etc/X11/Xwrapper.config
"Auto login problem"
 If you have setup GDM (XDM) earlier, then you need to disable it for automatic log in
#update-rc.d -f gdm remove
If you want to enable it simply run (experiment purpose):
#update-rc.d -f gdm defaults

Kiosk performance tuning:
Install the CPU frequency related tools and configure it.


Friday, April 02, 2010

Custom Font Example iPhone

An example for using custom font in iPhone.

Initially, I have tried with UIFont for using custom font, but it seems not possible.

Documents from apple:

Create custom font using CGDataProvider:

NSString *fontPath = [[NSBundle mainBundle] pathForResource:@"CUSTOM_FONT" ofType:@"ttf"];
CGDataProviderRef fontDataProvider = CGDataProviderCreateWithFilename([fontPath UTF8String]); CGFontRef customFont = CGFontCreateWithDataProvider(fontDataProvider);

Use the font:

CGContextSetFont(context, customFont);
CGContextSetFontSize(context, 34.0);
CGContextSetTextDrawingMode(context, kCGTextFill);
CGGlyph textToPrint[[mainString length]];
// Loop through the entire length of the text.
for (int i = 0; i < [mainString length]; ++i) { // Store each letter in a Glyph and subtract the MagicNumber to get appropriate value.
textToPrint[i] = [[mainString uppercaseString] characterAtIndex:i] + 3 - 32;

//to understand the MagicNumber, I open the font file using FontForge
//found that the font I am using started from location 32
//after I changed the "Encoding->Reencode" to "Glyph Order"
//I found that the "U+0020 space" started from location 3