author | matilk |
Wed, 13 Sep 2017 09:40:34 +0200 | |
changeset 8174 | 2704c965b97b |
parent 8018 | 2bd8a65110aa |
child 8177 | 481a5ef90d18 |
permissions | -rw-r--r-- |
7796 | 1 |
" |
2 |
COPYRIGHT (c) 2013 by Jan Vrany |
|
7941 | 3 |
COPYRIGHT (c) 2013 by Claus Gittinger / eXept Software AG |
8018 | 4 |
All Rights Reserved |
7796 | 5 |
|
6 |
This software is furnished under a license and may be used |
|
7 |
only in accordance with the terms of that license and with the |
|
8 |
inclusion of the above copyright notice. This software may not |
|
9 |
be provided or otherwise made available to, or used by, any |
|
10 |
other person. No title to or ownership of the software is |
|
11 |
hereby transferred. |
|
12 |
" |
|
6176 | 13 |
"{ Package: 'stx:libview' }" |
14 |
||
6833 | 15 |
"{ NameSpace: Smalltalk }" |
16 |
||
6176 | 17 |
FontDescription subclass:#XftFontDescription |
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
18 |
instanceVariableNames:'device fontId width minCode maxCode ascent descent height |
7342 | 19 |
fixedWidth' |
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
20 |
classVariableNames:'FC_FAMILY FC_STYLE FC_SLANT FC_WEIGHT FC_SIZE FC_ASPECT |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
21 |
FC_PIXEL_SIZE FC_SPACING FC_FOUNDRY FC_ANTIALIAS FC_HINTING |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
22 |
FC_HINT_STYLE FC_VERTICAL_LAYOUT FC_AUTOHINT FC_WIDTH FC_FILE |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
23 |
FC_INDEX FC_FT_FACE FC_RASTERIZER FC_OUTLINE FC_SCALABLE FC_SCALE |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
24 |
FC_DPI FC_RGBA FC_MINSPACE FC_SOURCE FC_CHARSET FC_LANG |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
25 |
FC_FONTVERSION FC_FULLNAME FC_FAMILYLANG FC_STYLELANG |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
26 |
FC_FULLNAMELANG FC_CAPABILITY FC_FONTFORMAT FC_EMBOLDEN |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
27 |
FC_EMBEDDED_BITMAP FC_DECORATIVE FC_LCD_FILTER FC_NAMELANG |
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
28 |
FC_CHAR_WIDTH FC_CHAR_HEIGHT FC_MATRIX FC_WEIGHT_THIN |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
29 |
FC_WEIGHT_EXTRALIGHT FC_WEIGHT_ULTRALIGHT FC_WEIGHT_LIGHT |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
30 |
FC_WEIGHT_BOOK FC_WEIGHT_REGULAR FC_WEIGHT_NORMAL |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
31 |
FC_WEIGHT_MEDIUM FC_WEIGHT_DEMIBOLD FC_WEIGHT_SEMIBOLD |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
32 |
FC_WEIGHT_BOLD FC_WEIGHT_EXTRABOLD FC_WEIGHT_ULTRABOLD |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
33 |
FC_WEIGHT_BLACK FC_WEIGHT_HEAVY FC_WEIGHT_EXTRABLACK |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
34 |
FC_WEIGHT_ULTRABLACK FC_SLANT_ROMAN FC_SLANT_ITALIC |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
35 |
FC_SLANT_OBLIQUE FC_WIDTH_ULTRACONDENSED FC_WIDTH_EXTRACONDENSED |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
36 |
FC_WIDTH_CONDENSED FC_WIDTH_SEMICONDENSED FC_WIDTH_NORMAL |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
37 |
FC_WIDTH_SEMIEXPANDED FC_WIDTH_EXPANDED FC_WIDTH_EXTRAEXPANDED |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
38 |
FC_WIDTH_ULTRAEXPANDED FC_PROPORTIONAL FC_DUAL FC_MONO |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
39 |
FC_CHARCELL FC_RGBA_UNKNOWN FC_RGBA_RGB FC_RGBA_BGR FC_RGBA_VRGB |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
40 |
FC_RGBA_VBGR FC_RGBA_NONE FC_HINT_NONE FC_HINT_SLIGHT |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
41 |
FC_HINT_MEDIUM FC_HINT_FULL FC_LCD_NONE FC_LCD_DEFAULT |
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
42 |
FC_LCD_LIGHT FC_LCD_LEGACY StXFace2FCWeightMap |
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
43 |
StXStyle2FCSlantMap FirstTimeCalled CachedFontList' |
6176 | 44 |
poolDictionaries:'' |
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
45 |
category:'Graphics-Support' |
6176 | 46 |
! |
47 |
||
6263 | 48 |
Object subclass:#FCFontListParser |
49 |
instanceVariableNames:'pipeStream lineStream currentDescription' |
|
50 |
classVariableNames:'' |
|
51 |
poolDictionaries:'' |
|
52 |
privateIn:XftFontDescription |
|
53 |
! |
|
54 |
||
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
55 |
ExternalAddress subclass:#FCPatternHandle |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
56 |
instanceVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
57 |
classVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
58 |
poolDictionaries:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
59 |
privateIn:XftFontDescription |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
60 |
! |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
61 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
62 |
ExternalAddress subclass:#XftDrawHandle |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
63 |
instanceVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
64 |
classVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
65 |
poolDictionaries:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
66 |
privateIn:XftFontDescription |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
67 |
! |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
68 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
69 |
ExternalAddress subclass:#XftFontHandle |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
70 |
instanceVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
71 |
classVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
72 |
poolDictionaries:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
73 |
privateIn:XftFontDescription |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
74 |
! |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
75 |
|
6176 | 76 |
!XftFontDescription primitiveDefinitions! |
77 |
%{ |
|
78 |
/* |
|
79 |
* includes, defines, structure definitions |
|
80 |
* and typedefs come here. |
|
81 |
*/ |
|
82 |
||
83 |
#undef True |
|
84 |
#undef False |
|
6179 | 85 |
#undef Time |
6176 | 86 |
#define Time XTime |
87 |
||
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
88 |
#ifdef XFT |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
89 |
|
6936 | 90 |
extern OBJ __GLOBAL_GET_BY_NAME(char *); |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
91 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
92 |
# define __HANDLE_VAL(type, externalAddress) \ |
7221 | 93 |
((type)__externalAddressVal(externalAddress)) |
6489 | 94 |
|
6936 | 95 |
# define __HANDLE_NEW(ptr, __cls) \ |
7221 | 96 |
({ \ |
97 |
OBJ handle = __MKEXTERNALADDRESS(ptr); \ |
|
98 |
OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\ |
|
99 |
__InstPtr(handle)->o_class = clsObj; \ |
|
100 |
__STORE(handle, clsObj); \ |
|
101 |
handle; \ |
|
102 |
}) |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
103 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
104 |
# define DISPLAY(x) __HANDLE_VAL(Display*, x) |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
105 |
# define SCREEN(x) ((int)(__intVal(x))) |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
106 |
# define DRAWABLE(x) __HANDLE_VAL(Drawable, x) |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
107 |
# define GC(x) __HANDLE_VAL(GC, x) |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
108 |
# define VISUAL(x) __HANDLE_VAL(Visual*, x) |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
109 |
# define COLORMAP(x) __HANDLE_VAL(Colormap, x) |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
110 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
111 |
/* FontConfig objects */ |
6193 | 112 |
# define FC_PATTERN(x) __HANDLE_VAL(XftPattern*, x) |
113 |
# define FC_PATTERN_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::FCPatternHandle") |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
114 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
115 |
/* Xft Objects */ |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
116 |
|
6193 | 117 |
# define XFT_FONT(x) __HANDLE_VAL(XftFont*, x) |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
118 |
# define XFT_FONT_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::XftFontHandle") |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
119 |
|
6193 | 120 |
# define XFT_DRAW(x) __HANDLE_VAL(XftDraw*, x) |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
121 |
# define XFT_DRAW_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::XftDrawHandle") |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
122 |
|
6176 | 123 |
# include <X11/Xft/Xft.h> |
124 |
#endif |
|
125 |
%} |
|
126 |
! ! |
|
127 |
||
128 |
!XftFontDescription class methodsFor:'documentation'! |
|
129 |
||
7796 | 130 |
copyright |
131 |
" |
|
132 |
COPYRIGHT (c) 2013 by Jan Vrany |
|
7941 | 133 |
COPYRIGHT (c) 2013 by Claus Gittinger / eXept Software AG |
8018 | 134 |
All Rights Reserved |
7796 | 135 |
|
136 |
This software is furnished under a license and may be used |
|
137 |
only in accordance with the terms of that license and with the |
|
138 |
inclusion of the above copyright notice. This software may not |
|
139 |
be provided or otherwise made available to, or used by, any |
|
140 |
other person. No title to or ownership of the software is |
|
141 |
hereby transferred. |
|
142 |
||
143 |
" |
|
144 |
! |
|
145 |
||
6176 | 146 |
documentation |
147 |
" |
|
148 |
WARNING: Unfinished. |
|
149 |
||
150 |
Experimental implementation of custom font rendered using |
|
151 |
Xft library (UNIX / X Window only), To actually use it, |
|
152 |
add following definitions to the end of stx/configurations/myConf |
|
153 |
(works on Ubuntu 12.10) |
|
154 |
||
155 |
--- snip --- |
|
156 |
XDEFS+=-DXFT |
|
157 |
XINCLUDE+=$(shell pkg-config --cflags xft) |
|
158 |
LIB_XFT=-l:libXft.so.2 -l:libfontconfig.so.1 |
|
159 |
--- snip -- |
|
160 |
||
161 |
NOTE: This class should be named XftFont, however then |
|
162 |
there would be a name clash with XftFont structure |
|
163 |
defined in Xft.h - therefore the class is named |
|
164 |
XftFontDescription to avoid that name clash. |
|
165 |
||
166 |
||
167 |
[author:] |
|
6179 | 168 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
6176 | 169 |
|
170 |
[instance variables:] |
|
171 |
||
172 |
[class variables:] |
|
173 |
||
174 |
[see also:] |
|
175 |
||
176 |
" |
|
177 |
! ! |
|
178 |
||
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
179 |
!XftFontDescription class methodsFor:'initialization'! |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
180 |
|
6327 | 181 |
flushListOfAvailableFonts |
182 |
CachedFontList := nil. |
|
183 |
||
184 |
" |
|
185 |
XftFontDescription flushListOfAvailableFonts |
|
186 |
" |
|
187 |
! |
|
188 |
||
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
189 |
initialize |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
190 |
"Invoked at system start or when the class is dynamically loaded." |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
191 |
|
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
192 |
" Taken from fontconfig,h " |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
193 |
|
8018 | 194 |
FC_FAMILY := 'family'. "/* String */ |
195 |
FC_STYLE := 'style'. "/* String */ |
|
196 |
FC_SLANT := 'slant'. "/* Int */ |
|
197 |
FC_WEIGHT := 'weight'. "/* Int */ |
|
198 |
FC_SIZE := 'size'. "/* Double */ |
|
199 |
FC_ASPECT := 'aspect'. "/* Double */ |
|
200 |
FC_PIXEL_SIZE := 'pixelsize'. "/* Double */ |
|
201 |
FC_SPACING := 'spacing'. "/* Int */ |
|
202 |
FC_FOUNDRY := 'foundry'. "/* String */ |
|
203 |
FC_ANTIALIAS := 'antialias'. "/* Bool (depends) */ |
|
204 |
FC_HINTING := 'hinting'. "/* Bool (true) */ |
|
205 |
FC_HINT_STYLE := 'hintstyle'. "/* Int */ |
|
206 |
FC_VERTICAL_LAYOUT := 'verticallayout'. "/* Bool (false) */ |
|
207 |
FC_AUTOHINT := 'autohint'. "/* Bool (false) */ |
|
208 |
FC_WIDTH := 'width'. "/* Int */ |
|
209 |
FC_FILE := 'file'. "/* String */ |
|
210 |
FC_INDEX := 'index'. "/* Int */ |
|
211 |
FC_FT_FACE := 'ftface'. "/* FT_Face */ |
|
212 |
FC_RASTERIZER := 'rasterizer'. "/* String */ |
|
213 |
FC_OUTLINE := 'outline'. "/* Bool */ |
|
214 |
FC_SCALABLE := 'scalable'. "/* Bool */ |
|
215 |
FC_SCALE := 'scale'. "/* double */ |
|
216 |
FC_DPI := 'dpi'. "/* double */ |
|
217 |
FC_RGBA := 'rgba'. "/* Int */ |
|
218 |
FC_MINSPACE := 'minspace'. "/* Bool use minimum line spacing */ |
|
219 |
FC_SOURCE := 'source'. "/* String (deprecated) */ |
|
220 |
FC_CHARSET := 'charset'. "/* CharSet */ |
|
221 |
FC_LANG := 'lang'. "/* String RFC 3066 langs */ |
|
222 |
FC_FONTVERSION := 'fontversion'. "/* Int from 'head'.table */ |
|
223 |
FC_FULLNAME := 'fullname'. "/* String */ |
|
224 |
FC_FAMILYLANG := 'familylang'. "/* String RFC 3066 langs */ |
|
225 |
FC_STYLELANG := 'stylelang'. "/* String RFC 3066 langs */ |
|
226 |
FC_FULLNAMELANG := 'fullnamelang'. "/* String RFC 3066 langs */ |
|
227 |
FC_CAPABILITY := 'capability'. "/* String */ |
|
228 |
FC_FONTFORMAT := 'fontformat'. "/* String */ |
|
229 |
FC_EMBOLDEN := 'embolden'. "/* Bool - true if emboldening needed*/ |
|
230 |
FC_EMBEDDED_BITMAP := 'embeddedbitmap'. "/* Bool - true to enable embedded bitmaps */ |
|
231 |
FC_DECORATIVE := 'decorative'. "/* Bool - true if style is a decorative variant */ |
|
232 |
FC_LCD_FILTER := 'lcdfilter'. "/* Int */ |
|
233 |
FC_NAMELANG := 'namelang'. "/* String RFC 3866 langs */ |
|
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
234 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
235 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
236 |
"Adjust outline rasterizer" |
8018 | 237 |
FC_CHAR_WIDTH := 'charwidth'. "/* Int */ |
238 |
FC_CHAR_HEIGHT := 'charheight'. "/* Int */ |
|
239 |
FC_MATRIX := 'matrix'. "/* FcMatrix */ |
|
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
240 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
241 |
FC_WEIGHT_THIN := 0. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
242 |
FC_WEIGHT_EXTRALIGHT := 40. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
243 |
FC_WEIGHT_ULTRALIGHT := FC_WEIGHT_EXTRALIGHT. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
244 |
FC_WEIGHT_LIGHT := 50. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
245 |
FC_WEIGHT_BOOK := 75. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
246 |
FC_WEIGHT_REGULAR := 80. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
247 |
FC_WEIGHT_NORMAL := FC_WEIGHT_REGULAR. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
248 |
FC_WEIGHT_MEDIUM := 100. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
249 |
FC_WEIGHT_DEMIBOLD := 180. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
250 |
FC_WEIGHT_SEMIBOLD := FC_WEIGHT_DEMIBOLD. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
251 |
FC_WEIGHT_BOLD := 200. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
252 |
FC_WEIGHT_EXTRABOLD := 205. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
253 |
FC_WEIGHT_ULTRABOLD := FC_WEIGHT_EXTRABOLD. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
254 |
FC_WEIGHT_BLACK := 210. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
255 |
FC_WEIGHT_HEAVY := FC_WEIGHT_BLACK. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
256 |
FC_WEIGHT_EXTRABLACK := 215. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
257 |
FC_WEIGHT_ULTRABLACK := FC_WEIGHT_EXTRABLACK. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
258 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
259 |
FC_SLANT_ROMAN := 0. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
260 |
FC_SLANT_ITALIC := 100. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
261 |
FC_SLANT_OBLIQUE := 110. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
262 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
263 |
FC_WIDTH_ULTRACONDENSED := 50. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
264 |
FC_WIDTH_EXTRACONDENSED := 63. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
265 |
FC_WIDTH_CONDENSED := 75. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
266 |
FC_WIDTH_SEMICONDENSED := 87. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
267 |
FC_WIDTH_NORMAL := 100. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
268 |
FC_WIDTH_SEMIEXPANDED := 113. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
269 |
FC_WIDTH_EXPANDED := 125. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
270 |
FC_WIDTH_EXTRAEXPANDED := 150. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
271 |
FC_WIDTH_ULTRAEXPANDED := 200. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
272 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
273 |
FC_PROPORTIONAL := 0. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
274 |
FC_DUAL := 90. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
275 |
FC_MONO := 100. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
276 |
FC_CHARCELL := 110. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
277 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
278 |
"sub-pixel order" |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
279 |
FC_RGBA_UNKNOWN := 0. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
280 |
FC_RGBA_RGB := 1. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
281 |
FC_RGBA_BGR := 2. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
282 |
FC_RGBA_VRGB := 3. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
283 |
FC_RGBA_VBGR := 4. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
284 |
FC_RGBA_NONE := 5. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
285 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
286 |
"hinting style" |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
287 |
FC_HINT_NONE := 0. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
288 |
FC_HINT_SLIGHT := 1. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
289 |
FC_HINT_MEDIUM := 2. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
290 |
FC_HINT_FULL := 3. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
291 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
292 |
"LCD filter" |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
293 |
FC_LCD_NONE := 0. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
294 |
FC_LCD_DEFAULT := 1. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
295 |
FC_LCD_LIGHT := 2. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
296 |
FC_LCD_LEGACY := 3. |
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
297 |
|
8018 | 298 |
StXFace2FCWeightMap := |
299 |
Dictionary withKeysAndValues:{ |
|
300 |
#thin. FC_WEIGHT_THIN. |
|
301 |
#extralight. FC_WEIGHT_EXTRALIGHT. |
|
302 |
#ultralight. FC_WEIGHT_ULTRALIGHT. |
|
303 |
#light. FC_WEIGHT_LIGHT. |
|
304 |
#book. FC_WEIGHT_BOOK. |
|
305 |
#regular. FC_WEIGHT_REGULAR. |
|
306 |
#normal. FC_WEIGHT_NORMAL. |
|
307 |
#medium. FC_WEIGHT_MEDIUM. |
|
308 |
#demibold. FC_WEIGHT_DEMIBOLD. |
|
309 |
#semibold. FC_WEIGHT_SEMIBOLD. |
|
310 |
#bold. FC_WEIGHT_BOLD. |
|
311 |
#extrabold. FC_WEIGHT_EXTRABOLD. |
|
312 |
#ultrabold. FC_WEIGHT_ULTRABOLD. |
|
313 |
#black. FC_WEIGHT_BLACK. |
|
314 |
#heavy. FC_WEIGHT_HEAVY. |
|
315 |
#extrablack. FC_WEIGHT_EXTRABLACK. |
|
316 |
#ultrablack. FC_WEIGHT_ULTRABLACK. |
|
317 |
}. |
|
318 |
||
319 |
StXStyle2FCSlantMap := |
|
320 |
Dictionary withKeysAndValues:{ |
|
321 |
#roman. FC_SLANT_ROMAN. |
|
322 |
#italic. FC_SLANT_ITALIC. |
|
323 |
#oblique. FC_SLANT_OBLIQUE. |
|
324 |
}. |
|
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
325 |
|
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
326 |
"Modified: / 30-12-2013 / 19:48:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
327 |
! ! |
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
328 |
|
6325 | 329 |
!XftFontDescription class methodsFor:'instance creation'! |
330 |
||
6993 | 331 |
for:aFontOrFontDescription |
332 |
^ self |
|
7114 | 333 |
family:aFontOrFontDescription family |
334 |
face:aFontOrFontDescription face |
|
335 |
style:aFontOrFontDescription style |
|
336 |
size:aFontOrFontDescription size |
|
337 |
sizeUnit:#pt |
|
338 |
encoding:aFontOrFontDescription encoding |
|
6993 | 339 |
! |
340 |
||
6325 | 341 |
new |
6963 | 342 |
^ self basicNew initialize. |
6325 | 343 |
! ! |
344 |
||
6957 | 345 |
!XftFontDescription class methodsFor:'change & update'! |
346 |
||
347 |
aboutToDestroyViewWithDevice:aDevice id:aWindowId |
|
348 |
"a view is going to be destroyed. |
|
349 |
Have to disassociate the XftDrawId from the drawableId aWindowId" |
|
350 |
||
7567 | 351 |
"/ no longer used... |
352 |
"/ Lobby do:[:eachXftFont| |
|
353 |
"/ eachXftFont graphicsDevice == aDevice ifTrue:[ |
|
354 |
"/ eachXftFont disassociateXftDrawableFrom:aWindowId. |
|
355 |
"/ ]. |
|
356 |
"/ ]. |
|
6957 | 357 |
! ! |
358 |
||
6176 | 359 |
!XftFontDescription class methodsFor:'examples'! |
360 |
||
361 |
example1 |
|
362 |
" |
|
363 |
XftFontDescription example1 |
|
364 |
" |
|
365 |
|top textView| |
|
366 |
||
367 |
top := StandardSystemView new. |
|
368 |
top extent:300@200. |
|
369 |
||
370 |
textView := EditTextView new. |
|
371 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
372 |
textView basicFont: (XftFontDescription family: 'DejaVu Sans' size: 16). |
6176 | 373 |
|
374 |
top addSubView:textView. |
|
375 |
||
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
376 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile asText). |
6176 | 377 |
|
378 |
top open. |
|
379 |
||
380 |
"Created: / 20-12-2013 / 00:04:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
381 |
"Modified: / 30-12-2013 / 19:11:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
382 |
! |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
383 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
384 |
example2 |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
385 |
" |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
386 |
XftFontDescription example2 |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
387 |
" |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
388 |
|top textView| |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
389 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
390 |
top := StandardSystemView new. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
391 |
top extent:300@200. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
392 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
393 |
textView := EditTextView new. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
394 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
395 |
textView basicFont: (XftFontDescription family: 'DejaVu Sans' size: 30) asItalic. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
396 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
397 |
top addSubView:textView. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
398 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
399 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
400 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
401 |
top open. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
402 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
403 |
"Created: / 30-12-2013 / 19:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6389 | 404 |
! |
405 |
||
406 |
example3 |
|
407 |
" |
|
408 |
XftFontDescription example2 |
|
409 |
" |
|
410 |
|top textView| |
|
411 |
||
412 |
top := StandardSystemView new. |
|
413 |
top extent:300@200. |
|
414 |
||
415 |
textView := EditTextView new. |
|
416 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
417 |
textView basicFont: (XftFontDescription family: 'Indie Flower' size: 30). |
|
418 |
||
419 |
top addSubView:textView. |
|
420 |
||
421 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
422 |
||
423 |
top open. |
|
424 |
||
425 |
"Created: / 30-12-2013 / 19:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
426 |
! ! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
427 |
|
6936 | 428 |
!XftFontDescription class methodsFor:'primitives'! |
429 |
||
430 |
xftAvailable |
|
431 |
%{ |
|
432 |
#ifdef XFT |
|
433 |
RETURN ( true ) |
|
434 |
#endif |
|
435 |
%}. |
|
436 |
^ false |
|
437 |
||
438 |
"Created: / 20-12-2013 / 21:10:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
439 |
! |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
440 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
441 |
xftFontClose:fontIdArg displayId:displayId |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
442 |
| error | |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
443 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
444 |
%{ /* STACK: 64000 */ |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
445 |
#ifdef XFT |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
446 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
8018 | 447 |
error = @symbol(BadArg1); |
448 |
goto err; |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
449 |
} |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
450 |
if ( ! __isExternalAddressLike(displayId) ) { |
8018 | 451 |
error = @symbol(BadArg2); |
452 |
goto err; |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
453 |
} |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
454 |
XftFontClose (DISPLAY(displayId), XFT_FONT(fontIdArg)); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
455 |
RETURN(self); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
456 |
err:; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
457 |
#endif |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
458 |
%}. |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
459 |
self primitiveFailed: error |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
460 |
! |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
461 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
462 |
xftFontGetAscent: fontIdArg |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
463 |
| error | |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
464 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
465 |
%{ /* STACK: 64000 */ |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
466 |
#ifdef XFT |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
467 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
8018 | 468 |
error = @symbol(BadArg1); |
469 |
goto err; |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
470 |
} |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
471 |
RETURN ( __MKINT( XFT_FONT(fontIdArg)->ascent ) ); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
472 |
err:; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
473 |
#endif |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
474 |
%}. |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
475 |
self primitiveFailed: error |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
476 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
477 |
"Created: / 21-12-2013 / 00:56:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
478 |
! |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
479 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
480 |
xftFontGetDescent:fontIdArg |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
481 |
| error | |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
482 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
483 |
%{ /* STACK: 64000 */ |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
484 |
#ifdef XFT |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
485 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
8018 | 486 |
error = @symbol(BadArg1); |
487 |
goto err; |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
488 |
} |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
489 |
RETURN ( __MKINT( XFT_FONT(fontIdArg)->descent ) ); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
490 |
err:; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
491 |
#endif |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
492 |
%}. |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
493 |
self primitiveFailed: error |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
494 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
495 |
"Created: / 21-12-2013 / 00:56:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
496 |
! |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
497 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
498 |
xftFontGetHeight: fontIdArg |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
499 |
| error | |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
500 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
501 |
%{ /* STACK: 64000 */ |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
502 |
#ifdef XFT |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
503 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
8018 | 504 |
error = @symbol(BadArg1); |
505 |
goto err; |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
506 |
} |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
507 |
RETURN ( __MKINT( XFT_FONT(fontIdArg)->height ) ); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
508 |
err:; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
509 |
#endif |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
510 |
%}. |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
511 |
self primitiveFailed: error |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
512 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
513 |
"Created: / 21-12-2013 / 00:56:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
514 |
! |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
515 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
516 |
xftFontGetMaxAdvanceWidth: fontIdArg |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
517 |
| error | |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
518 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
519 |
%{ /* STACK: 64000 */ |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
520 |
#ifdef XFT |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
521 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
8018 | 522 |
error = @symbol(BadArg1); |
523 |
goto err; |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
524 |
} |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
525 |
RETURN ( __MKINT( XFT_FONT(fontIdArg)->max_advance_width ) ); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
526 |
err:; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
527 |
#endif |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
528 |
%}. |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
529 |
self primitiveFailed: error |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
530 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
531 |
"Created: / 30-12-2013 / 20:02:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
532 |
! |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
533 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
534 |
xftFontGetPattern: fontIdArg |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
535 |
| error | |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
536 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
537 |
%{ /* STACK: 64000 */ |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
538 |
#ifdef XFT |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
539 |
XftPattern* p; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
540 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
541 |
error = @symbol(BadArg1); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
542 |
goto err; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
543 |
} |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
544 |
p = XFT_FONT(fontIdArg)->pattern; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
545 |
if (p == NULL) { |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
546 |
RETURN ( nil ); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
547 |
} else { |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
548 |
RETURN ( FC_PATTERN_HANDLE_NEW ( p ) ); |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
549 |
} |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
550 |
err:; |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
551 |
#endif |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
552 |
%}. |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
553 |
self primitiveFailed: error |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
554 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
555 |
"Created: / 21-12-2013 / 00:55:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6936 | 556 |
! ! |
557 |
||
6263 | 558 |
!XftFontDescription class methodsFor:'queries'! |
559 |
||
560 |
listOfAvailableFonts |
|
6264 | 561 |
"uses fc-list to get a list of available fontDescriptions" |
562 |
||
6263 | 563 |
CachedFontList isNil ifTrue:[ |
8018 | 564 |
CachedFontList := FCFontListParser new listOfAvailableFonts |
6263 | 565 |
]. |
566 |
^ CachedFontList |
|
567 |
||
568 |
" |
|
6337 | 569 |
XftFontDescription flushListOfAvailableFonts. |
6319 | 570 |
XftFontDescription listOfAvailableFonts |
6263 | 571 |
" |
572 |
! ! |
|
573 |
||
6317 | 574 |
!XftFontDescription methodsFor:'accessing'! |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
575 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
576 |
encoding |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
577 |
^ encoding ? #'iso10646-1' |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
578 |
! |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
579 |
|
6319 | 580 |
face |
581 |
^ face ? '' |
|
582 |
! |
|
583 |
||
584 |
fullName |
|
585 |
^ name ? (self userFriendlyName) |
|
586 |
! |
|
587 |
||
6317 | 588 |
graphicsDevice |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
589 |
^ device |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
590 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
591 |
"Created: / 02-01-2014 / 23:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6319 | 592 |
! |
593 |
||
594 |
maxCode |
|
6323 | 595 |
^ maxCode ? 16rFFFF |
6319 | 596 |
! |
597 |
||
598 |
maxCode:something |
|
599 |
maxCode := something. |
|
600 |
! |
|
601 |
||
602 |
minCode |
|
6323 | 603 |
^ minCode ? 0 |
6319 | 604 |
! |
605 |
||
606 |
minCode:something |
|
607 |
minCode := something. |
|
608 |
! |
|
609 |
||
610 |
style |
|
611 |
^ style ? '' |
|
6391 | 612 |
! |
613 |
||
614 |
weight:aNumber |
|
7121 | 615 |
"set the weight. The face is the string representation of weight." |
6391 | 616 |
|
617 |
self assert:(self fontId isNil). "/ cannot change an instantiated font |
|
618 |
||
7121 | 619 |
weight := aNumber. |
620 |
||
621 |
aNumber == FC_WEIGHT_THIN ifTrue:[ face := #thin. ^ self]. |
|
622 |
aNumber == FC_WEIGHT_EXTRALIGHT ifTrue:[ face := #extralight. ^ self]. |
|
623 |
aNumber == FC_WEIGHT_LIGHT ifTrue:[ face := #light. ^ self]. |
|
624 |
aNumber == FC_WEIGHT_BOOK ifTrue:[ face := #book. ^ self]. |
|
625 |
aNumber == FC_WEIGHT_REGULAR ifTrue:[ face := #regular. ^ self]. |
|
626 |
aNumber == FC_WEIGHT_MEDIUM ifTrue:[ face := #medium. ^ self]. |
|
627 |
aNumber == FC_WEIGHT_DEMIBOLD ifTrue:[ face := #demibold. ^ self]. |
|
628 |
aNumber == FC_WEIGHT_BOLD ifTrue:[ face := #bold. ^ self]. |
|
629 |
aNumber == FC_WEIGHT_EXTRABOLD ifTrue:[ face := #extrabold. ^ self]. |
|
630 |
aNumber == FC_WEIGHT_BLACK ifTrue:[ face := #black. ^ self]. |
|
631 |
aNumber == FC_WEIGHT_EXTRABLACK ifTrue:[ face := #extrablack. ^ self]. |
|
6391 | 632 |
|
633 |
aNumber <= (FC_WEIGHT_EXTRALIGHT + FC_WEIGHT_LIGHT // 2) ifTrue:[ |
|
7221 | 634 |
face := #extralight. |
635 |
^ self. |
|
6391 | 636 |
]. |
637 |
aNumber <= (FC_WEIGHT_LIGHT + FC_WEIGHT_BOOK // 2) ifTrue:[ |
|
7221 | 638 |
face := #light. |
639 |
^ self. |
|
6391 | 640 |
]. |
641 |
aNumber <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD // 2) ifTrue:[ |
|
7221 | 642 |
face := #medium. |
643 |
^ self. |
|
6391 | 644 |
]. |
645 |
aNumber <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD // 2) ifTrue:[ |
|
7221 | 646 |
face := #demibold. |
647 |
^ self. |
|
6391 | 648 |
]. |
649 |
aNumber <= (FC_WEIGHT_BOLD + FC_WEIGHT_BLACK // 2) ifTrue:[ |
|
7221 | 650 |
face := #bold. |
651 |
^ self. |
|
6391 | 652 |
]. |
7121 | 653 |
face := #extrabold. |
6391 | 654 |
^ self |
655 |
||
656 |
"/ FC_WEIGHT_THIN := 0. |
|
657 |
"/ FC_WEIGHT_EXTRALIGHT := 40. |
|
658 |
"/ FC_WEIGHT_ULTRALIGHT := FC_WEIGHT_EXTRALIGHT. |
|
659 |
"/ FC_WEIGHT_LIGHT := 50. |
|
660 |
"/ FC_WEIGHT_BOOK := 75. |
|
661 |
"/ FC_WEIGHT_REGULAR := 80. |
|
662 |
"/ FC_WEIGHT_NORMAL := FC_WEIGHT_REGULAR. |
|
663 |
"/ FC_WEIGHT_MEDIUM := 100. |
|
664 |
"/ FC_WEIGHT_DEMIBOLD := 180. |
|
665 |
"/ FC_WEIGHT_SEMIBOLD := FC_WEIGHT_DEMIBOLD. |
|
666 |
"/ FC_WEIGHT_BOLD := 200. |
|
667 |
"/ FC_WEIGHT_EXTRABOLD := 205. |
|
668 |
"/ FC_WEIGHT_ULTRABOLD := FC_WEIGHT_EXTRABOLD. |
|
669 |
"/ FC_WEIGHT_BLACK := 210. |
|
670 |
"/ FC_WEIGHT_HEAVY := FC_WEIGHT_BLACK. |
|
671 |
"/ FC_WEIGHT_EXTRABLACK := 215. |
|
672 |
"/ FC_WEIGHT_ULTRABLACK := FC_WEIGHT_EXTRABLACK. |
|
6317 | 673 |
! ! |
674 |
||
675 |
!XftFontDescription methodsFor:'accessing-private'! |
|
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
676 |
|
7443 | 677 |
getXftFontId |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
678 |
^ fontId |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
679 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
680 |
"Created: / 02-01-2014 / 23:29:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7114 | 681 |
! |
682 |
||
683 |
setFontId:fontIdArg |
|
684 |
fontId := fontIdArg. |
|
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
685 |
! ! |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
686 |
|
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
687 |
!XftFontDescription methodsFor:'converting'! |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
688 |
|
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
689 |
asNonXftFont |
7870 | 690 |
"in some situations, we do not want an Xft font..." |
8018 | 691 |
|
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
692 |
|newFont| |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
693 |
|
7707 | 694 |
newFont := Font |
8018 | 695 |
family:family |
696 |
face:face |
|
697 |
style:style |
|
698 |
size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) |
|
699 |
sizeUnit:sizeUnit |
|
700 |
encoding:encoding. |
|
7877 | 701 |
newFont isForceNonXFTFont:true. |
6656 | 702 |
^ newFont |
7870 | 703 |
|
7877 | 704 |
" |
705 |
|view1 view2| |
|
706 |
||
707 |
view1 := TextView new openAndWait. |
|
708 |
view2 := TextView new openAndWait. |
|
709 |
view1 font:(Button defaultFont). |
|
710 |
view1 contents:'Hello world'. |
|
711 |
view2 font:(Button defaultFont asNonXftFont onDevice:Display). |
|
712 |
view2 contents:'Hello world'. |
|
713 |
" |
|
714 |
||
715 |
"Modified (comment): / 12-02-2017 / 22:14:47 / cg" |
|
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
716 |
! ! |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
717 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
718 |
!XftFontDescription methodsFor:'error reporting'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
719 |
|
6198 | 720 |
primitiveFailed |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
721 |
<resource: #skipInDebuggersWalkBack> |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
722 |
|
6936 | 723 |
self class xftAvailable ifFalse:[ |
7114 | 724 |
super primitiveFailed:'Xft support is not configured'. |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
725 |
]. |
6198 | 726 |
super primitiveFailed |
727 |
! |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
728 |
|
6198 | 729 |
primitiveFailed:errorString |
730 |
<resource: #skipInDebuggersWalkBack> |
|
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
731 |
|
6936 | 732 |
self class xftAvailable ifFalse:[ |
7114 | 733 |
super primitiveFailed:'Xft support is not configured'. |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
734 |
]. |
6198 | 735 |
super primitiveFailed:errorString |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
736 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
737 |
|
6946 | 738 |
!XftFontDescription methodsFor:'finalization'! |
739 |
||
740 |
finalize |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
741 |
self releaseFromDevice |
6946 | 742 |
! ! |
743 |
||
6176 | 744 |
!XftFontDescription methodsFor:'getting a device font'! |
745 |
||
7443 | 746 |
installInDeviceForGCId:aGCId |
747 |
"install the font for aGCId" |
|
748 |
||
749 |
(device isNil or:[fontId isNil]) ifTrue:[ |
|
8018 | 750 |
Logger error:'no device font for: %1' with:self. |
751 |
^ nil. |
|
7443 | 752 |
]. |
753 |
"nothing to install" |
|
754 |
! |
|
755 |
||
6176 | 756 |
onDevice:aGraphicsDevice |
757 |
"Create a new XftFont representing the closes font as |
|
758 |
myself on aDevice; if one already exists, return the one." |
|
759 |
||
7219 | 760 |
^ self onDevice:aGraphicsDevice ifAbsent:self |
7114 | 761 |
! |
762 |
||
763 |
onDevice:aGraphicsDevice ifAbsent:aBlock |
|
7559 | 764 |
"Create a new XftFont representing the closest font as |
7114 | 765 |
myself on aDevice; if one already exists, return the one." |
6176 | 766 |
|
7559 | 767 |
|displayId myPatternHandle closestPatternHandle newFontId computedWeight deviceFont| |
6176 | 768 |
|
7114 | 769 |
(device == aGraphicsDevice) ifTrue:[ |
8018 | 770 |
"I am already assigned to that device ..." |
771 |
^ self |
|
7114 | 772 |
]. |
773 |
aGraphicsDevice isNil ifTrue:[ |
|
8018 | 774 |
^ self |
6544 | 775 |
]. |
7121 | 776 |
aGraphicsDevice supportsXftFonts ifFalse:[ |
8018 | 777 |
^ self asNonXftFont onDevice:aGraphicsDevice. |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
778 |
]. |
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
779 |
|
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
780 |
deviceFont := aGraphicsDevice deviceFonts detect:[:eachFont | self sameDeviceFontAs:eachFont] ifNone:[]. |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
781 |
deviceFont notNil ifTrue:[ |
8018 | 782 |
^ deviceFont. |
6389 | 783 |
]. |
784 |
||
7121 | 785 |
computedWeight := weight. |
786 |
computedWeight isNil ifTrue:[ |
|
8018 | 787 |
computedWeight := StXFace2FCWeightMap at:(face ? '') asLowercase ifAbsent:[FC_WEIGHT_REGULAR]. |
7121 | 788 |
]. |
789 |
||
7673 | 790 |
(OperatingSystem isMAClike and:[FirstTimeCalled ~~ false]) ifTrue:[ |
8018 | 791 |
"Slow font matching is a MAC-only feature" |
792 |
Logger info:'XFT: matching font (this may take a long time, if the system''s font cache needs to be filled first. Be patient...'. |
|
793 |
FirstTimeCalled := false. |
|
7559 | 794 |
]. |
795 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
796 |
[ |
8018 | 797 |
myPatternHandle := FCPatternHandle create. |
798 |
myPatternHandle |
|
799 |
add:FC_FOUNDRY value:manufacturer; |
|
800 |
add:FC_FAMILY value:family; |
|
801 |
add:FC_WEIGHT value:computedWeight; |
|
802 |
add:FC_SLANT value:(StXStyle2FCSlantMap at:(style ? '') asLowercase ifAbsent:[FC_SLANT_ROMAN]). |
|
803 |
sizeUnit = #px ifTrue:[ |
|
804 |
myPatternHandle add:FC_PIXEL_SIZE value:(pixelSize isNil ifTrue:[nil] ifFalse:[pixelSize rounded]). |
|
805 |
] ifFalse:[ |
|
806 |
myPatternHandle add:FC_SIZE value:(size isNil ifTrue:[nil] ifFalse:[size rounded]). |
|
807 |
]. |
|
7114 | 808 |
|
8018 | 809 |
displayId := aGraphicsDevice displayId. |
810 |
closestPatternHandle := myPatternHandle matchFontOnDisplayId:displayId screen:aGraphicsDevice screen. |
|
811 |
closestPatternHandle notNil ifTrue:[ |
|
812 |
newFontId := closestPatternHandle getFontOnDisplayId:displayId. |
|
813 |
newFontId notNil ifTrue:[ |
|
814 |
"/ Good, this font exists!! |
|
815 |
device isNil ifTrue:[ |
|
816 |
deviceFont := self. |
|
817 |
] ifFalse:[ |
|
818 |
deviceFont := self copy. |
|
819 |
]. |
|
820 |
closestPatternHandle := nil. |
|
821 |
deviceFont setDevice:aGraphicsDevice patternId:nil fontId:newFontId. |
|
822 |
aGraphicsDevice registerFont:deviceFont. |
|
823 |
^ deviceFont. |
|
824 |
]. |
|
825 |
]. |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
826 |
] ensure:[ |
8018 | 827 |
myPatternHandle notNil ifTrue:[myPatternHandle destroy]. |
828 |
closestPatternHandle notNil ifTrue:[closestPatternHandle destroy]. |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
829 |
]. |
7114 | 830 |
^ aBlock value |
6176 | 831 |
|
832 |
" |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
833 |
(XftFontDescription family:'monospace' size:16) onDevice:Screen current |
6176 | 834 |
" |
835 |
||
836 |
"Modified: / 14-04-1997 / 18:22:31 / cg" |
|
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
837 |
"Modified: / 02-01-2014 / 23:43:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6176 | 838 |
! ! |
839 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
840 |
!XftFontDescription methodsFor:'initialization'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
841 |
|
6963 | 842 |
initialize |
843 |
"Invoked when a new instance is created." |
|
844 |
||
845 |
super initialize. |
|
846 |
size := 0. |
|
847 |
encoding := #'iso10646-1'. |
|
848 |
! |
|
849 |
||
6993 | 850 |
isScaledFont |
851 |
^ true |
|
852 |
! |
|
853 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
854 |
setDevice: deviceArg patternId: patternIdArg fontId: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
855 |
device := deviceArg. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
856 |
fontId := fontIdArg. |
6325 | 857 |
patternIdArg notNil ifTrue:[ |
7114 | 858 |
family := patternIdArg get: FC_FAMILY index: 0. |
859 |
size := patternIdArg get: FC_SIZE index: 0. |
|
8018 | 860 |
weight := patternIdArg get: FC_WEIGHT index: 0. |
861 |
face := StXFace2FCWeightMap keyAtValue: weight. |
|
862 |
slant := patternIdArg get: FC_SLANT index: 0. |
|
863 |
style := StXStyle2FCSlantMap keyAtValue: slant. |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
864 |
|
8018 | 865 |
"/ name := patternIdArg get: 'fullname' index: 0. |
866 |
"/ encoding:= patternIdArg get: 'encoding' index: 0. |
|
6957 | 867 |
]. |
868 |
size isNil ifTrue:[ |
|
7114 | 869 |
size := 0. |
6325 | 870 |
]. |
6963 | 871 |
encoding isNil ifTrue:[ |
7114 | 872 |
encoding := #'iso10646-1'. |
6963 | 873 |
]. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
874 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
875 |
"Created: / 21-12-2013 / 00:46:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
876 |
"Modified: / 30-12-2013 / 12:49:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
877 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
878 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
879 |
!XftFontDescription methodsFor:'primitives'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
880 |
|
7563 | 881 |
xftTextExtents:displayIdArg string:aString from:start to:stop into:extentsArrayOrNil |
882 |
"get the extents of aString. |
|
883 |
Answer thr width of aString (in reality the xOff). |
|
884 |
If extentArrayOrNil is an Array, fill is with the extent info: |
|
8018 | 885 |
#(width height x y xOff yOff ascent descent)." |
7563 | 886 |
|
887 |
|error bytesPerCharacter| |
|
888 |
||
889 |
bytesPerCharacter := aString bytesPerCharacter. |
|
7114 | 890 |
|
891 |
%{ /* STACK: 64000 */ |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
892 |
#ifdef XFT |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
893 |
XGlyphInfo info; |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
894 |
char *string; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
895 |
int len; |
7563 | 896 |
int __bytesPerCharacter = __intVal(bytesPerCharacter); |
8018 | 897 |
OBJ fontIdArg = __INST(fontId); |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
898 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
899 |
if ( ! __isExternalAddressLike(displayIdArg) ) { |
8018 | 900 |
error = @symbol(BadArg1); |
901 |
goto err; |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
902 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
903 |
if ( ! __isSmallInteger(start) ) { |
8018 | 904 |
error = @symbol(BadArg3); |
905 |
goto err; |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
906 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
907 |
if ( ! __isSmallInteger(stop) ) { |
8018 | 908 |
error = @symbol(BadArg4); |
909 |
goto err; |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
910 |
} |
8018 | 911 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
912 |
error = @symbol(BadFontId); |
|
913 |
goto err; |
|
7563 | 914 |
} |
915 |
||
916 |
string = __stringVal(aString) + ((__intVal(start) - 1) * __bytesPerCharacter); |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
917 |
len = __intVal(stop) - __intVal(start) + 1; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
918 |
|
7563 | 919 |
switch (__bytesPerCharacter) { |
8018 | 920 |
case 1: |
921 |
XftTextExtents8(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar8*)string, len, &info); |
|
922 |
break; |
|
923 |
case 2: |
|
924 |
XftTextExtents16(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar16*)string, len, &info); |
|
925 |
break; |
|
926 |
case 4: |
|
927 |
XftTextExtents32(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar32*)string, len, &info); |
|
928 |
break; |
|
929 |
default: |
|
930 |
error = @symbol(BadArg2); |
|
931 |
goto err; |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
932 |
} |
7563 | 933 |
|
934 |
if (extentsArrayOrNil != nil && __isArray(extentsArrayOrNil)) { |
|
8018 | 935 |
switch (__arraySize(extentsArrayOrNil)) { |
936 |
case 8: |
|
937 |
__arrayVal(extentsArrayOrNil)[7] = __MKSMALLINT(XFT_FONT(fontIdArg)->descent); |
|
938 |
// fall into |
|
939 |
case 7: |
|
940 |
__arrayVal(extentsArrayOrNil)[6] = __MKSMALLINT(XFT_FONT(fontIdArg)->ascent); |
|
941 |
// fall into |
|
942 |
case 6: |
|
943 |
__arrayVal(extentsArrayOrNil)[5] = __MKSMALLINT(info.yOff); |
|
944 |
// fall into |
|
945 |
case 5: |
|
946 |
__arrayVal(extentsArrayOrNil)[4] = __MKSMALLINT(info.xOff); |
|
947 |
// fall into |
|
948 |
case 4: |
|
949 |
__arrayVal(extentsArrayOrNil)[3] = __MKSMALLINT(info.y); |
|
950 |
// fall into |
|
951 |
case 3: |
|
952 |
__arrayVal(extentsArrayOrNil)[2] = __MKSMALLINT(info.x); |
|
953 |
// fall into |
|
954 |
case 2: |
|
955 |
{ |
|
956 |
int height; |
|
957 |
||
958 |
height = info.height; |
|
959 |
#if 0 |
|
960 |
height = XFT_FONT(fontIdArg)->descent + XFT_FONT(fontIdArg)->ascent; |
|
961 |
#endif |
|
962 |
__arrayVal(extentsArrayOrNil)[1] = __MKSMALLINT(height); |
|
963 |
} |
|
964 |
// fall into |
|
965 |
case 1: |
|
966 |
__arrayVal(extentsArrayOrNil)[0] = __MKSMALLINT(info.width); |
|
967 |
// fall into |
|
968 |
case 0: |
|
969 |
break; |
|
970 |
} |
|
7563 | 971 |
} |
972 |
||
973 |
RETURN(__MKSMALLINT(info.xOff)); |
|
974 |
||
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
975 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
976 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
977 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
978 |
error notNil ifTrue:[ |
8018 | 979 |
self primitiveFailed: error. |
980 |
^ nil. |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
981 |
]. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
982 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
983 |
"Created: / 21-12-2013 / 10:42:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6186
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
984 |
"Modified: / 30-12-2013 / 20:00:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
985 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
986 |
|
6198 | 987 |
!XftFontDescription methodsFor:'printing & storing'! |
988 |
||
989 |
storeOn:aStream |
|
990 |
"append a character sequence to the argument, aStream from which the |
|
991 |
receiver can be reconstructed using readFrom:." |
|
992 |
||
993 |
aStream nextPutAll:'(XftFontDescription family:'. family storeOn:aStream. |
|
994 |
aStream nextPutAll:' face:'. face storeOn:aStream. |
|
995 |
aStream nextPutAll:' style:'. style storeOn:aStream. |
|
996 |
aStream nextPutAll:' size:'. size storeOn:aStream. |
|
997 |
aStream nextPutAll:' encoding:'. encoding storeOn:aStream. |
|
998 |
aStream nextPut:$) |
|
999 |
||
1000 |
" |
|
1001 |
(XftFontDescription family: 'DejaVu Sans' size: 8) storeString |
|
1002 |
" |
|
1003 |
! ! |
|
1004 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1005 |
!XftFontDescription methodsFor:'queries-dimensions'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1006 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1007 |
ascent |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1008 |
"return the ascent - the number of pixels above the baseLine." |
6656 | 1009 |
ascent isNil ifTrue:[ |
8018 | 1010 |
ascent := self class xftFontGetAscent: fontId |
6656 | 1011 |
]. |
1012 |
^ ascent |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1013 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1014 |
"Created: / 21-12-2013 / 01:19:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1015 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1016 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1017 |
descent |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1018 |
"return the descent - the number of pixels below the baseLine." |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1019 |
|
6656 | 1020 |
descent isNil ifTrue:[ |
8018 | 1021 |
descent := self class xftFontGetDescent: fontId |
6656 | 1022 |
]. |
1023 |
^ descent |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1024 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1025 |
"Created: / 21-12-2013 / 01:20:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1026 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1027 |
|
6314 | 1028 |
getFontMetrics |
1029 |
|info| |
|
1030 |
||
1031 |
info := DeviceWorkstation::DeviceFontMetrics new. |
|
1032 |
info |
|
1033 |
ascent:self ascent |
|
1034 |
descent:self descent |
|
1035 |
maxAscent:self maxAscent |
|
1036 |
maxDescent:self maxDescent |
|
1037 |
minWidth:self maxWidth |
|
1038 |
maxWidth:self maxWidth |
|
1039 |
avgWidth:self maxWidth |
|
1040 |
minCode:self minCode |
|
1041 |
maxCode:self maxCode |
|
1042 |
direction:#LeftToRight. |
|
1043 |
^ info |
|
1044 |
! |
|
1045 |
||
6543 | 1046 |
getFontResolution |
1047 |
device isNil ifTrue:[ ^ 72 @ 72 ]. |
|
1048 |
^ device resolution |
|
1049 |
! |
|
1050 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1051 |
height |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1052 |
"return the height - the number of pixels above plus below the baseLine." |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1053 |
|
6656 | 1054 |
height isNil ifTrue:[ |
8018 | 1055 |
false ifTrue:[ |
1056 |
height := self ascent + self descent. |
|
1057 |
] ifFalse:[ |
|
1058 |
height := self class xftFontGetHeight: fontId |
|
1059 |
]. |
|
6656 | 1060 |
]. |
1061 |
^ height |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1062 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1063 |
"Created: / 21-12-2013 / 01:20:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1064 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1065 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1066 |
isFixedWidth |
7610 | 1067 |
"return true, if this is a fixed pitch font |
1068 |
(i.e. all characters are of the same width). |
|
1069 |
Also called monospaced fonts" |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1070 |
|
7342 | 1071 |
fixedWidth isNil ifTrue:[ |
8018 | 1072 |
fontId isNil ifTrue:[ |
1073 |
^ false "we don't know yet" |
|
1074 |
]. |
|
1075 |
"/ take some obviously different chars |
|
1076 |
width := self widthOf:' '. |
|
1077 |
fixedWidth := (self widthOf:'i') == width |
|
1078 |
and:[(self widthOf:'W') == width |
|
1079 |
and:[(self widthOf:'.') == width]] |
|
7342 | 1080 |
]. |
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1081 |
^ fixedWidth. |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1082 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1083 |
"Created: / 21-12-2013 / 10:38:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1084 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1085 |
|
6186
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1086 |
maxAscent |
7342 | 1087 |
"return the font's maximum-ascent (i.e. the maximum of all characters); |
6186
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1088 |
That is the number of units (usually pixels) above the baseline." |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1089 |
|
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1090 |
^ self ascent |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1091 |
|
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1092 |
"Created: / 30-12-2013 / 20:01:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1093 |
! |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1094 |
|
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1095 |
maxDescent |
7342 | 1096 |
"return the font's maximum-descent (i.e. the maximum of all characters); |
6186
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1097 |
That is the number of units (usually pixels) below the baseline." |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1098 |
|
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1099 |
^ self descent |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1100 |
|
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1101 |
"Created: / 30-12-2013 / 20:01:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1102 |
! |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1103 |
|
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1104 |
maxWidth |
7342 | 1105 |
"return the font's maximum-width character (i.e. the maximum of all characters); |
6186
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1106 |
That is a number of units (usually pixels)." |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1107 |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1108 |
self isFixedWidth ifTrue:[ |
8018 | 1109 |
^ width |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
1110 |
]. |
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1111 |
^ self class xftFontGetMaxAdvanceWidth: fontId |
6186
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1112 |
|
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1113 |
"Created: / 30-12-2013 / 20:02:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1114 |
! |
c8f36970419f
Added missing & required methods. Since now, while St/X IDE could be switched to use XFT fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6185
diff
changeset
|
1115 |
|
7114 | 1116 |
patternStringForId:patternIdArg |
1117 |
|name family size pixelSize face style encoding foundry width| |
|
1118 |
||
1119 |
patternIdArg notNil ifTrue:[ |
|
1120 |
foundry := patternIdArg get: FC_FOUNDRY index: 0. |
|
1121 |
family := patternIdArg get: FC_FAMILY index: 0. |
|
1122 |
size := patternIdArg get: FC_SIZE index: 0. |
|
1123 |
pixelSize := patternIdArg get: FC_PIXEL_SIZE index: 0. |
|
1124 |
face := patternIdArg get: FC_WEIGHT index: 0. |
|
1125 |
face := StXFace2FCWeightMap keyAtValue: face. |
|
1126 |
style := patternIdArg get: FC_SLANT index: 0. |
|
1127 |
style := StXStyle2FCSlantMap keyAtValue: style. |
|
1128 |
width := patternIdArg get: FC_WIDTH index: 0. |
|
1129 |
||
1130 |
name:= patternIdArg get: 'fullname' index: 0. |
|
1131 |
||
1132 |
encoding:= patternIdArg get: 'encoding' index: 0. |
|
1133 |
]. |
|
1134 |
||
1135 |
^ '%8-%1-%2-%3-%4pt/%5px-%6-%9 (%7)' bindWith:family with:face with:style with:size with:pixelSize with:encoding with:name |
|
1136 |
with:foundry with:width. |
|
1137 |
! |
|
1138 |
||
7342 | 1139 |
width |
1140 |
"return the font's characters width; |
|
1141 |
That is a number of units (usually pixels). |
|
1142 |
For variable pitch fonts, the width of the space character is returned. |
|
1143 |
For fixed fonts, this is the same as minWidth or maxWidth (or any character). |
|
1144 |
The receiver must be associated to a device, for this query to be legal." |
|
1145 |
||
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1146 |
width isNil ifTrue:[ |
8018 | 1147 |
width := self widthOf:' '. |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
1148 |
]. |
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1149 |
^ width |
7342 | 1150 |
! |
1151 |
||
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1152 |
widthOf:aString from:start to:stop |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1153 |
"return the width of a sub string" |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1154 |
|
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1155 |
(stop < start) ifTrue:[^ 0]. |
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1156 |
fixedWidth == true ifTrue:[ |
8018 | 1157 |
^ width * (stop - start + 1) |
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1158 |
]. |
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1159 |
device isNil ifTrue:[ |
8018 | 1160 |
self errorNoDevice. |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
1161 |
]. |
7563 | 1162 |
^ self xftTextExtents:device displayId string:aString from:start to:stop into:nil. |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1163 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1164 |
"Created: / 21-12-2013 / 10:42:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6183
a21827076de1
Fix for bad layout and segfault when selecting whole line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6182
diff
changeset
|
1165 |
"Modified: / 29-12-2013 / 21:16:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1166 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1167 |
|
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1168 |
!XftFontDescription methodsFor:'release'! |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1169 |
|
6344 | 1170 |
releaseFromDevice |
1171 |
"I am no longer available on the device" |
|
1172 |
||
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1173 |
(device notNil and:[fontId notNil]) ifTrue:[ |
8018 | 1174 |
self class xftFontClose:fontId displayId:device displayId. |
1175 |
device := nil. |
|
1176 |
fontId := nil. |
|
1177 |
width := nil. |
|
7589
91aab751f507
Again: remove RecentlyUseFont (rely on larger CachedRegistry)
Stefan Vogel <sv@exept.de>
parents:
7571
diff
changeset
|
1178 |
]. |
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1179 |
! ! |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1180 |
|
6319 | 1181 |
!XftFontDescription methodsFor:'testing'! |
1182 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
1183 |
isAlienFont |
7874 | 1184 |
"my GraphicsContext knows how to disply strings in my font. |
1185 |
Alien fonts are eg. Hershey or Bitmap fonts, which are drawn by st/x itself." |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
1186 |
|
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
1187 |
^ false |
7874 | 1188 |
|
1189 |
"Modified (comment): / 12-02-2017 / 22:03:39 / cg" |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
1190 |
! |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7342
diff
changeset
|
1191 |
|
6319 | 1192 |
isXftFont |
7874 | 1193 |
"anwer true, if this is an Xft font. |
1194 |
Sure, I am" |
|
8018 | 1195 |
|
6319 | 1196 |
^ true |
7874 | 1197 |
|
1198 |
"Modified (comment): / 12-02-2017 / 22:04:23 / cg" |
|
6319 | 1199 |
! ! |
1200 |
||
7116 | 1201 |
!XftFontDescription::FCFontListParser class methodsFor:'api'! |
1202 |
||
1203 |
listOfAvailableFonts |
|
1204 |
^ self new listOfAvailableFonts |
|
1205 |
||
1206 |
" |
|
1207 |
self listOfAvailableFonts |
|
1208 |
" |
|
1209 |
! ! |
|
1210 |
||
6264 | 1211 |
!XftFontDescription::FCFontListParser class methodsFor:'documentation'! |
1212 |
||
1213 |
documentation |
|
1214 |
" |
|
1215 |
parses fc-list output to get a list of XftFontDescriptions |
|
1216 |
||
1217 |
[author:] |
|
6319 | 1218 |
cg |
6264 | 1219 |
|
1220 |
[instance variables:] |
|
1221 |
||
1222 |
[class variables:] |
|
1223 |
||
1224 |
[see also:] |
|
1225 |
||
1226 |
" |
|
1227 |
! ! |
|
1228 |
||
6263 | 1229 |
!XftFontDescription::FCFontListParser methodsFor:'api'! |
1230 |
||
1231 |
listOfAvailableFonts |
|
7116 | 1232 |
|readEntry list fcListProg| |
6263 | 1233 |
|
1234 |
list := OrderedCollection new. |
|
1235 |
||
7116 | 1236 |
readEntry := [ |
8018 | 1237 |
|key line| |
6263 | 1238 |
|
8018 | 1239 |
[ |
1240 |
line := pipeStream nextLine. |
|
1241 |
] doUntil:[(line startsWith:'Pattern has') or:[Transcript showCR:line. false]]. |
|
6263 | 1242 |
|
8018 | 1243 |
currentDescription := XftFontDescription new. |
1244 |
[line := pipeStream nextLine. line notEmptyOrNil] whileTrue:[ |
|
1245 |
"/ Transcript showCR:l. |
|
1246 |
lineStream := line readStream. lineStream skipSeparators. |
|
1247 |
key := ('fc_', (lineStream upTo:$:)) asSymbolIfInterned. |
|
1248 |
( |
|
1249 |
#(fc_family fc_style fc_slant fc_weight fc_width |
|
1250 |
fc_pixelsize fc_spacing fc_foundry fc_antialias |
|
1251 |
fc_file fc_outline fc_scalable fc_charset fc_lang |
|
1252 |
fc_fontversion fc_fontformat fc_decorative fc_index |
|
1253 |
fc_outline fc_familylang fc_stylelang fc_fullname |
|
1254 |
fc_fullnamelang fc_capability fc_hash fc_postscriptname |
|
1255 |
fc_symbol fc_color |
|
1256 |
) includesIdentical:key |
|
1257 |
) ifTrue:[ |
|
1258 |
self perform:key. |
|
1259 |
] ifFalse:[ |
|
1260 |
Transcript show:'Xft ignored line: '; showCR:line. |
|
1261 |
]. |
|
1262 |
]. |
|
1263 |
list add:currentDescription |
|
1264 |
]. |
|
6319 | 1265 |
|
6337 | 1266 |
fcListProg := #('/usr/bin/fc-list' '/usr/X11/bin/fc-list') detect:[:eachProg| |
8018 | 1267 |
eachProg asFilename isExecutableProgram |
1268 |
] ifNone:[ |
|
1269 |
'XftFontDescription [warning]: fc-list program not found - no XFT fonts' errorPrintCR. |
|
1270 |
^ list. |
|
1271 |
]. |
|
6337 | 1272 |
|
1273 |
pipeStream := PipeStream readingFrom:fcListProg, ' -v'. |
|
6263 | 1274 |
[ |
8018 | 1275 |
[pipeStream atEnd] whileFalse:[ |
1276 |
readEntry value. |
|
1277 |
] |
|
6263 | 1278 |
] ensure:[ |
8018 | 1279 |
pipeStream close |
6263 | 1280 |
]. |
1281 |
^ list |
|
1282 |
||
1283 |
" |
|
6337 | 1284 |
FCFontListParser new listOfAvailableFonts |
6263 | 1285 |
" |
1286 |
! ! |
|
1287 |
||
1288 |
!XftFontDescription::FCFontListParser methodsFor:'font list keywords'! |
|
1289 |
||
1290 |
fc_antialias |
|
1291 |
"helper for font listing" |
|
1292 |
||
6319 | 1293 |
currentDescription isAntialiasedFont:(self getBoolean). |
6263 | 1294 |
! |
1295 |
||
1296 |
fc_charset |
|
1297 |
"helper for font listing" |
|
1298 |
||
6319 | 1299 |
|page bits l min max minCode maxCode| |
6263 | 1300 |
|
1301 |
[ l := pipeStream nextLine. l notEmpty ] whileTrue:[ |
|
7221 | 1302 |
"/ Transcript show:'->'; showCR:l. |
1303 |
(l startsWith:Character tab) ifFalse:[ |
|
1304 |
(l startsWith:'(') ifFalse:[self halt]. |
|
1305 |
currentDescription minCode:minCode; maxCode:maxCode. |
|
1306 |
^ self. |
|
1307 |
]. |
|
6264 | 1308 |
|
7221 | 1309 |
lineStream := l readStream. |
1310 |
lineStream skipSeparators. |
|
1311 |
page := Integer readFrom:(lineStream upTo:$:) radix:16. |
|
1312 |
lineStream next. |
|
1313 |
bits := 0 to:7 collect:[:i| |
|
1314 |
lineStream skipSeparators. |
|
1315 |
Integer readFrom:(lineStream upToSeparator) radix:16. |
|
1316 |
]. |
|
1317 |
min := (page * 256 + 0). |
|
1318 |
max := (page * 256 + 255). |
|
1319 |
minCode isNil ifTrue:[ |
|
1320 |
minCode := min. |
|
1321 |
maxCode := max. |
|
1322 |
] ifFalse:[ |
|
1323 |
minCode := minCode min:min. |
|
1324 |
maxCode := maxCode max:max. |
|
1325 |
]. |
|
6263 | 1326 |
]. |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1327 |
"/ currentDescription characterSet:(self getString). |
7116 | 1328 |
currentDescription minCode:minCode; maxCode:maxCode. |
6263 | 1329 |
! |
1330 |
||
6319 | 1331 |
fc_decorative |
6263 | 1332 |
"helper for font listing" |
1333 |
||
6319 | 1334 |
currentDescription isDecorativeFont:(self getBoolean). |
6263 | 1335 |
! |
1336 |
||
1337 |
fc_family |
|
1338 |
"helper for font listing" |
|
1339 |
||
6319 | 1340 |
currentDescription family:(self getString). |
6263 | 1341 |
! |
1342 |
||
6319 | 1343 |
fc_file |
6263 | 1344 |
"helper for font listing" |
1345 |
||
6319 | 1346 |
currentDescription file:(self getString). |
6263 | 1347 |
! |
1348 |
||
1349 |
fc_fontformat |
|
1350 |
"helper for font listing" |
|
1351 |
||
6319 | 1352 |
currentDescription fontFormat:(self getString). |
6263 | 1353 |
! |
1354 |
||
1355 |
fc_fontversion |
|
1356 |
"helper for font listing" |
|
1357 |
||
6319 | 1358 |
currentDescription fontVersion:(self getInteger). |
6263 | 1359 |
! |
1360 |
||
1361 |
fc_foundry |
|
1362 |
"helper for font listing" |
|
1363 |
||
7121 | 1364 |
|foundry| |
1365 |
||
1366 |
foundry := self getString. |
|
7221 | 1367 |
foundry ~= 'unknown' ifTrue:[ |
1368 |
currentDescription foundry:foundry. |
|
7121 | 1369 |
]. |
6263 | 1370 |
! |
1371 |
||
6264 | 1372 |
fc_fullname |
1373 |
"helper for font listing" |
|
1374 |
||
7121 | 1375 |
currentDescription name:self getString. |
6264 | 1376 |
! |
1377 |
||
6263 | 1378 |
fc_outline |
1379 |
"helper for font listing" |
|
1380 |
||
6319 | 1381 |
currentDescription isOutlineFont:(self getBoolean). |
6263 | 1382 |
! |
1383 |
||
1384 |
fc_pixelsize |
|
1385 |
"helper for font listing" |
|
1386 |
||
6325 | 1387 |
currentDescription setPixelSize:(self getInteger). |
1388 |
currentDescription setSizeUnit:#px. |
|
1389 |
"/ currentDescription setSize:(self getInteger). |
|
1390 |
"/ currentDescription setSizeUnit:#pt. |
|
6263 | 1391 |
! |
1392 |
||
1393 |
fc_scalable |
|
1394 |
"helper for font listing" |
|
1395 |
||
6957 | 1396 |
currentDescription isScalableFont:self getBoolean. |
6263 | 1397 |
! |
1398 |
||
1399 |
fc_slant |
|
1400 |
"helper for font listing" |
|
1401 |
||
6319 | 1402 |
currentDescription slant:(self getInteger). |
6263 | 1403 |
! |
1404 |
||
1405 |
fc_spacing |
|
1406 |
"helper for font listing" |
|
1407 |
||
6319 | 1408 |
currentDescription spacing:(self getInteger). |
6263 | 1409 |
! |
1410 |
||
1411 |
fc_style |
|
1412 |
"helper for font listing" |
|
1413 |
||
6319 | 1414 |
|xftStyle| |
1415 |
||
7121 | 1416 |
xftStyle := self getString asLowercase. |
1417 |
(xftStyle includesString:'italic') ifTrue:[ |
|
7221 | 1418 |
currentDescription style:#italic. |
1419 |
^ self. |
|
6319 | 1420 |
]. |
7121 | 1421 |
(xftStyle includesString:'oblique') ifTrue:[ |
7221 | 1422 |
currentDescription style:#oblique. |
1423 |
^ self. |
|
7121 | 1424 |
]. |
1425 |
currentDescription style:#roman. |
|
6263 | 1426 |
! |
1427 |
||
1428 |
fc_weight |
|
1429 |
"helper for font listing" |
|
1430 |
||
6319 | 1431 |
currentDescription weight:(self getInteger). |
6263 | 1432 |
! |
1433 |
||
1434 |
fc_width |
|
1435 |
"helper for font listing" |
|
1436 |
||
6319 | 1437 |
currentDescription width:(self getInteger). |
6263 | 1438 |
! ! |
1439 |
||
7488 | 1440 |
!XftFontDescription::FCFontListParser methodsFor:'font list keywords - ignored'! |
1441 |
||
1442 |
fc_capability |
|
1443 |
"helper for font listing" |
|
1444 |
||
1445 |
"currentDescription capability:" (self getString). |
|
1446 |
! |
|
1447 |
||
1448 |
fc_color |
|
1449 |
"helper for font listing - ignored for now" |
|
1450 |
||
1451 |
"currentDescription isColorFont:"(self getBoolean). |
|
1452 |
! |
|
1453 |
||
1454 |
fc_familylang |
|
1455 |
"helper for font listing" |
|
1456 |
||
1457 |
"currentDescription familylang:" (self getString). |
|
1458 |
! |
|
1459 |
||
1460 |
fc_fullnamelang |
|
1461 |
"helper for font listing" |
|
1462 |
||
1463 |
"currentDescription fullnamelang:" (self getString). |
|
1464 |
! |
|
1465 |
||
1466 |
fc_hash |
|
1467 |
"helper for font listing" |
|
1468 |
||
1469 |
"currentDescription hash:" self getString. |
|
1470 |
! |
|
1471 |
||
1472 |
fc_index |
|
1473 |
"helper for font listing" |
|
1474 |
||
1475 |
"currentDescription index:" (self getInteger). |
|
1476 |
! |
|
1477 |
||
1478 |
fc_lang |
|
1479 |
"helper for font listing" |
|
1480 |
||
1481 |
"/ currentDescription characterSet:(self getString). |
|
1482 |
! |
|
1483 |
||
1484 |
fc_postscriptname |
|
1485 |
"helper for font listing" |
|
1486 |
||
1487 |
"currentDescription postscriptname:" self getString. |
|
1488 |
! |
|
1489 |
||
1490 |
fc_stylelang |
|
1491 |
"helper for font listing" |
|
1492 |
||
1493 |
"currentDescription stylelang:" (self getString). |
|
1494 |
! |
|
1495 |
||
1496 |
fc_symbol |
|
1497 |
"helper for font listing - ignored for now" |
|
1498 |
||
1499 |
"currentDescription isSymbolFont:"(self getBoolean). |
|
1500 |
! ! |
|
1501 |
||
6263 | 1502 |
!XftFontDescription::FCFontListParser methodsFor:'helpers'! |
1503 |
||
6319 | 1504 |
getBoolean |
6263 | 1505 |
"helper for font listing" |
1506 |
||
1507 |
|s| |
|
1508 |
||
1509 |
lineStream skipSeparators. |
|
6319 | 1510 |
s := lineStream nextAlphaNumericWord. |
6957 | 1511 |
^ (s indexOfSubCollection:'True') ~~ 0. "/ match at least 'True' and 'FCTrue' |
6963 | 1512 |
|
1513 |
" |
|
7114 | 1514 |
'xxFalse' indexOfSubCollection:'True' |
1515 |
'FcTrue' indexOfSubCollection:'True' |
|
6963 | 1516 |
" |
6263 | 1517 |
! |
1518 |
||
6264 | 1519 |
getInteger |
1520 |
"helper for font listing" |
|
1521 |
||
1522 |
lineStream skipSeparators. |
|
6319 | 1523 |
^ Integer readFrom:lineStream. |
6264 | 1524 |
! |
1525 |
||
6319 | 1526 |
getString |
6263 | 1527 |
"helper for font listing" |
1528 |
||
7116 | 1529 |
lineStream skipThrough:$". |
1530 |
^ lineStream upTo:$". |
|
6263 | 1531 |
! ! |
1532 |
||
7114 | 1533 |
!XftFontDescription::FCPatternHandle class methodsFor:'instance creation'! |
1534 |
||
1535 |
create |
|
1536 |
^ self new create |
|
1537 |
||
1538 |
" |
|
1539 |
self new create destroy |
|
1540 |
" |
|
1541 |
! ! |
|
1542 |
||
1543 |
!XftFontDescription::FCPatternHandle methodsFor:'primitives'! |
|
1544 |
||
1545 |
add:attribute value: value |
|
1546 |
"Add a value to the specified pattern element after existing values" |
|
1547 |
||
1548 |
^ self add: attribute value: value append: true. |
|
1549 |
! |
|
1550 |
||
1551 |
add:attribute value: value append: append |
|
1552 |
"Add a value to the specified pattern element. If 'append' is true, the value |
|
1553 |
is added after existing values, otherwise it is added before them." |
|
1554 |
||
1555 |
| error | |
|
1556 |
||
7221 | 1557 |
%{ /* STACK: 64000 */ |
7114 | 1558 |
#ifdef XFT |
1559 |
XftValue v; |
|
1560 |
Bool b; |
|
1561 |
||
1562 |
if (__INST(address_) == 0) { |
|
1563 |
error = @symbol(NullReceiver); |
|
1564 |
goto err; |
|
1565 |
} |
|
1566 |
if ( ! __isStringLike ( attribute ) ) { |
|
1567 |
error = @symbol(BadArg1); |
|
1568 |
goto err; |
|
1569 |
} |
|
1570 |
if ( append != true && append != false ) { |
|
1571 |
error = @symbol(BadArg3); |
|
1572 |
goto err; |
|
1573 |
} |
|
1574 |
if ( __isStringLike ( value ) ) { |
|
1575 |
v.type = FcTypeString; |
|
1576 |
/* Passing pointer inside Smalltalk should be safe, |
|
1577 |
* Xft/FontConfig libraries seem to allocate and store |
|
1578 |
* a __copy__ of the string (if I understood the code correctly) |
|
1579 |
*/ |
|
1580 |
v.u.s = __stringVal( value); |
|
1581 |
} else if ( __isSmallInteger( value ) ) { |
|
1582 |
v.type = XftTypeInteger; |
|
1583 |
v.u.i = (int)__intVal( value ); |
|
1584 |
} else if ( value == true || value == false ) { |
|
1585 |
v.type = XftTypeBool; |
|
1586 |
v.u.b = value == true ? True : False; |
|
1587 |
} else if ( __isFloat ( value ) ) { |
|
1588 |
v.type = XftTypeDouble; |
|
1589 |
v.u.d = __floatVal( value ); |
|
1590 |
} else if ( value == nil ) { |
|
1591 |
v.type = XftTypeVoid; |
|
1592 |
v.u.f = NULL; |
|
1593 |
} else { |
|
1594 |
error = @symbol(BadArg2); |
|
1595 |
goto err; |
|
1596 |
} |
|
1597 |
b = XftPatternAdd((XftPattern*)__INST(address_), __stringVal(attribute), v, append == true ? True : False ); |
|
1598 |
RETURN ( b == True ? true : false ); |
|
1599 |
||
1600 |
err:; |
|
1601 |
#endif |
|
1602 |
%}. |
|
1603 |
self primitiveFailed: error |
|
1604 |
||
1605 |
"Created: / 20-12-2013 / 21:50:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1606 |
! |
|
1607 |
||
1608 |
create |
|
1609 |
%{ |
|
1610 |
#ifdef XFT |
|
1611 |
__INST(address_) = (void *)XftPatternCreate(); |
|
1612 |
#endif |
|
1613 |
%}. |
|
1614 |
! |
|
1615 |
||
1616 |
delete: pattern attribute: attribute |
|
1617 |
| error | |
|
7221 | 1618 |
%{ /* STACK: 64000 */ |
7114 | 1619 |
#ifdef XFT |
1620 |
if (__INST(address_) == 0) { |
|
7221 | 1621 |
error = @symbol(BadHandle); |
1622 |
goto err; |
|
7114 | 1623 |
} |
1624 |
if ( ! __isStringLike ( attribute ) ) { |
|
7221 | 1625 |
error = @symbol(BadArg1); |
1626 |
goto err; |
|
7114 | 1627 |
} |
1628 |
XftPatternDel( (XftPattern*)__INST(address_), __stringVal ( attribute ) ); |
|
1629 |
RETURN ( self ); |
|
1630 |
||
1631 |
err:; |
|
1632 |
#endif |
|
1633 |
%}. |
|
1634 |
self primitiveFailed: error |
|
1635 |
! |
|
1636 |
||
1637 |
destroy |
|
7221 | 1638 |
%{ /* STACK: 64000 */ |
7114 | 1639 |
#ifdef XFT |
1640 |
if (__INST(address_) != 0) { |
|
1641 |
XftPatternDestroy((XftPattern*)__INST(address_)); |
|
1642 |
__INST(address_) = 0; |
|
1643 |
RETURN ( self ); |
|
1644 |
} |
|
1645 |
#endif |
|
1646 |
%}. |
|
1647 |
self primitiveFailed. |
|
1648 |
! |
|
1649 |
||
1650 |
duplicate |
|
1651 |
| error | |
|
1652 |
%{ |
|
1653 |
#ifdef XFT |
|
1654 |
if (__INST(address_) != 0) { |
|
1655 |
RETURN (FC_PATTERN_HANDLE_NEW((XftPattern*)__INST(address_))); |
|
1656 |
RETURN ( self ); |
|
1657 |
} |
|
1658 |
#endif |
|
1659 |
%}. |
|
1660 |
self primitiveFailed |
|
1661 |
! |
|
1662 |
||
1663 |
get:attribute index: index |
|
1664 |
"Return a value from the specified element -- multiple values can be indexed |
|
1665 |
with 'index' starting at zero." |
|
1666 |
||
1667 |
| error | |
|
1668 |
||
7221 | 1669 |
%{ /* STACK: 64000 */ |
7114 | 1670 |
#ifdef XFT |
1671 |
XftValue v; |
|
1672 |
XftResult r; |
|
1673 |
||
1674 |
if (__INST(address_) == 0) { |
|
1675 |
error = @symbol(NullReceiver); |
|
1676 |
goto err; |
|
1677 |
} |
|
1678 |
if ( ! __isStringLike ( attribute ) ) { |
|
1679 |
error = @symbol(BadArg1); |
|
1680 |
goto err; |
|
1681 |
} |
|
1682 |
if ( ! __isSmallInteger( index ) ) { |
|
1683 |
error = @symbol(BadArg2); |
|
1684 |
goto err; |
|
1685 |
} |
|
1686 |
r = XftPatternGet((XftPattern*)__INST(address_), __stringVal( attribute ), __intVal( index ), &v); |
|
1687 |
if ( r != XftResultMatch) { |
|
1688 |
RETURN ( nil ); |
|
1689 |
} |
|
1690 |
if ( v.type == XftTypeString) { |
|
1691 |
RETURN ( __MKSTRING(v.u.s) ); |
|
1692 |
} else if ( v.type == XftTypeInteger ) { |
|
1693 |
RETURN ( __MKINT (v.u.i) ); |
|
1694 |
} else if ( v.type == XftTypeBool ) { |
|
1695 |
RETURN ( v.u.b == True ? true : false ); |
|
1696 |
} else if ( v.type == XftTypeDouble ) { |
|
1697 |
RETURN ( __MKFLOAT (v.u.d) ); |
|
1698 |
} else if ( v.type == XftTypeVoid ) { |
|
1699 |
RETURN ( nil ); |
|
1700 |
} else { |
|
1701 |
error = @symbol(UnssuportedTypeValue); |
|
1702 |
goto err; |
|
1703 |
} |
|
1704 |
err:; |
|
1705 |
#endif |
|
1706 |
%}. |
|
1707 |
self primitiveFailed: error |
|
1708 |
! |
|
1709 |
||
1710 |
getFontOnDisplayId:displayId |
|
1711 |
"Note: the pattern is destroyed when the font is closed" |
|
1712 |
||
1713 |
| error | |
|
1714 |
||
1715 |
%{ /* STACK: 64000 */ |
|
1716 |
#ifdef XFT |
|
1717 |
XftFont* f; |
|
1718 |
if (!__isExternalAddressLike(displayId) ) { |
|
7221 | 1719 |
error = @symbol(BadArg1); |
1720 |
goto err; |
|
7114 | 1721 |
} |
1722 |
if (__INST(address_) == 0) { |
|
7221 | 1723 |
error = @symbol(BadHandle); |
1724 |
goto err; |
|
7114 | 1725 |
} |
1726 |
||
1727 |
f = XftFontOpenPattern(DISPLAY(displayId), (XftPattern*)__INST(address_)); |
|
1728 |
if (f == NULL) { |
|
7221 | 1729 |
RETURN (nil); |
7114 | 1730 |
} else { |
7221 | 1731 |
RETURN (XFT_FONT_HANDLE_NEW(f)); |
7114 | 1732 |
} |
1733 |
err:; |
|
1734 |
#endif |
|
1735 |
%}. |
|
1736 |
self primitiveFailed: error |
|
1737 |
||
1738 |
"Created: / 20-12-2013 / 23:53:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1739 |
! |
|
1740 |
||
1741 |
matchFontOnDisplayId:displayId screen:screen |
|
1742 |
| error | |
|
1743 |
||
1744 |
%{ /* STACK: 64000 */ |
|
1745 |
#ifdef XFT |
|
1746 |
XftPattern *p; |
|
1747 |
XftResult r; |
|
1748 |
||
1749 |
if (!__isExternalAddressLike(displayId)) { |
|
7221 | 1750 |
error = @symbol(BadArg1); |
1751 |
goto err; |
|
7114 | 1752 |
} |
1753 |
if (!__isSmallInteger( screen) ) { |
|
7221 | 1754 |
error = @symbol(BadArg2); |
1755 |
goto err; |
|
7114 | 1756 |
} |
1757 |
if (__INST(address_) == 0) { |
|
7221 | 1758 |
error = @symbol(BadHandle); |
1759 |
goto err; |
|
7114 | 1760 |
} |
1761 |
||
1762 |
// Already done in match: |
|
1763 |
// XftConfigSubstitute(FC_PATTERN( patternId )); |
|
1764 |
// XftDefaultSubstitute(DISPLAY(displayId), SCREEN( screen ), FC_PATTERN( patternId )); |
|
1765 |
p = XftFontMatch(DISPLAY(displayId), SCREEN(screen), (XftPattern*)__INST(address_), &r); |
|
1766 |
if (p) { |
|
7221 | 1767 |
RETURN (FC_PATTERN_HANDLE_NEW(p) ); |
7114 | 1768 |
} else { |
7221 | 1769 |
error = @symbol(XftFontMatchReturnedNull); |
7114 | 1770 |
} |
1771 |
err:; |
|
1772 |
#endif |
|
1773 |
%}. |
|
1774 |
self primitiveFailed: error |
|
1775 |
||
1776 |
"Created: / 21-12-2013 / 00:08:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1777 |
! ! |
|
1778 |
||
1779 |
!XftFontDescription::XftDrawHandle class methodsFor:'instance creation'! |
|
1780 |
||
1781 |
createForDisplayId:displayId screen:screen drawable:drawableId |
|
1782 |
^ self new createForDisplayId:displayId screen:screen drawable:drawableId |
|
1783 |
! ! |
|
1784 |
||
1785 |
!XftFontDescription::XftDrawHandle methodsFor:'primitives'! |
|
1786 |
||
1787 |
createForDisplayId:displayId screen:screen drawable:drawableId |
|
1788 |
| error | |
|
1789 |
||
1790 |
%{ /* STACK: 64000 */ |
|
1791 |
#ifdef XFT |
|
1792 |
if ( ! __isExternalAddressLike(displayId) ) { |
|
7221 | 1793 |
error = @symbol(BadArg1); |
1794 |
goto err; |
|
7114 | 1795 |
} |
1796 |
if ( ! __isSmallInteger(screen) ) { |
|
7221 | 1797 |
error = @symbol(BadArg2); |
1798 |
goto err; |
|
7114 | 1799 |
} |
1800 |
if ( ! __isExternalAddressLike(drawableId) ) { |
|
7221 | 1801 |
error = @symbol(BadArg3); |
1802 |
goto err; |
|
7114 | 1803 |
} |
1804 |
__INST(address_) = (void *) XftDrawCreate ( DISPLAY(displayId) , |
|
7221 | 1805 |
DRAWABLE(drawableId) , |
1806 |
DefaultVisual(DISPLAY(displayId), SCREEN (screen)) , |
|
1807 |
DefaultColormap(DISPLAY(displayId), SCREEN (screen))); |
|
7114 | 1808 |
err:; |
1809 |
#endif |
|
1810 |
%}. |
|
1811 |
self primitiveFailed: error |
|
1812 |
||
1813 |
"Created: / 21-12-2013 / 21:12:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1814 |
! |
|
1815 |
||
1816 |
destroy |
|
1817 |
%{ /* STACK: 64000 */ |
|
1818 |
#ifdef XFT |
|
1819 |
if (__INST(address_) != 0) { |
|
7221 | 1820 |
XftDrawDestroy((XftDraw*)__INST(address_)); |
1821 |
__INST(address_) = 0; |
|
1822 |
RETURN ( self ); |
|
7114 | 1823 |
} |
1824 |
#endif |
|
1825 |
%}. |
|
1826 |
self primitiveFailed. |
|
1827 |
! |
|
1828 |
||
1829 |
disassociateFrom:drawableId |
|
1830 |
"Disassociate the XftDrawable from drawableId. |
|
1831 |
This mist be done before the drawable is destroyed, |
|
1832 |
otherwise the XftDrawable is destroyed together with the drawable, |
|
1833 |
and X11 errors will be signaled." |
|
1834 |
||
1835 |
| error | |
|
1836 |
||
1837 |
%{ /* STACK: 64000 */ |
|
1838 |
#ifdef XFT |
|
1839 |
if (__INST(address_) == 0) { |
|
7221 | 1840 |
// nothing to disasassociate from... |
1841 |
RETURN(self); |
|
7114 | 1842 |
} |
1843 |
if (!__isExternalAddressLike(drawableId)) { |
|
7221 | 1844 |
error = @symbol(BadArg); |
1845 |
goto err; |
|
7114 | 1846 |
} |
1847 |
if (XftDrawDrawable((XftDraw*)__INST(address_)) == DRAWABLE(drawableId)) { |
|
7221 | 1848 |
XftDrawChange((XftDraw*)__INST(address_), None); |
7114 | 1849 |
} |
1850 |
RETURN(self); |
|
1851 |
err:; |
|
1852 |
#endif |
|
1853 |
%}. |
|
1854 |
self primitiveFailed: error |
|
1855 |
||
1856 |
"Created: / 26-12-2013 / 12:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1857 |
! |
|
1858 |
||
1859 |
drawChange:drawableId |
|
1860 |
| error | |
|
1861 |
||
1862 |
%{ /* STACK: 64000 */ |
|
1863 |
#ifdef XFT |
|
1864 |
if (drawableId == nil) { |
|
7221 | 1865 |
XftDrawChange((XftDraw*)__INST(address_), None); |
1866 |
RETURN (self); |
|
7114 | 1867 |
} |
1868 |
if (!__isExternalAddressLike(drawableId)) { |
|
7221 | 1869 |
error = @symbol(BadArg1); |
1870 |
goto err; |
|
7114 | 1871 |
} |
1872 |
if (XftDrawDrawable((XftDraw*)__INST(address_)) != DRAWABLE( drawableId)) { |
|
7221 | 1873 |
XftDrawChange((XftDraw*)__INST(address_), DRAWABLE( drawableId)); |
7114 | 1874 |
} |
1875 |
RETURN (self); |
|
1876 |
err:; |
|
1877 |
#endif |
|
1878 |
%}. |
|
1879 |
self primitiveFailed: error |
|
1880 |
||
1881 |
"Created: / 26-12-2013 / 12:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1882 |
! |
|
1883 |
||
1884 |
drawRectWithColor:aColor x:x y:y width:w height:h |
|
1885 |
| error r g b a pix | |
|
1886 |
||
1887 |
aColor isColor ifFalse:[^self primitiveFailed: #BadArg1]. |
|
1888 |
||
1889 |
r := aColor scaledRed. |
|
1890 |
g := aColor scaledGreen. |
|
1891 |
b := aColor scaledBlue. |
|
1892 |
a := aColor alpha * 65535. |
|
1893 |
r isNil ifTrue:[ |
|
7221 | 1894 |
"/ when drawing into a pixmap... |
1895 |
aColor colorId == 0 ifTrue:[ |
|
1896 |
r := g := b := 0. |
|
1897 |
] ifFalse:[ |
|
1898 |
r := g := b := 16rFFFF. |
|
1899 |
] |
|
7114 | 1900 |
]. |
1901 |
pix := aColor colorId. |
|
1902 |
%{ /* STACK: 64000 */ |
|
1903 |
#ifdef XFT |
|
1904 |
XftColor clr; |
|
1905 |
||
1906 |
if (__INST(address_) == 0) { |
|
7221 | 1907 |
error = @symbol(BadHandle); |
1908 |
goto err; |
|
7114 | 1909 |
} |
1910 |
if (!__isSmallInteger(pix)) { |
|
7221 | 1911 |
error = @symbol(BadColorId); |
1912 |
goto err; |
|
7114 | 1913 |
} |
1914 |
if (!__isSmallInteger(x)) { |
|
7221 | 1915 |
error = @symbol(BadArg2); |
1916 |
goto err; |
|
7114 | 1917 |
} |
1918 |
if (! __isSmallInteger(y)) { |
|
7221 | 1919 |
error = @symbol(BadArg3); |
1920 |
goto err; |
|
7114 | 1921 |
} |
1922 |
if (!__isSmallInteger(w)) { |
|
7221 | 1923 |
error = @symbol(BadArg4); |
1924 |
goto err; |
|
7114 | 1925 |
} |
1926 |
if (!__isSmallInteger(h)) { |
|
7221 | 1927 |
error = @symbol(BadArg5); |
1928 |
goto err; |
|
7114 | 1929 |
} |
1930 |
clr.pixel = (unsigned long)__intVal(pix); |
|
1931 |
clr.color.red = __intVal(r); |
|
1932 |
clr.color.green = __intVal(g); |
|
1933 |
clr.color.blue = __intVal(b); |
|
1934 |
clr.color.alpha = __intVal(a); |
|
1935 |
||
1936 |
XftDrawRect((XftDraw*)__INST(address_), &clr, |
|
7221 | 1937 |
__intVal(x), __intVal(y), __intVal(w) ,__intVal(h)); |
7114 | 1938 |
|
1939 |
RETURN (self); |
|
1940 |
err:; |
|
1941 |
#endif |
|
1942 |
%}. |
|
1943 |
self primitiveFailed: error. |
|
1944 |
||
1945 |
"Created: / 28-12-2013 / 23:35:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1946 |
"Modified: / 31-12-2013 / 00:37:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1947 |
! |
|
1948 |
||
1949 |
drawString:aString color:aColor font:fontIdArg x:x y:y from:start to:stop |
|
1950 |
| error r g b a pix | |
|
1951 |
||
1952 |
aColor isColor ifFalse:[^self primitiveFailed: #BadArg2]. |
|
1953 |
||
1954 |
pix := aColor colorId. |
|
1955 |
r := aColor scaledRed. |
|
1956 |
r isNil ifTrue:[ |
|
7221 | 1957 |
"/ when drawing into a pixmap... |
1958 |
pix == 0 ifTrue:[ |
|
1959 |
r := g := b := a := 0. |
|
1960 |
] ifFalse:[ |
|
1961 |
r := g := b := a := 16rFFFF. |
|
1962 |
] |
|
7114 | 1963 |
] ifFalse:[ |
7221 | 1964 |
g := aColor scaledGreen. |
1965 |
b := aColor scaledBlue. |
|
1966 |
a := aColor alpha * 65535. |
|
7114 | 1967 |
]. |
1968 |
%{ /* STACK: 64000 */ |
|
1969 |
#ifdef XFT |
|
1970 |
int _start, _stop; |
|
1971 |
int __x, __y; |
|
1972 |
XftColor clr; |
|
1973 |
||
1974 |
if (__INST(address_) == 0) { |
|
7221 | 1975 |
error = @symbol(BadHandle); |
1976 |
goto err; |
|
7114 | 1977 |
} |
1978 |
if ( ! __isSmallInteger(pix) ) { |
|
7221 | 1979 |
error = @symbol(BadColorId); |
1980 |
goto err; |
|
7114 | 1981 |
} |
1982 |
if ( ! __isSmallInteger(x) ) { |
|
7221 | 1983 |
error = @symbol(BadArg4); |
1984 |
goto err; |
|
7114 | 1985 |
} |
1986 |
__x = __intVal(x); |
|
1987 |
if ( ! __isSmallInteger(y) ) { |
|
7221 | 1988 |
error = @symbol(BadArg5); |
1989 |
goto err; |
|
7114 | 1990 |
} |
1991 |
__y = __intVal(y); |
|
1992 |
||
1993 |
||
1994 |
if ( ! __isSmallInteger(start) ) { |
|
7221 | 1995 |
error = @symbol(BadArg6); |
1996 |
goto err; |
|
7114 | 1997 |
} |
1998 |
_start = __intVal(start); |
|
1999 |
if ( ! __isSmallInteger(stop) ) { |
|
7221 | 2000 |
error = @symbol(BadArg7); |
2001 |
goto err; |
|
7114 | 2002 |
} |
2003 |
_stop = __intVal(stop); |
|
2004 |
||
2005 |
clr.pixel = (unsigned long)__intVal(pix); |
|
2006 |
clr.color.red = __intVal(r); |
|
2007 |
clr.color.green = __intVal(g); |
|
2008 |
clr.color.blue = __intVal(b); |
|
2009 |
clr.color.alpha = __intVal(a); |
|
2010 |
||
2011 |
if ( __isStringLike(aString) ) { |
|
7221 | 2012 |
XftDrawString8((XftDraw*)__INST(address_), &clr, XFT_FONT(fontIdArg), |
2013 |
__x, __y, |
|
2014 |
__stringVal(aString) + (_start - 1), _stop - _start + 1); |
|
2015 |
RETURN ( self ); |
|
7114 | 2016 |
} else { |
7221 | 2017 |
error = @symbol(BadArg1); |
2018 |
goto err; |
|
7114 | 2019 |
} |
2020 |
err:; |
|
2021 |
#endif |
|
2022 |
%}. |
|
2023 |
self primitiveFailed: error. |
|
2024 |
||
2025 |
"Created: / 28-12-2013 / 12:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2026 |
"Modified: / 30-12-2013 / 20:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2027 |
! |
|
2028 |
||
2029 |
setClipRect:rect |
|
2030 |
| error xObj yObj wObj hObj | |
|
2031 |
||
2032 |
rect notNil ifTrue:[ |
|
7221 | 2033 |
xObj := rect left. |
2034 |
yObj := rect top. |
|
2035 |
wObj := rect width. |
|
2036 |
hObj := rect height. |
|
7114 | 2037 |
]. |
2038 |
%{ /* STACK: 64000 */ |
|
2039 |
#ifdef XFT |
|
2040 |
if (__INST(address_) == 0) { |
|
7221 | 2041 |
error = @symbol(BadHandle); |
2042 |
goto err; |
|
7114 | 2043 |
} |
2044 |
if (rect != nil) { |
|
7221 | 2045 |
XRectangle r; |
7114 | 2046 |
|
7221 | 2047 |
r.x = __intVal(xObj); |
2048 |
r.y = __intVal(yObj); |
|
2049 |
r.width = __intVal(wObj); |
|
2050 |
r.height = __intVal(hObj); |
|
2051 |
XftDrawSetClipRectangles((XftDraw*)__INST(address_), 0, 0, &r, 1); |
|
7114 | 2052 |
} else { |
7221 | 2053 |
XftDrawSetClipRectangles((XftDraw*)__INST(address_), 0, 0, (XRectangle*)NULL, 0); |
7114 | 2054 |
} |
2055 |
RETURN ( self ); |
|
2056 |
err:; |
|
2057 |
#endif |
|
2058 |
%}. |
|
2059 |
self primitiveFailed: error. |
|
2060 |
||
2061 |
"Created: / 31-12-2013 / 01:24:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2062 |
! ! |
|
2063 |
||
6176 | 2064 |
!XftFontDescription class methodsFor:'documentation'! |
2065 |
||
2066 |
version |
|
6936 | 2067 |
^ '$Header$' |
6176 | 2068 |
! |
2069 |
||
2070 |
version_CVS |
|
6936 | 2071 |
^ '$Header$' |
6176 | 2072 |
! ! |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
2073 |
|
6184
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
2074 |
|
997414d312b5
Fixed font lookup to take face (aka weight) and style (aka slant) into an account).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6183
diff
changeset
|
2075 |
XftFontDescription initialize! |