indexing
	description: "Representation of a typeface.Appearance is specified in terms of font family, height, shape andweight. The local system font closest to the specification will bedisplayed. A specific font name may optionally be specified. See `set_preferred_face'"
	status: "See notice at end of class"
	keywords: "character, face, height, family, weight, shape, bold, italic"
	date: "$Date$"
	revision: "$Revision$"

class interface
	EV_FONT

create 

	frozen default_create
			-- Standard creation procedure.
			-- (from EV_ANY)
		ensure then -- from EV_ANY
			is_coupled: implementation /= void
			is_initialized: is_initialized
			default_create_called_set: default_create_called
			is_in_default_state: is_in_default_state

	make_with_values (a_family, a_weight, a_shape, a_height: INTEGER)
			-- Create with a_family, a_weight, a_shape and a_height.
		require
			a_family_valid: valid_family (a_family)
			a_weight_valid: valid_weight (a_weight)
			a_shape_valid: valid_shape (a_shape)
			a_height_bigger_than_zero: a_height > 0
		ensure
			a_family_set: family = a_family
			a_weight_set: weight = a_weight
			a_shape_set: shape = a_shape
			a_height_set: height = a_height

feature -- Access

	data: ANY
			-- Arbitrary user data may be stored here.
			-- (from EV_ANY)

	family: INTEGER
			-- Font category. Can be any of the Family_* constants
			-- defined in EV_FONT_CONSTANTS.
			-- Default: Family_sans
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.family

	height: INTEGER
			-- Preferred font height in pixels.
			-- Default: 8
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.height

	preferred_families: ACTIVE_LIST [STRING]
			-- Preferred familys. The first one in the list
			-- will be tried first. If it does not exists on
			-- the system, the second will be tried, etc.
			--
			-- Overrides family if found on current system.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.preferred_families
			result_not_void: Result /= void

	shape: INTEGER
			-- Preferred font slant. Can be any of the Shape_*
			-- constants defined in EV_FONT_CONSTANTS.
			-- Default: Shape_regular
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.shape

	weight: INTEGER
			-- Preferred font thickness. Can be any of the Weight_*
			-- constants defined in EV_FONT_CONSTANTS.
			-- Default: Weight_regular
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.weight
	
feature -- Status report

	ascent: INTEGER
			-- Vertical distance from the origin of the drawing
			-- operation to the top of the drawn character.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.ascent

	descent: INTEGER
			-- Vertical distance from the origin of the drawing
			-- operation to the bottom of the drawn character.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.descent

	horizontal_resolution: INTEGER
			-- Horizontal resolution of screen for which the font is designed.
			-- Measured in dots per inch. If return value is zero, the
			-- resolution is not known.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.horizontal_resolution

	is_proportional: BOOLEAN
			-- Can characters in the font have different widths?
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.is_proportional

	maximum_width: INTEGER
			-- Width of the biggest character in the font.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.maximum_width

	minimum_width: INTEGER
			-- Width of the smallest character in the font.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.minimum_width

	name: STRING
			-- Face name chosen by toolkit.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result.is_equal (implementation.name)

	string_size (a_string: STRING): TUPLE [INTEGER, INTEGER]
			-- [width, height] in pixels of a_string in the current font,
			-- taking into account line breaks ('').
		require
			not_destroyed: not is_destroyed
			a_string_not_void: a_string /= void
		ensure
			bridge_ok: Result.item (1).is_equal (implementation.string_size (a_string).item (1)) and Result.item (2).is_equal (implementation.string_size (a_string).item (2))

	string_width (a_string: STRING): INTEGER
			-- Width in pixels of a_string in the current font.
		require
			not_destroyed: not is_destroyed
			a_string_not_void: a_string /= void
		ensure
			bridge_ok: Result = implementation.string_width (a_string)
			positive: Result >= 0

	vertical_resolution: INTEGER
			-- Vertical resolution of screen for which the font is designed.
			-- Measured in dots per inch. If return value is zero, the
			-- resolution is not known.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.vertical_resolution

	width: INTEGER
			-- Character width of current fixed-width font.
			-- If font is proportional, returns the average width.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.width
	
feature -- Element change

	set_data (some_data: like data)
			-- Assign some_data to data.
			-- (from EV_ANY)
		require -- from EV_ANY
			not_destroyed: not is_destroyed
		ensure -- from EV_ANY
			data_assigned: data = some_data

	set_family (a_family: INTEGER)
			-- Assign  a_family to family.
		require
			not_destroyed: not is_destroyed
			a_family_valid: valid_family (a_family)
		ensure
			family_assigned: family = a_family

	set_height (a_height: INTEGER)
			-- Set a_height to height.
		require
			not_destroyed: not is_destroyed
			a_height_bigger_than_zero: a_height > 0
		ensure
			height_assigned: height = a_height

	set_shape (a_shape: INTEGER)
			-- Set a_shape to shape.
		require
			not_destroyed: not is_destroyed
			a_shape_valid: valid_shape (a_shape)
		ensure
			shape_assigned: shape = a_shape

	set_weight (a_weight: INTEGER)
			-- Set a_weight to weight.
		require
			not_destroyed: not is_destroyed
			a_weight_valid: valid_weight (a_weight)
		ensure
			weight_assigned: weight = a_weight
	
feature -- Basic operations

	copy (other: like Current)
			-- Update Current with all attributes of other.
		require -- from ANY
			other_not_void: other /= void
			type_identity: same_type (other)
		ensure -- from ANY
			is_equal: is_equal (other)

	is_equal (other: like Current): BOOLEAN
			-- Does other have same appearance?
		require -- from ANY
			other_not_void: other /= void
		ensure -- from ANY
			symmetric: Result implies other.is_equal (Current)
			consistent: standard_is_equal (other) implies Result
	
feature -- Command

	destroy
			-- Destroy underlying native toolkit object.
			-- Render Current unusable.
			-- (from EV_ANY)
		ensure -- from EV_ANY
			is_destroyed: is_destroyed
	
feature  -- Contract support

	valid_family (a_family: INTEGER): BOOLEAN
			-- Is a_family a valid family value.
			-- (from EV_FONT_CONSTANTS)

	valid_shape (a_shape: INTEGER): BOOLEAN
			-- Is a_shape a valid shape value.
			-- (from EV_FONT_CONSTANTS)

	valid_weight (a_weight: INTEGER): BOOLEAN
			-- Is a_weight a valid weight value.
			-- (from EV_FONT_CONSTANTS)
	
feature -- Status Report

	is_destroyed: BOOLEAN
			-- Is Current no longer usable?
			-- (from EV_ANY)
		ensure -- from EV_ANY
			bridge_ok: Result = implementation.is_destroyed
	
invariant

	family_valid: is_initialized implies valid_family (family)
	weight_valid: is_initialized implies valid_weight (weight)
	shape_valid: is_initialized implies valid_shape (shape)
	height_bigger_than_zero: is_initialized implies height > 0
	ascent_bigger_than_zero: is_initialized implies ascent > 0
	descent_bigger_than_zero: is_initialized implies descent > 0
	height_positive: is_initialized implies height > 0
	ascent_positive: is_initialized implies ascent > 0
	descent_positive: is_initialized implies descent > 0
	width_of_empty_string_equals_zero: is_initialized implies string_width ("") = 0
	horizontal_resolution_non_negative: is_initialized implies horizontal_resolution >= 0
	vertical_resolution_non_negative: is_initialized implies vertical_resolution >= 0
		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)
		-- from EV_ANY
	is_initialized: is_initialized
	is_coupled: implementation /= void and then implementation.interface = Current
	default_create_called: default_create_called

end -- class EV_FONT