note description: "A font that can be use to draw text with a {TEXT_IMAGE}." author: "Louis Marchand" date: "Mon, 30 Mar 2015 01:06:37 +0000" revision: "2.0" class interface TEXT_FONT create make (a_filename: READABLE_STRING_GENERAL; a_size: INTEGER_32) -- Initialization for Current. require is_text_enable: Text_library.is_text_enable filename_not_empty: not a_filename.is_empty size_stricly_positive: a_size > 1 make_with_index (a_filename: READABLE_STRING_GENERAL; a_size: INTEGER_32; a_index: INTEGER_32) -- Initialization for Current. -- The index is use if there is more than one font in a ttf file. require is_text_enable: Text_library.is_text_enable filename_not_empty: not a_filename.is_empty size_stricly_positive: a_size > 1 index_positive: a_index >= 0 feature -- Access ascent: INTEGER_32 -- distance from the top of the drawing area to the baseline in pixel. require exists descent: INTEGER_32 -- distance from the baseline to the bottom of the drawing area in pixel. require exists disable_bold -- remove a bold style modifier to Current require exists ensure is_disabled: not is_bold disable_hinting -- Disable the draw hinting of Current require exists disable_italic -- remove an italic style modifier to Current require exists ensure is_disabled: not is_italic disable_kerning -- Does not allow the library to use kerning when drawing a text with Current require exists ensure is_disabled: not is_kerning_enabled disable_outline -- Disable the outline size in Current require exists ensure is_disabled: not has_outline disable_strike_through -- remove a strike through style modifier to Current require exists ensure is_disabled: not is_strike_through disable_style_modifier -- Disable all style modifier (underline, bold, italic and strike through) require exists disable_underline -- remove an underline style modifier to Current require exists ensure is_disabled: not is_underline enable_bold -- Add a bold style modifier to Current require exists ensure is_enabled: is_bold enable_italic -- Add an italic style modifier to Current require exists ensure is_enabled: is_italic enable_kerning -- Allow the library to use kerning when drawing a text with Current require exists ensure is_enabled: is_kerning_enabled enable_light_hinting -- Use the light hinting to draw Current require exists ensure is_enable: has_light_hinting enable_monochrome_hinting -- Use the monochrome hinting to draw Current. -- Must only be use with monochrome display require exists ensure is_enable: has_monochrome_hinting enable_normal_hinting -- Use the normal hinting to draw Current require exists ensure is_enable: has_normal_hinting enable_strike_through -- Add a strike through style modifier to Current require exists ensure is_enabled: is_strike_through enable_underline -- Add an underline style modifier to Current require exists ensure is_enabled: is_underline exists: BOOLEAN -- Is allocated memory still allocated? face_family_name: READABLE_STRING_GENERAL -- The name of the face family of Curent require exists face_style_name: READABLE_STRING_GENERAL -- The name of the face style of Curent require exists generating_type: TYPE [detachable TEXT_FONT] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty glyph_metrics (a_character: CHARACTER_32): TUPLE [minimal_x: INTEGER_32; maximal_x: INTEGER_32; minimal_y: INTEGER_32; maximal_y: INTEGER_32; advance: INTEGER_32] -- The informations about the glyph representing a_character generated with Current. -- Set has_error on error. require exists is_character_valid: is_glyph_provided (a_character) has_error: BOOLEAN -- Is the library has generate an error -- (from GAME_ERROR_MANAGER) has_ressource_error: BOOLEAN -- Has an error occured while opening Current -- (from GAME_RESSOURCE) has_hinting: BOOLEAN -- Has the library a hint about how to draw Current require exists has_light_hinting: BOOLEAN -- The library has the light hinting to draw Current require exists has_monochrome_hinting: BOOLEAN -- The library has the monochrome hinting to draw Current. require exists has_normal_hinting: BOOLEAN -- The library has the normal hinting to draw `Current require exists has_outline: BOOLEAN -- Is Current has an outline size. require exists has_style_modifier: BOOLEAN -- Is Current has a style modifier (underline, bold, italic or strike through) require exists index: INTEGER_32 -- The index of the font in the file. is_bold: BOOLEAN assign set_is_bold -- Is Current has a bold style modifier require exists is_glyph_provided (a_character: CHARACTER_32): BOOLEAN -- Is Current can draw a glyph representing a_character require exists is_italic: BOOLEAN assign set_is_italic -- Is Current has an italic style modifier require exists is_kerning_enabled: BOOLEAN assign set_is_kerning_enabled -- If True, the library can use kerning when drawing a text with Current require exists is_monospace: BOOLEAN -- True if every character that exists in Current is the same width require exists is_open: BOOLEAN -- Is Current has been properly opened -- (from GAME_RESSOURCE) is_openable: BOOLEAN -- Can Current be open is_strike_through: BOOLEAN assign set_is_strike_through -- Is Current has a strike through style modifier require exists is_underline: BOOLEAN assign set_is_underline -- Is Current has an underline style modifier require exists last_error: READABLE_STRING_GENERAL -- The last error generate by the library -- (from GAME_SDL_ANY) line_skip_height: INTEGER_32 -- the recommended pixel height of a rendered line of text using Current require exists maximum_height: INTEGER_32 -- The maximum height that a gliph can take in pixel using Current require exists open -- Open Current require -- from GAME_RESSOURCE ressource_is_openable: is_openable ressource_is_not_open: not is_open and not has_ressource_error ensure -- from GAME_RESSOURCE ressource_is_open: is_open or has_ressource_error ensure then exists: not has_error implies exists is_open: not has_error implies is_open outline_size: INTEGER_32 assign set_outline_size -- The ouline width of Current (0 for disabled) require exists set_is_bold (a_value: BOOLEAN) -- Assign to is_bold the value of a_value ensure is_assign: is_bold ~ a_value set_is_italic (a_value: BOOLEAN) -- Assign to is_italic the value of a_value ensure is_assign: is_italic ~ a_value set_is_kerning_enabled (a_value: BOOLEAN) -- Assign to is_kerning_enabled the value of a_value ensure is_assign: is_kerning_enabled ~ a_value set_is_strike_through (a_value: BOOLEAN) -- Assign to is_strike_through the value of a_value ensure is_assign: is_strike_through ~ a_value set_is_underline (a_value: BOOLEAN) -- Assign to is_underline the value of a_value ensure is_assign: is_underline ~ a_value set_outline_size (a_outline_size: INTEGER_32) -- Assign outline_size with the value of outline_size require exists: exists outline_size_valid: a_outline_size >= 0 ensure is_assign: outline_size = a_outline_size size: INTEGER_32 -- The font height. text_dimension (a_text: READABLE_STRING_GENERAL): TUPLE [width: INTEGER_32; height: INTEGER_32] -- The dimension of the a_text drawed with Current require exists Text_library: TEXT_CONTROLLER -- The main manager of the text library -- (from TEXT_LIBRARY_SHARED) feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal alias "≡≡≡" (other: TEXT_FONT): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: TEXT_FONT): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal alias "≜" (other: TEXT_FONT): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Duplication copy (other: TEXT_FONT) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: TEXT_FONT) -- Effect equivalent to that of: -- copy (other . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: TEXT_FONT -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: TEXT_FONT) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: TEXT_FONT -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: TEXT_FONT -- New object equal to Current -- twin calls copy; to change copying/twinning semantics, redefine copy. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable TEXT_FONT -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.default for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Implementation dispose -- Action to be executed just before garbage collection -- reclaims an object. -- Effect it in descendants to perform specific dispose -- actions. Those actions should only take care of freeing -- external resources; they should not perform remote calls -- on other objects since these may also be dead and reclaimed. feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void invariant is_open_exists: is_open implies exists -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) end -- class TEXT_FONT
Generated by ISE EiffelStudio