I have a function that I built some of and borrowed from something Ray Camden posted on his blog. It will basically take two lines of text, in my case a month and day and center it on an image.
CODE
date_img = imageNew(img);
//Create text variables
img_month = UCase(dateFormat(date,"mmm"));
img_day = dateFormat(date,"dd");
//Add day to image
text = img_day;
//Create Text Layout
buffered = ImageGetBufferedImage(date_img);
context = buffered.getGraphics().getFontRenderContext();
Font = createObject("java", "java.awt.Font");
// font name, style and size
textFont = Font.init( "Arial", Font.BOLD, javacast("int", 13));
textLayout = createObject("java","java.awt.font.TextLayout").init(text,textfont,context);
//Set Text Dimensions
textBounds = textLayout.getBounds();
dimen.width = textBounds.getWidth();
dimen.height = textBounds.getHeight();
//Create Image
attr = {font="Arial", size="13", style="bold"};
newx = (date_img.width/2.2 - dimen.width/2.2);
newy = (date_img.height/1.6 + dimen.height/1.6);
imageSetDrawingColor(date_img,"white");
imageDrawText(date_img,text,newx,newy,attr);
//Add Month
text = img_month;
//Create Text Layout
buffered = ImageGetBufferedImage(date_img);
context = buffered.getGraphics().getFontRenderContext();
Font = createObject("java", "java.awt.Font");
// font name, style and size
textFont = Font.init( "Arial", Font.PLAIN, javacast("int", 11));
textLayout = createObject("java","java.awt.font.TextLayout").init(text,textfont,context);
//Set Text Dimensions
textBounds = textLayout.getBounds();
dimen.width = textBounds.getWidth();
dimen.height = textBounds.getHeight();
//Create Image
attr = {font="Arial", size="11"};
newx = (date_img.width/2 - dimen.width/2);
newy = (date_img.height/2.3 + dimen.height/2.3);
imageSetDrawingColor(date_img,"white");
imageDrawText(date_img,text,newx,newy,attr);
The only problem that I am having is that the Arial Black text is to jagged of text. I need to sharpen it up a little bit to look more presentable. Is there another function that I could use?