123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- deferred class IUP_WIDGET_FONT
- -- Commands to handle the attributes related with fonts.
- inherit
- IUP_WIDGET_INTERNALS
-
- feature {ANY}
- set_font (font: STRING)
- -- Set the font used in the element. A string description
- -- containing typeface, style and size.
- -- Font face is the font face name, and can be any name. Although
- -- only names recognized by the system will be actually used. The
- -- names Helvetica, Courier and Times are always accepted in all
- -- systems.
- -- The supported font style is a combination of: Bold, Italic,
- -- Underline and Strikeout.
- -- Font size is in points (1/72 inch) or in pixels (using
- -- negative values).
- -- Unsupported values are simply ignored.
- -- Examples:
- -- "Times, Bold 18"
- -- "Arial, 24" (no style specified)
- -- "Courier New, Italic Underline -30" (size in pixels)
- do
- iup_open.set_attribute(Current, "FONT", font)
- end
- get_font: STRING
- -- Return the string with the description of the used font.
- do
- Result := iup_open.get_attribute(Current, "FONT")
- end
- reset_font
- -- Reset the font to the default value.
- do
- iup_open.reset_attribute(Current, "FONT")
- end
- set_font_face (fontface: STRING)
- -- Replaces the face name of the current FONT attribute.
- do
- iup_open.set_attribute(Current, "FONTFACE", fontface)
- end
- get_font_face: STRING
- -- Return the face name of the current FONT attribute.
- do
- Result := iup_open.get_attribute(Current, "FONTFACE")
- end
- reset_font_face
- -- Reset the fontface to the default value.
- do
- iup_open.reset_attribute(Current, "FONTFACE")
- end
- set_font_style (fontstyle: STRING)
- -- Replaces the style of the current FONT attribute.
- do
- iup_open.set_attribute(Current, "FONTSTYLE", fontstyle)
- end
- get_font_style: STRING
- -- Return the style of the current FONT attribute.
- do
- Result := iup_open.get_attribute(Current, "FONTSTYLE")
- end
- reset_font_style
- -- Reset the fontstyle to the default value.
- do
- iup_open.reset_attribute(Current, "FONTSTYLE")
- end
- set_font_size (fontsize: INTEGER)
- -- Replaces the size of the current FONT attribute.
- do
- iup_open.set_attribute(Current, "FONTSIZE", fontsize.out)
- end
- get_font_size: INTEGER
- -- Return the style of the current FONT attribute.
- local
- size: STRING
- do
- size := iup_open.get_attribute(Current, "FONTSIZE")
- Result := size.to_integer
- end
- reset_font_size
- -- Reset the fontsize to the default value.
- do
- iup_open.reset_attribute(Current, "FONTSIZE")
- end
- get_char_size: INTEGER
- -- Returns the average character size of the current FONT
- -- attribute. This is the factor used by the SIZE attribute to
- -- convert its units to pixels.
- local
- size: STRING
- do
- size := iup_open.get_attribute(Current, "CHARSIZE")
- Result := size.to_integer
- end
- end
- -- The MIT License (MIT)
- -- Copyright (c) 2016, 2019 by German A. Arias
- -- Permission is hereby granted, free of charge, to any person obtaining a copy
- -- of this software and associated documentation files (the "Software"), to deal
- -- in the Software without restriction, including without limitation the rights
- -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- -- copies of the Software, and to permit persons to whom the Software is
- -- furnished to do so, subject to the following conditions:
- --
- -- The above copyright notice and this permission notice shall be included in
- -- all copies or substantial portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- -- SOFTWARE.
|