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

em.video.font

Class EM_COLOR_TTF_FONT


Direct ancestors

EM_TTF_FONT

Creation

Features

Invariants

indexing

description

An EM_COLOR_TTF_FONT is created from a true type font file or another
EM_TTF_FONT. The color of the font can be set using set_color.

date

$Date: 2005/10/23 10:59:04 $

revision

$Revision: 1.9 $

class

EM_COLOR_TTF_FONT

inherit

EM_TTF_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.

-- (From EM_TTF_FONT)

require
a_ttf_file_not_void: a_ttf_file /= Void
ensure
font_loaded: font /= Default_pointer
make_from_ttf_font (a_ttf_font: EM_TTF_FONT)

-- Initialise true type font from a_ttf_font.

require
a_ttf_font_not_void: a_ttf_font /= Void
make_from_ttf_file_color (a_ttf_file: STRING; point_size: INTEGER; a_color: like color)

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

require
a_ttf_file_not_void: a_ttf_file /= Void
a_color_not_void: a_color /= Void
make_from_ttf_font_color (a_ttf_font: EM_TTF_FONT; a_color: like color)

-- Initialise true type font from a_ttf_font.

require
a_ttf_font_not_void: a_ttf_font /= Void

feature -- Access

color: EM_COLOR

-- Color of font

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 -- Element change

set_color (a_color: like color)

-- Set color to a_color.

require
a_color_not_void: a_color /= Void
ensure
a_color_set: color = a_color

feature -- Drawing

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

-- Draw 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)

-- Draw 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)

-- Draw a_string to a_screen to position x ,y in the surface's 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
require else
a_string_not_void: a_string /= Void
a_string_not_empty: not a_string.is_empty

feature {EM_TTF_FONT} -- Implementation

font: POINTER

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

-- (From EM_TTF_FONT)

invariant

-- From EM_TTF_FONT
font_loaded: font /= Default_pointer

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

end