Character font of the text shown in the element. See FONT definition up to IUP 2.x. Although it is an inheritable attribute, it is defined only on elements that have a native representation.
Font description containing typeface, style and size. Default: the global attribute DEFAULTFONT.
The common format definition is similar to the the Pango library Font Description, used by GTK+2. It is defined as having 3 parts: "<font family>, <font styles> <font size>".
Font family can be a list of fonts face names, but this is only accepted in GTK. So the font family can be reduced to font face.
The supported font style is a combination of: Bold, Italic, Underline and Strikeout. The Pango format include many other definitions not supported by the common format, they are supported only by the GTK driver. Unsupported values are simply ignored.
Font size is in points (1/72 inch) or in pixels (using negative values).
The old Font Names are still supported. The old Windows FONT format is still supported in the Windows driver.
Returned values will be the same value when changing the attribute, except for the old font names that will be converted to the new common format definition.
The DEFAULTFONT is retrieved from the System Settings (see bellow), if this failed then "Tahoma, 10" is assumed.
The native handle can be obtained using the "HFONT" attribute.
In "Control Panel", open the "Display Properties" then click on "Advanced" and select "Message Box" and change its Font to affect the default font for applications. In Vista go to "Window Color and Appearance", then "Open Classic Appearance", then Advanced.
The DEFAULTFONT is retrieved from the user resource file (see bellow), if failed then "Fixed, 11" is assumed.
The X-Windows Logical Font Description format (XLFD) is also supported.
The native handle can be obtained using the "XMFONTLIST" and "XFONTSTRUCT" attributes. The selected X Logical Font Description string can be obtained from the attribute "XLFD".
You can use the xfontsel program to obtain a string in the X-Windows Logical Font Description format (XLFD). Noticed that the first size entry of the X-Windows font string format (pxlsz) is in pixels and the next one (ptSz) is in deci-points (multiply the value in points by 10).
Be aware that the resource files ".Xdefaults" and "Iup" in the user home folder can affect the default font and many others visual appearance features in Motif.
The DEFAULTFONT is retrieved from the style defined by GNOME (see bellow), if failed "Sans, 10" is assumed.
The X-Windows Logical Font Description format (XLFD) is also supported.
The native handle can be obtained using the "PANGOFONTDESC" attribute.
Style can also be a combination of: Small-Caps, [Ultra-Light|Light|Medium|Semi-Bold|Bold|Ultra-Bold|Heavy], [Ultra-Condensed|Extra-Condensed|Condensed|Semi-Condensed|Semi-Expanded|Expanded|Extra-Expanded|Ultra-Expanded]. Those values can be used only when the string is a full Pango compliant font, i.e. no underline, no strikeout and size>0.
In GNOME, go to the "Appearance Preferences" tool, then in the Fonts tab change the Applications Font to affect the default font.
"Times, Bold 18" "Arial,Helvetica, 24" (list of fonts for GTK) "Courier New, Italic Underline -30" (size in pixels)
All elements, since the SIZE attribute depends on the FONT attribute, except for menus.
When FONT is changed and SIZE is set, then RASTERSIZE is also updated.
Since font face names are not a standard between Windows, Motif and GTK, a few names are specially handled to improve application portability. If you want to use names that work for all systems we recommend using: Courier, Times and Helvetica (same as Motif). Those names always have a native system name equivalent. If you use those names IUP will automatically map to the native system equivalent. See the table bellow:
Motif | Windows | GTK | Description |
---|---|---|---|
Helvetica | Arial | Sans | without serif, variable spacing |
Courier | Courier New | Monospace | with serif, fixed spacing |
Times | Times New Roman | Serif | with serif, variable spacing |
They will change the FONT attribute, and depends on it. They are used only to set partial FONT parameters of style and size. To do that the FONT attribute is parsed, changed and updated to the new value in the common format definition. This means that if the attribute was set in X-Windows format or in the old Windows and IUP formats, the previous value will be replaced by a new value in the common format definition. Pango additional styles will also be removed.
Replaces or returns the style of the current FONT attribute.
Replaces or returns the size of the current FONT attribute.
Returns the face name of the current FONT attribute.
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.
Allows to select a foundry for the FONT being selected. Must be set before setting the FONT attribute.
The number that represents each character is dependent on the encoding used. For example, in ASCII encoding the letter A has code 65, but codes above 128 can be very different according to the encoding. An encoding is defined by a charset.
IUP uses the default locale in ANSI-C. This means that it does not adopts a specific charset, and so the results can be different if the developer charset is different than the run time charset where the user is running the application. The advantage is that different charsets can be used. For example, if the developer is using a charset, and its user is also using the same encoding, then everything will work fine without the need of text encoding conversions.
GTK uses UTF-8 (ISO10646-1) as its charset for all displayed text, so IUP will automatically convert all strings to (SetAttribute) and from (GetAttribute) UTF-8. If you want to specify strings in the UTF-8 charset at the GTK driver, then set the global attribute UTF8AUTOCONVERT to NO, the default is YES. If the default locale is already UTF-8, but the given string is not UTF-8 then it will be assumed that the string uses the ISO8859-1 charset.
In the future IUP should also support Unicode strings, increasing application portability.
The Latin-1 charset (ISO8859-1) defines an encoding for all of the characters used in Western languages. The first half of Latin-1 is standard ASCII, while the second half (with the eighth bit set) contains accented characters needed for Western languages other than English. In Windows, the ISO8859-1 charset was changed, and some control characters were replaced to include more display characters, this new charset is named Windows-1252. These characters are marked in the table bellow with thick borders.
32 |
! 33 |
" 34 |
# 35 |
$ 36 |
% 37 |
& 38 |
' 39 |
( 40 |
) 41 |
* 42 |
+ 43 |
, 44 |
- 45 |
. 46 |
/ 47 |
0 48 |
1 49 |
2 50 |
3 51 |
4 52 |
5 53 |
6 54 |
7 55 |
8 56 |
9 57 |
: 58 |
; 59 |
< 60 |
= 61 |
> 62 |
? 63 |
@ 64 |
A 65 |
B 66 |
C 67 |
D 68 |
E 69 |
F 70 |
G 71 |
H 72 |
I 73 |
J 74 |
K 75 |
L 76 |
M 77 |
N 78 |
O 79 |
P 80 |
Q 81 |
R 82 |
S 83 |
T 84 |
U 85 |
V 86 |
W 87 |
X 88 |
Y 89 |
Z 90 |
[ 91 |
\ 92 |
] 93 |
^ 94 |
_ 95 |
` 96 |
a 97 |
b 98 |
c 99 |
d 100 |
e 101 |
f 102 |
g 103 |
h 104 |
i 105 |
j 106 |
k 107 |
l 108 |
m 109 |
n 110 |
o 111 |
p 112 |
q 113 |
r 114 |
s 115 |
t 116 |
u 117 |
v 118 |
w 119 |
x 120 |
y 121 |
z 122 |
{ 123 |
| 124 |
} 125 |
~ 126 |
127 |
€ 128 |
129 |
‚ 130 |
ƒ 131 |
„ 132 |
… 133 |
† 134 |
‡ 135 |
ˆ 136 |
‰ 137 |
Š 138 |
‹ 139 |
Œ 140 |
141 |
Ž 142 |
143 |
144 |
‘ 145 |
’ 146 |
“ 147 |
” 148 |
• 149 |
– 150 |
— 151 |
˜ 152 |
™ 153 |
š 154 |
› 155 |
œ 156 |
157 |
ž 158 |
Ÿ 159 |
160 |
¡ 161 |
¢ 162 |
£ 163 |
¤ 164 |
¥ 165 |
¦ 166 |
§ 167 |
¨ 168 |
© 169 |
ª 170 |
« 171 |
¬ 172 |
173 |
® 174 |
¯ 175 |
° 176 |
± 177 |
² 178 |
³ 179 |
´ 180 |
µ 181 |
¶ 182 |
· 183 |
¸ 184 |
¹ 185 |
º 186 |
» 187 |
¼ 188 |
½ 189 |
¾ 190 |
¿ 191 |
À 192 |
Á 193 |
 194 |
à 195 |
Ä 196 |
Å 197 |
Æ 198 |
Ç 199 |
È 200 |
É 201 |
Ê 202 |
Ë 203 |
Ì 204 |
Í 205 |
Î 206 |
Ï 207 |
Ð 208 |
Ñ 209 |
Ò 210 |
Ó 211 |
Ô 212 |
Õ 213 |
Ö 214 |
× 215 |
Ø 216 |
Ù 217 |
Ú 218 |
Û 219 |
Ü 220 |
Ý 221 |
Þ 222 |
ß 223 |
à 224 |
á 225 |
â 226 |
ã 227 |
ä 228 |
å 229 |
æ 230 |
ç 231 |
è 232 |
é 233 |
ê 234 |
ë 235 |
ì 236 |
í 237 |
î 238 |
ï 239 |
ð 240 |
ñ 241 |
ò 242 |
ó 243 |
ô 244 |
õ 245 |
ö 246 |
÷ 247 |
ø 248 |
ù 249 |
ú 250 |
û 251 |
ü 252 |
ý 253 |
þ 254 |
ÿ 255 |
Punctuation and Symbols | |
Numbers | |
Letters | |
Accented |
Adapted from http://en.wikipedia.org/wiki/Windows-1252.