Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.video.font

Class EM_TTF_FONT


Direct ancestors

EM_FONT, SDL_TTF_FUNCTIONS_EXTERNAL, DISPOSABLE, EM_SHARED_ERROR_HANDLER

Known direct descendants

EM_COLOR_TTF_FONT

Creation

Features

Invariants

indexing

description

An EM_TTF_FONT is created from a true-type-font file. The color
of the font is determined by the drawing color of the surface where
the text is placed on.

date

$Date: 2005/10/23 16:50:15 $

revision

$Revision: 1.13 $

class

EM_TTF_FONT

inherit

EM_FONT

create

make_from_ttf_file (a_ttf_file: STRING; point_size: INTEGER)

-- Initialise true type font from a_ttf_file with point_size size.

require
a_ttf_file_not_void: a_ttf_file /= Void
ensure
font_loaded: font /= Default_pointer

feature -- Measurement

height (a_character: CHARACTER): INTEGER

-- Height of a_character

-- (From EM_FONT)

string_height (a_string: STRING): INTEGER

-- Height of a_string

-- (From EM_FONT)

string_width (a_string: STRING): INTEGER

-- Width of a_string

-- (From EM_FONT)

width (a_character: CHARACTER): INTEGER

-- Width of a_character

-- (From EM_FONT)

feature -- Drawing

draw (a_character: CHARACTER; a_surface: EM_SURFACE; x: INTEGER; y:INTEGER)

-- Draws a_character to a_surface to position x y.

-- (From EM_FONT)

require
a_surface /= void
draw_part (rect: EM_RECT; a_character: CHARACTER; a_surface: EM_SURFACE; x: INTEGER; y: INTEGER)

-- Draws rect part of a_character to a_surface to position x y.

-- (From EM_FONT)

require
a_surface /= voidrect /= void
draw_string (a_string: STRING; a_surface: EM_SURFACE; x: INTEGER; y: INTEGER)

-- Draws a_string to a_screen to position x ,y in a_surfaces drawing_color.

-- (From EM_FONT)

require
a_string_not_void: a_string /= void and then a_string.count > 0
a_surface_not_void: a_surface /= void
require else
a_string_not_void: a_string /= Void
a_string_not_empty: not a_string.is_empty

feature {EM_TTF_FONT} -- Implementation

dispose

-- Free external resources.

-- (From DISPOSABLE)

font: POINTER

-- Font. We have to use POINTER because we don't know the size of the struct in TTF_FONT_STRUCT

invariant

font_loaded: font /= Default_pointer

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end