Using a .ttf or .otf font in Android is fairly straightforward. Firstly create ‘assets/fonts/’ and put the files in there. Now using Typeface.createFromAsset we can create the typeface.
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/CustomFont.ttf");
To set TextView to use this typeface we use the setTypeface function.
TextView tv = (TextView) findViewById(R.id.texty);
tv.setTypeface(tf);
You can, of course, use this in your custom views with Paint.setTypeface. Words of Warning In general I wouldn’t recommend using fonts other than Droid font family apart from in games. That is because Ascender Corp specifically developed the Droid font family for optimal quality and readability on small screen devices. In an application the font is typically a form in which to present some information rather than containing information itself. For example in a racing you might use a font that is elongated with spoilers resembling a car but you probably would not use such a font for an article about cars. Limitations As far as I’m aware it is not possible to reference a font in XML. Making something like this impossible:
<TextView
android:id = ”@+id/texty”
android:typeface = "@font/CustomFont"
/>
I think that the Android team may have purposefully excluded a mechanism for referencing custom typefaces in XML to deter people from using an insane custom font that is difficult to read and potentially quite large.

HEJPBézier Library

August 31st, 2009

Bézier Curve Bézier curves are named after a French engineer Pierre Bézier, who used them to design smooth automobile bodies. Today, them are most commonly used in computer graphics because of their smoothness and aesthetics. Bézier curves are typically cubic, i.e. described by two anchor points and two control points but can be any degree that is computational possible in the time restraints of a particular application. HEJPBézier is a library for generating the series of points that compose a n-th degree Bézier curve. Download Download HEJPBézier (24.8KB) Documentation is included in the jar file.

Example

import uk.co.hejp.Bezier.*;
import java.awt.Point;

Point[] p1 = null, p2 = null;

void setup(){

  /* initialise */
  size(360, 200);
  strokeWeight(2);
  background(255);
  smooth();
  noFill();

  /* generate the curve */
  p1 = Bezier.bezierPoints(20, new Point(10,100), new Point(123,0), new Point(236,200), new Point(350,100));
  p2 = Bezier.bezierPoints(20, new Point(10,100), new Point(123,200), new Point(236,0), new Point(350,100));

  /* draw the curves with circles at each point */
  beginShape();

  stroke(135,170,222); /* pale blue */
  for(int i=0;i<p1.length;i++){
    vertex(p1[i].x, p1[i].y);
    ellipse(p1[i].x, p1[i].y,10,10);
    ellipse(p1[i].x, p1[i].y,4,4);
  }

  endShape();

  beginShape();

  stroke(255, 85, 85); /* salmon */
  for(int i=0;i<p2.length;i++){
    vertex(p2[i].x, p2[i].y);
    ellipse(p2[i].x, p2[i].y,10,10);
    ellipse(p2[i].x, p2[i].y,4,4);
  }

  endShape();

  /* export the image */
  save("bezier-example.png");
}
This example is written in Processing, which is basically Java + a few libraries + a simple quick IDE. Comes in handy for small pieces on code.

HEJPSlideshow v1.0

June 14th, 2009

HJEPSlideshow is a simple, yet highly customisable, image slideshow that can be embeded into any webpage. The transitions, layout and font of the slideshow are customised using clean easy to understand CSS. Features:
  • Resizable
  • Neat transitions from image to image
  • Customisable transitions, layout and fonts
  • Quickly add/remove photos (no re-compilation)
The photos are stored in a XML file, this means that the photos shown in the slideshow can quickly and easily be added/removed. It’s even possible to dynamically create albums using at server-side scripting language, for example PHP, by writing a script to create XML files. Download (13.2KB) The download is a zip archive containing the pre-compiled swf file, an example html page and the source code (if you need it).