Wednesday, May 5, 2010

GTK#: How to Change Font of Entry

This tutorial assumes that you are using MonoDevelop and created a C# GUI application using GTK#.

Supposing you already have a Window with an Entry, named txtSource, this is how you change the Font.

First, include Pango in imports.
  • using Pango;

Second, use the FontDescription class and instanciate one.
  • FontDescription fontDesc = new FontDescription();

Third, set the Family property of FontDescription object to any font family you want (ex, "Arial", "Tahoma", "Courier).
  • fontDesc.Family = "Courier";

Lastly, set the FontDescription object to Entry using ModifyFont method.
  • txtSource.ModifyFont(fontDesc);

The whole code should look something like this:

using System;
using Gtk;
using Pango;

public partial class MainWindow : Gtk.Window {
  public MainWindow () :base(Gtk.WindowType.Toplevel) {
    Build();

    FontDescription fontDesc = new FontDescription();
    
    fontDesc.Family = "Courier";
    
    txtSource.ModifyFont(fontDesc);
  }
}

Tuesday, May 4, 2010

Android on iPhone

I've heard about the fake iPhones from one of my officemates and I was deeply interested to buy one for some experiment. So I went to Divisoria (Philippine version of black market) and did see one which is worh PhP2,800

I tested the unit and was quite fascinated and impressed with the technology.

My supposed plan was to experiment with any opensource mobile operating system that would possibly work on the said phone. Specifically, I am interested in running Android on that fake iPhone. But a little googling showed that there is already an existing iPhone clone that uses Android. Cool, huh?


I'm still going to buy and try to do this hack for myself.