1 package org.newdawn.slick; 2 3 4 /** 5 * The proprieties of any font implementation 6 * 7 * @author Kevin Glass 8 */ 9 public interface Font { 10 /** 11 * Get the width of the given string 12 * 13 * @param str The string to obtain the rendered with of 14 * @return The width of the given string 15 */ 16 int getWidth(CharSequence str); 17 18 /** 19 * Get the height of the given string 20 * 21 * @param str The string to obtain the rendered with of 22 * @return The width of the given string 23 */ 24 int getHeight(CharSequence str); 25 26 /** 27 * Get the maximum height of any line drawn by this font 28 * 29 * @return The maxium height of any line drawn by this font 30 */ 31 int getLineHeight(); 32 33 /** 34 * Draw a string to the screen 35 * 36 * @param x The x location at which to draw the string 37 * @param y The y location at which to draw the string 38 * @param text The text to be displayed 39 */ 40 void drawString(float x, float y, CharSequence text); 41 42 /** 43 * Draw a string to the screen 44 * 45 * @param x The x location at which to draw the string 46 * @param y The y location at which to draw the string 47 * @param text The text to be displayed 48 * @param col The colour to draw with 49 */ 50 void drawString(float x, float y, CharSequence text, Color col); 51 52 53 /** 54 * Draw part of a string to the screen. Note that this will 55 * still position the text as though it's part of the bigger string. 56 * 57 * @param x The x location at which to draw the string 58 * @param y The y location at which to draw the string 59 * @param text The text to be displayed 60 * @param col The colour to draw with 61 * @param startIndex The index of the first character to draw 62 * @param endIndex The index of the last character from the string to draw 63 */ 64 void drawString(float x, float y, CharSequence text, Color col, int startIndex, int endIndex); 65 }