note description: "[ A font contained inside a custom package file 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_CPF create make (a_cpf: CPF_PACKAGE_FILE; a_cpf_index: INTEGER_32; a_size: INTEGER_32) -- Initialization for Current contained in a_cpf at index -- a_cpf_index and using a_size as Currents size. require font_text_enabled: Text_library.is_text_enable cpf_index_valid: a_cpf.is_readable and then a_cpf_index > 0 and then a_cpf_index <= a_cpf.sub_files_count make_with_index (a_cpf: CPF_PACKAGE_FILE; a_cpf_index: INTEGER_32; a_size: INTEGER_32; a_index: INTEGER_32) -- Initialization for Current contained in a_cpf at index -- a_cpf_index and using a_size as Currents size. -- The a_index is use if there is more than one font in a ttf file. require font_text_enabled: Text_library.is_text_enable cpf_index_valid: a_cpf.is_readable and then a_cpf_index > 0 and then a_cpf_index <= a_cpf.sub_files_count feature -- Access ascent: INTEGER_32 -- distance from the top of the drawing area to the baseline in pixel. require -- from TEXT_FONT exists descent: INTEGER_32 -- distance from the baseline to the bottom of the drawing area in pixel. require -- from TEXT_FONT exists disable_bold -- remove a bold style modifier to Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_disabled: not is_bold disable_hinting -- Disable the draw hinting of Current require -- from TEXT_FONT exists disable_italic -- remove an italic style modifier to Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_disabled: not is_italic disable_kerning -- Does not allow the library to use kerning when drawing a text with Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_disabled: not is_kerning_enabled disable_outline -- Disable the outline size in Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_disabled: not has_outline disable_strike_through -- remove a strike through style modifier to Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_disabled: not is_strike_through disable_style_modifier -- Disable all style modifier (underline, bold, italic and strike through) require -- from TEXT_FONT exists disable_underline -- remove an underline style modifier to Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_disabled: not is_underline enable_bold -- Add a bold style modifier to Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_enabled: is_bold enable_italic -- Add an italic style modifier to Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_enabled: is_italic enable_kerning -- Allow the library to use kerning when drawing a text with Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_enabled: is_kerning_enabled enable_light_hinting -- Use the light hinting to draw Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_enable: has_light_hinting enable_monochrome_hinting -- Use the monochrome hinting to draw Current. -- Must only be use with monochrome display require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_enable: has_monochrome_hinting enable_normal_hinting -- Use the normal hinting to draw Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_enable: has_normal_hinting enable_strike_through -- Add a strike through style modifier to Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_enabled: is_strike_through enable_underline -- Add an underline style modifier to Current require -- from TEXT_FONT exists ensure -- from TEXT_FONT is_enabled: is_underline exists: BOOLEAN -- Is allocated memory still allocated? -- (from TEXT_FONT) face_family_name: READABLE_STRING_GENERAL -- The name of the face family of Curent require -- from TEXT_FONT exists face_style_name: READABLE_STRING_GENERAL -- The name of the face style of Curent require -- from TEXT_FONT exists generating_type: TYPE [detachable TEXT_FONT_CPF] -- 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 -- from TEXT_FONT exists is_character_valid: is_glyph_provided (a_character) has_ressource_error: BOOLEAN -- Has an error occured while opening Current -- (from GAME_RESSOURCE) has_error: BOOLEAN -- Is the library has generate an error -- (from GAME_ERROR_MANAGER) has_hinting: BOOLEAN -- Has the library a hint about how to draw Current require -- from TEXT_FONT exists has_light_hinting: BOOLEAN -- The library has the light hinting to draw Current require -- from TEXT_FONT exists has_monochrome_hinting: BOOLEAN -- The library has the monochrome hinting to draw Current. require -- from TEXT_FONT exists has_normal_hinting: BOOLEAN -- The library has the normal hinting to draw `Current require -- from TEXT_FONT exists has_outline: BOOLEAN -- Is Current has an outline size. require -- from TEXT_FONT exists has_style_modifier: BOOLEAN -- Is Current has a style modifier (underline, bold, italic or strike through) -- (from TEXT_FONT) require -- from TEXT_FONT exists index: INTEGER_32 -- The index of the font in the file. -- (from TEXT_FONT) is_bold: BOOLEAN -- Is Current has a bold style modifier require -- from TEXT_FONT exists is_glyph_provided (a_character: CHARACTER_32): BOOLEAN -- Is Current can draw a glyph representing a_character require -- from TEXT_FONT exists is_italic: BOOLEAN -- Is Current has an italic style modifier require -- from TEXT_FONT exists is_kerning_enabled: BOOLEAN -- If True, the library can use kerning when drawing a text with Current require -- from TEXT_FONT exists is_monospace: BOOLEAN -- True if every character that exists in Current is the same width require -- from TEXT_FONT exists is_open: BOOLEAN -- Is Current has been properly opened -- (from GAME_RESSOURCE) is_openable: BOOLEAN -- Can Current be open -- (from TEXT_FONT) is_strike_through: BOOLEAN -- Is Current has a strike through style modifier require -- from TEXT_FONT exists is_underline: BOOLEAN -- Is Current has an underline style modifier require -- from TEXT_FONT 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 -- from TEXT_FONT exists maximum_height: INTEGER_32 -- The maximum height that a gliph can take in pixel using Current require -- from TEXT_FONT 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 -- from TEXT_FONT 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 -- from TEXT_FONT exists set_is_bold (a_value: BOOLEAN) -- Assign to is_bold the value of a_value -- (from TEXT_FONT) ensure -- from TEXT_FONT is_assign: is_bold ~ a_value set_is_italic (a_value: BOOLEAN) -- Assign to is_italic the value of a_value -- (from TEXT_FONT) ensure -- from TEXT_FONT is_assign: is_italic ~ a_value set_is_kerning_enabled (a_value: BOOLEAN) -- Assign to is_kerning_enabled the value of a_value -- (from TEXT_FONT) ensure -- from TEXT_FONT is_assign: is_kerning_enabled ~ a_value set_is_strike_through (a_value: BOOLEAN) -- Assign to is_strike_through the value of a_value -- (from TEXT_FONT) ensure -- from TEXT_FONT is_assign: is_strike_through ~ a_value set_is_underline (a_value: BOOLEAN) -- Assign to is_underline the value of a_value -- (from TEXT_FONT) ensure -- from TEXT_FONT is_assign: is_underline ~ a_value set_outline_size (a_outline_size: INTEGER_32) -- Assign outline_size with the value of outline_size require -- from TEXT_FONT exists: exists outline_size_valid: a_outline_size >= 0 ensure -- from TEXT_FONT is_assign: outline_size = a_outline_size size: INTEGER_32 -- The font height. -- (from TEXT_FONT) text_dimension (a_text: READABLE_STRING_GENERAL): TUPLE [width: INTEGER_32; height: INTEGER_32] -- The dimension of the a_text drawed with Current require -- from TEXT_FONT 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_CPF): 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_CPF): 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_CPF): 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_CPF) -- 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_CPF) -- 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_CPF -- 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_CPF) -- 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_CPF -- 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_CPF -- 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_CPF -- 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. -- (from TEXT_FONT) feature -- Initialisation make (a_cpf: CPF_PACKAGE_FILE; a_cpf_index: INTEGER_32; a_size: INTEGER_32) -- Initialization for Current contained in a_cpf at index -- a_cpf_index and using a_size as Currents size. require font_text_enabled: Text_library.is_text_enable cpf_index_valid: a_cpf.is_readable and then a_cpf_index > 0 and then a_cpf_index <= a_cpf.sub_files_count make_with_index (a_cpf: CPF_PACKAGE_FILE; a_cpf_index: INTEGER_32; a_size: INTEGER_32; a_index: INTEGER_32) -- Initialization for Current contained in a_cpf at index -- a_cpf_index and using a_size as Currents size. -- The a_index is use if there is more than one font in a ttf file. require font_text_enabled: Text_library.is_text_enable cpf_index_valid: a_cpf.is_readable and then a_cpf_index > 0 and then a_cpf_index <= a_cpf.sub_files_count 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 -- from CPF_RESSOURCE_MANAGER cpf_valid: cpf.is_readable cpf_index_valid: cpf_index > 0 and cpf_index <= cpf.sub_files_count -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from TEXT_FONT is_open_exists: is_open implies exists end -- class TEXT_FONT_CPF
Generated by ISE EiffelStudio