author | Merge Script |
Fri, 17 Jun 2016 07:02:11 +0200 | |
branch | jv |
changeset 7393 | 04ffdb8eebcc |
parent 7364 | 262ab56176cb |
child 7541 | 39940e2446a5 |
permissions | -rw-r--r-- |
6176 | 1 |
"{ Package: 'stx:libview' }" |
2 |
||
6833 | 3 |
"{ NameSpace: Smalltalk }" |
4 |
||
6176 | 5 |
FontDescription subclass:#XftFontDescription |
6656 | 6 |
instanceVariableNames:'device fontId sharedDrawId closestFont minCode maxCode ascent |
7364 | 7 |
descent height fixedWidth' |
7151
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
8 |
classVariableNames:'CachedFontList RecentlyUsedFonts Lobby' |
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
9 |
poolDictionaries:'FcConstants' |
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
10 |
category:'Graphics-Support' |
6176 | 11 |
! |
12 |
||
6263 | 13 |
Object subclass:#FCFontListParser |
14 |
instanceVariableNames:'pipeStream lineStream currentDescription' |
|
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
privateIn:XftFontDescription |
|
18 |
! |
|
19 |
||
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
20 |
ExternalAddress subclass:#XftDrawHandle |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
21 |
instanceVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
22 |
classVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
23 |
poolDictionaries:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
24 |
privateIn:XftFontDescription |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
25 |
! |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
26 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
27 |
ExternalAddress subclass:#XftFontHandle |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
28 |
instanceVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
29 |
classVariableNames:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
30 |
poolDictionaries:'' |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
31 |
privateIn:XftFontDescription |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
32 |
! |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
33 |
|
6176 | 34 |
!XftFontDescription primitiveDefinitions! |
35 |
%{ |
|
36 |
/* |
|
37 |
* includes, defines, structure definitions |
|
38 |
* and typedefs come here. |
|
39 |
*/ |
|
40 |
||
41 |
#undef True |
|
42 |
#undef False |
|
6179 | 43 |
#undef Time |
6176 | 44 |
#define Time XTime |
45 |
||
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
46 |
#ifdef XFT |
7154
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
47 |
# ifndef HAVE_FONTCONFIG |
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
48 |
# error "XFT defined but not HAVE_FONTCONFIG. Xft fonts cannot be used without FontConfig support" |
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
49 |
# endif |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
50 |
|
6936 | 51 |
extern OBJ __GLOBAL_GET_BY_NAME(char *); |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
52 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
53 |
# define __HANDLE_VAL(type, externalAddress) \ |
6936 | 54 |
((type)__externalAddressVal(externalAddress)) |
6489 | 55 |
|
6936 | 56 |
# define __HANDLE_NEW(ptr, __cls) \ |
57 |
({ \ |
|
58 |
OBJ handle = __MKEXTERNALADDRESS(ptr); \ |
|
59 |
OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\ |
|
60 |
__InstPtr(handle)->o_class = clsObj; \ |
|
61 |
__STORE(handle, clsObj); \ |
|
62 |
handle; \ |
|
63 |
}) |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
64 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
65 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
66 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
67 |
# 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
|
68 |
# define SCREEN(x) ((int)(__intVal(x))) |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
69 |
# define DRAWABLE(x) __HANDLE_VAL(Drawable, x) |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
70 |
# define GC(x) __HANDLE_VAL(GC, x) |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
71 |
# define VISUAL(x) __HANDLE_VAL(Visual*, x) |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
72 |
# define COLORMAP(x) __HANDLE_VAL(Colormap, x) |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
73 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
74 |
/* FontConfig objects */ |
6193 | 75 |
# define FC_PATTERN(x) __HANDLE_VAL(XftPattern*, x) |
7151
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
76 |
# define FC_PATTERN_HANDLE_NEW(x) __HANDLE_NEW(x, "FcPattern") |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
77 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
78 |
/* Xft Objects */ |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
79 |
|
6193 | 80 |
# 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
|
81 |
# 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
|
82 |
|
6193 | 83 |
# 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
|
84 |
# 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
|
85 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
86 |
|
6176 | 87 |
# include <X11/Xft/Xft.h> |
88 |
# include <X11/Xft/XftCompat.h> |
|
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 |
|
6176 | 90 |
#endif |
91 |
||
92 |
%} |
|
93 |
! ! |
|
94 |
||
95 |
!XftFontDescription class methodsFor:'documentation'! |
|
96 |
||
97 |
documentation |
|
98 |
" |
|
99 |
WARNING: Unfinished. |
|
100 |
||
101 |
Experimental implementation of custom font rendered using |
|
102 |
Xft library (UNIX / X Window only), To actually use it, |
|
103 |
add following definitions to the end of stx/configurations/myConf |
|
104 |
(works on Ubuntu 12.10) |
|
105 |
||
106 |
--- snip --- |
|
107 |
XDEFS+=-DXFT |
|
108 |
XINCLUDE+=$(shell pkg-config --cflags xft) |
|
109 |
LIB_XFT=-l:libXft.so.2 -l:libfontconfig.so.1 |
|
110 |
--- snip -- |
|
111 |
||
112 |
NOTE: This class should be named XftFont, however then |
|
113 |
there would be a name clash with XftFont structure |
|
114 |
defined in Xft.h - therefore the class is named |
|
115 |
XftFontDescription to avoid that name clash. |
|
116 |
||
117 |
||
118 |
[author:] |
|
6179 | 119 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
6176 | 120 |
|
121 |
[instance variables:] |
|
122 |
||
123 |
[class variables:] |
|
124 |
||
125 |
[see also:] |
|
126 |
||
127 |
" |
|
128 |
! ! |
|
129 |
||
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
|
130 |
!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
|
131 |
|
6327 | 132 |
flushListOfAvailableFonts |
133 |
CachedFontList := nil. |
|
134 |
||
135 |
" |
|
136 |
XftFontDescription flushListOfAvailableFonts |
|
137 |
" |
|
138 |
! |
|
139 |
||
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
|
140 |
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
|
141 |
"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
|
142 |
|
6947 | 143 |
Lobby isNil ifTrue:[ |
7121 | 144 |
Lobby := Registry new. |
6946 | 145 |
]. |
146 |
||
6185
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
147 |
"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
|
148 |
! ! |
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
|
149 |
|
6325 | 150 |
!XftFontDescription class methodsFor:'instance creation'! |
151 |
||
152 |
family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding |
|
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
153 |
"returns a font for given family, face, style, size and the specified encoding. |
6325 | 154 |
The returned font is not associated to a specific device" |
155 |
||
156 |
|proto| |
|
157 |
||
6707 | 158 |
RecentlyUsedFonts notNil ifTrue:[ |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
159 |
proto := RecentlyUsedFonts |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
160 |
detect:[:fn | |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
161 |
fn sameFamily: familyString |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
162 |
face: faceString |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
163 |
style: styleString |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
164 |
size: size |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
165 |
unit: sizeUnit |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
166 |
pixelSize: nil |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
167 |
encoding: encoding] |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
168 |
ifNone:[ nil ]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
169 |
proto notNil ifTrue:[ |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
170 |
^ proto |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
171 |
]. |
6659 | 172 |
]. |
173 |
||
6325 | 174 |
CachedFontList notNil ifTrue:[ |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
175 |
proto := CachedFontList |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
176 |
detect:[:fn | |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
177 |
fn sameFamily: familyString |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
178 |
face: faceString |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
179 |
style: styleString |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
180 |
size: size |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
181 |
unit: sizeUnit |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
182 |
pixelSize: nil |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
183 |
encoding: encoding] |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
184 |
ifNone:[ nil ]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
185 |
proto notNil ifTrue:[ |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
186 |
^ (proto shallowCopy) |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
187 |
setDevice: nil patternId: nil fontId: nil; |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
188 |
family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
189 |
]. |
6325 | 190 |
]. |
191 |
^ super |
|
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
192 |
family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
193 |
|
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
194 |
"Modified: / 29-02-2016 / 08:34:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6325 | 195 |
! |
196 |
||
6993 | 197 |
for:aFontOrFontDescription |
198 |
^ self |
|
199 |
family:aFontOrFontDescription family |
|
200 |
face:aFontOrFontDescription face |
|
201 |
style:aFontOrFontDescription style |
|
202 |
size:aFontOrFontDescription size |
|
203 |
sizeUnit:#pt |
|
204 |
encoding:aFontOrFontDescription encoding |
|
205 |
! |
|
206 |
||
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
207 |
named: aString |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
208 |
^ self new setName: aString |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
209 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
210 |
"Created: / 05-03-2015 / 05:20:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6993 | 211 |
! |
212 |
||
6325 | 213 |
new |
214 |
"/ self halt. |
|
215 |
^ super new. |
|
216 |
! ! |
|
217 |
||
7036 | 218 |
!XftFontDescription class methodsFor:'* uncategorized *'! |
6957 | 219 |
|
7036 | 220 |
aboutToDestroyViewWithDevice:aGLXWorkstation id:anExternalAddress |
221 |
||
222 |
"Created: / 11-10-2015 / 11:32:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6957 | 223 |
! ! |
224 |
||
6176 | 225 |
!XftFontDescription class methodsFor:'examples'! |
226 |
||
227 |
example1 |
|
228 |
" |
|
229 |
XftFontDescription example1 |
|
230 |
" |
|
231 |
|top textView| |
|
232 |
||
233 |
top := StandardSystemView new. |
|
234 |
top extent:300@200. |
|
235 |
||
236 |
textView := EditTextView new. |
|
237 |
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
|
238 |
textView basicFont: (XftFontDescription family: 'DejaVu Sans' size: 16). |
6176 | 239 |
|
240 |
top addSubView:textView. |
|
241 |
||
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
242 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile asText). |
6176 | 243 |
|
244 |
top open. |
|
245 |
||
246 |
"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
|
247 |
"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
|
248 |
! |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
249 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
250 |
example2 |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
251 |
" |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
252 |
XftFontDescription example2 |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
253 |
" |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
254 |
|top textView| |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
255 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
256 |
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
|
257 |
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
|
258 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
259 |
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
|
260 |
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
|
261 |
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
|
262 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
263 |
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
|
264 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
265 |
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
|
266 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
267 |
top open. |
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
268 |
|
a09b2e2303cb
Oops. make it compilable again (bug in stc - FCConstants private
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6184
diff
changeset
|
269 |
"Created: / 30-12-2013 / 19:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6389 | 270 |
! |
271 |
||
272 |
example3 |
|
273 |
" |
|
274 |
XftFontDescription example2 |
|
275 |
" |
|
276 |
|top textView| |
|
277 |
||
278 |
top := StandardSystemView new. |
|
279 |
top extent:300@200. |
|
280 |
||
281 |
textView := EditTextView new. |
|
282 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
283 |
textView basicFont: (XftFontDescription family: 'Indie Flower' size: 30). |
|
284 |
||
285 |
top addSubView:textView. |
|
286 |
||
287 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
288 |
||
289 |
top open. |
|
290 |
||
291 |
"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
|
292 |
! ! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
293 |
|
6936 | 294 |
!XftFontDescription class methodsFor:'primitives'! |
295 |
||
296 |
xftAvailable |
|
7154
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
297 |
<resource: #obsolete> |
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
298 |
|
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
299 |
^ ConfigurableFeatures hasXFT |
6936 | 300 |
|
301 |
"Created: / 20-12-2013 / 21:10:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
7154
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
302 |
"Modified (format): / 22-02-2016 / 08:15:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6936 | 303 |
! ! |
304 |
||
6263 | 305 |
!XftFontDescription class methodsFor:'queries'! |
306 |
||
307 |
listOfAvailableFonts |
|
6264 | 308 |
"uses fc-list to get a list of available fontDescriptions" |
309 |
||
6263 | 310 |
CachedFontList isNil ifTrue:[ |
6393 | 311 |
CachedFontList := FCFontListParser new listOfAvailableFonts |
6263 | 312 |
]. |
313 |
^ CachedFontList |
|
314 |
||
315 |
" |
|
6337 | 316 |
XftFontDescription flushListOfAvailableFonts. |
6319 | 317 |
XftFontDescription listOfAvailableFonts |
6263 | 318 |
" |
319 |
! ! |
|
320 |
||
6317 | 321 |
!XftFontDescription methodsFor:'accessing'! |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
322 |
|
6319 | 323 |
encoding |
7036 | 324 |
^ encoding ? 'iso10646-1' |
6319 | 325 |
! |
326 |
||
327 |
fullName |
|
328 |
^ name ? (self userFriendlyName) |
|
329 |
! |
|
330 |
||
6317 | 331 |
graphicsDevice |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
332 |
^ device |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
333 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
334 |
"Created: / 02-01-2014 / 23:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6319 | 335 |
! |
336 |
||
337 |
maxCode |
|
6323 | 338 |
^ maxCode ? 16rFFFF |
6319 | 339 |
! |
340 |
||
341 |
maxCode:something |
|
342 |
maxCode := something. |
|
343 |
! |
|
344 |
||
345 |
minCode |
|
6323 | 346 |
^ minCode ? 0 |
6319 | 347 |
! |
348 |
||
349 |
minCode:something |
|
350 |
minCode := something. |
|
351 |
! |
|
352 |
||
353 |
size |
|
6325 | 354 |
^ size ? 0 |
6391 | 355 |
! |
356 |
||
357 |
weight:aNumber |
|
358 |
"set the weight" |
|
359 |
||
360 |
self assert:(self fontId isNil). "/ cannot change an instantiated font |
|
361 |
||
7121 | 362 |
weight := aNumber. |
363 |
||
364 |
aNumber == FC_WEIGHT_THIN ifTrue:[ face := #thin. ^ self]. |
|
365 |
aNumber == FC_WEIGHT_EXTRALIGHT ifTrue:[ face := #extralight. ^ self]. |
|
366 |
aNumber == FC_WEIGHT_LIGHT ifTrue:[ face := #light. ^ self]. |
|
367 |
aNumber == FC_WEIGHT_BOOK ifTrue:[ face := #book. ^ self]. |
|
368 |
aNumber == FC_WEIGHT_REGULAR ifTrue:[ face := #regular. ^ self]. |
|
369 |
aNumber == FC_WEIGHT_MEDIUM ifTrue:[ face := #medium. ^ self]. |
|
370 |
aNumber == FC_WEIGHT_DEMIBOLD ifTrue:[ face := #demibold. ^ self]. |
|
371 |
aNumber == FC_WEIGHT_BOLD ifTrue:[ face := #bold. ^ self]. |
|
372 |
aNumber == FC_WEIGHT_EXTRABOLD ifTrue:[ face := #extrabold. ^ self]. |
|
373 |
aNumber == FC_WEIGHT_BLACK ifTrue:[ face := #black. ^ self]. |
|
374 |
aNumber == FC_WEIGHT_EXTRABLACK ifTrue:[ face := #extrablack. ^ self]. |
|
6391 | 375 |
|
376 |
aNumber <= (FC_WEIGHT_EXTRALIGHT + FC_WEIGHT_LIGHT // 2) ifTrue:[ |
|
7221 | 377 |
face := #extralight. |
378 |
^ self. |
|
6391 | 379 |
]. |
380 |
aNumber <= (FC_WEIGHT_LIGHT + FC_WEIGHT_BOOK // 2) ifTrue:[ |
|
7221 | 381 |
face := #light. |
382 |
^ self. |
|
6391 | 383 |
]. |
384 |
aNumber <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD // 2) ifTrue:[ |
|
7221 | 385 |
face := #medium. |
386 |
^ self. |
|
6391 | 387 |
]. |
388 |
aNumber <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD // 2) ifTrue:[ |
|
7221 | 389 |
face := #demibold. |
390 |
^ self. |
|
6391 | 391 |
]. |
392 |
aNumber <= (FC_WEIGHT_BOLD + FC_WEIGHT_BLACK // 2) ifTrue:[ |
|
7221 | 393 |
face := #bold. |
394 |
^ self. |
|
6391 | 395 |
]. |
7121 | 396 |
face := #extrabold. |
6391 | 397 |
^ self |
398 |
||
399 |
"/ FC_WEIGHT_THIN := 0. |
|
400 |
"/ FC_WEIGHT_EXTRALIGHT := 40. |
|
401 |
"/ FC_WEIGHT_ULTRALIGHT := FC_WEIGHT_EXTRALIGHT. |
|
402 |
"/ FC_WEIGHT_LIGHT := 50. |
|
403 |
"/ FC_WEIGHT_BOOK := 75. |
|
404 |
"/ FC_WEIGHT_REGULAR := 80. |
|
405 |
"/ FC_WEIGHT_NORMAL := FC_WEIGHT_REGULAR. |
|
406 |
"/ FC_WEIGHT_MEDIUM := 100. |
|
407 |
"/ FC_WEIGHT_DEMIBOLD := 180. |
|
408 |
"/ FC_WEIGHT_SEMIBOLD := FC_WEIGHT_DEMIBOLD. |
|
409 |
"/ FC_WEIGHT_BOLD := 200. |
|
410 |
"/ FC_WEIGHT_EXTRABOLD := 205. |
|
411 |
"/ FC_WEIGHT_ULTRABOLD := FC_WEIGHT_EXTRABOLD. |
|
412 |
"/ FC_WEIGHT_BLACK := 210. |
|
413 |
"/ FC_WEIGHT_HEAVY := FC_WEIGHT_BLACK. |
|
414 |
"/ FC_WEIGHT_EXTRABLACK := 215. |
|
415 |
"/ FC_WEIGHT_ULTRABLACK := FC_WEIGHT_EXTRABLACK. |
|
6317 | 416 |
! ! |
417 |
||
418 |
!XftFontDescription methodsFor:'accessing-private'! |
|
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
419 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
420 |
getFontId |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
421 |
^ fontId |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
422 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
423 |
"Created: / 02-01-2014 / 23:29:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
424 |
! ! |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
425 |
|
6936 | 426 |
!XftFontDescription methodsFor:'change & update'! |
427 |
||
428 |
update:anAspect with:something from:changedObject |
|
429 |
"I want to be informed when a view that printed something with me is destroyed. |
|
430 |
Disassociate the view from the XFT drawable" |
|
431 |
||
432 |
|drawableId| |
|
433 |
||
434 |
anAspect == #aboutToDestroy ifTrue:[ |
|
435 |
drawableId := changedObject drawableId. |
|
436 |
drawableId notNil ifTrue:[ |
|
437 |
self disassociateXftDrawableFrom:drawableId. |
|
438 |
]. |
|
439 |
changedObject removeDependent:self. |
|
440 |
]. |
|
441 |
! ! |
|
442 |
||
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
443 |
!XftFontDescription methodsFor:'converting'! |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
444 |
|
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
445 |
asNonXftFont |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
446 |
|newFont| |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
447 |
|
6656 | 448 |
newFont := FontDescription |
449 |
family:family |
|
450 |
face:face |
|
451 |
style:style |
|
452 |
size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) |
|
453 |
sizeUnit:sizeUnit |
|
454 |
encoding:encoding. |
|
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
455 |
|
6656 | 456 |
^ newFont |
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
457 |
! ! |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
458 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
459 |
!XftFontDescription methodsFor:'displaying'! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
460 |
|
6351 | 461 |
displayString:aString from:index1 to:index2Arg x:xArg y:yArg in:aGC opaque:opaque |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
462 |
"display a partial string at some position in aGC." |
7035 | 463 |
|
6707 | 464 |
|index2 bytesPerCharacter transformation |
7061 | 465 |
clipOrg clipCorn clipRect clipX clipY clipW clipH clipPnt |
6707 | 466 |
fg fgR fgG fgB fgA fgPixel bg bgR bgG bgB bgA bgPixel |
7035 | 467 |
drawX drawY drawPnt displayId screen drawableId error stringLen drawId drawIdIsShared |
7075 | 468 |
newXftDrawId newDrawableAssociation pixmapDepth| |
7035 | 469 |
|
6351 | 470 |
"limit the string len, otherwise bad output is generated" |
6477 | 471 |
stringLen := index2Arg - index1 + 1. |
7342 | 472 |
stringLen > 1000 "8000" ifTrue:[ |
473 |
index2 := index1 + 1000 "8000" - 1. |
|
6351 | 474 |
] ifFalse:[ |
7115 | 475 |
stringLen <= 0 ifTrue:[^ self]. |
476 |
index2 := index2Arg. |
|
6351 | 477 |
]. |
6209 | 478 |
bytesPerCharacter := aString bitsPerCharacter // 8. |
6199
2a683b1824c6
Bugfix in XftFontDescription>>#displayString:from:to:x:y:in:opaque: takes transformation into an account.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6198
diff
changeset
|
479 |
|
7061 | 480 |
clipRect := aGC deviceClippingRectangle. |
7050 | 481 |
clipRect notNil ifTrue:[ |
7115 | 482 |
clipX := clipRect left. |
483 |
clipY := clipRect top. |
|
484 |
clipW := clipRect width. |
|
485 |
clipH := clipRect height. |
|
6489 | 486 |
]. |
6199
2a683b1824c6
Bugfix in XftFontDescription>>#displayString:from:to:x:y:in:opaque: takes transformation into an account.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6198
diff
changeset
|
487 |
|
7061 | 488 |
transformation := aGC transformation. |
6356 | 489 |
transformation isNil ifTrue:[ |
7115 | 490 |
drawX := xArg. |
491 |
drawY := yArg. |
|
6356 | 492 |
] ifFalse:[ |
7115 | 493 |
drawPnt := transformation transformPoint:(xArg @ yArg). |
494 |
drawX := drawPnt x ceiling. |
|
495 |
drawY := drawPnt y ceiling. |
|
6356 | 496 |
]. |
497 |
||
7068 | 498 |
fg := aGC paint. |
499 |
fgR := fg scaledRed. |
|
500 |
fgG := fg scaledGreen. |
|
501 |
fgB := fg scaledBlue. |
|
502 |
fgA := fg scaledAlpha. |
|
503 |
||
6263 | 504 |
fgR isNil ifTrue:[ |
7115 | 505 |
"/ when drawing into a pixmap... |
506 |
fgPixel := fg colorId. |
|
507 |
fgPixel == 0 ifTrue:[ |
|
508 |
fgR := fgG := fgB := 0. |
|
509 |
] ifFalse:[ |
|
510 |
fgR := fgG := fgB := 16rFFFF. |
|
511 |
] |
|
6263 | 512 |
]. |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
513 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
514 |
opaque ifTrue:[ |
7115 | 515 |
bg := aGC backgroundPaint. |
516 |
bg isColor ifTrue:[ |
|
517 |
bgR := bg scaledRed. |
|
518 |
bgG := bg scaledGreen. |
|
519 |
bgB := bg scaledBlue. |
|
520 |
bgA := bg scaledAlpha. |
|
521 |
] ifFalse:[ |
|
522 |
"images are not yet implemented" |
|
523 |
"/ #todo: fill background rectangle |
|
524 |
bgR := bgG := bgB := bgA := 16rFFFF. |
|
525 |
]. |
|
526 |
bgR isNil ifTrue:[ |
|
527 |
"/ when drawing into a pixmap... |
|
528 |
bgPixel := bg colorId. |
|
529 |
bgPixel == 0 ifTrue:[ |
|
530 |
bgR := bgG := bgB := 0. |
|
531 |
] ifFalse:[ |
|
532 |
bgR := bgG := bgB := 16rFFFF. |
|
533 |
] |
|
534 |
]. |
|
6193 | 535 |
]. |
6333 | 536 |
displayId := device displayIdOrErrorIfBroken. |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
537 |
displayId isNil ifTrue:[ |
7115 | 538 |
^ self. |
6333 | 539 |
]. |
6193 | 540 |
screen := device screen. |
6351 | 541 |
drawableId := aGC drawableId. |
7075 | 542 |
aGC isForm ifTrue:[ |
7115 | 543 |
pixmapDepth := aGC depth. |
7075 | 544 |
]. |
6936 | 545 |
aGC addDependent:self. "I need to be informed, when the GC is destroyed" |
6209 | 546 |
|
6726
9f16fe1701f5
XGraphicsContext made public to allow subclassing and extending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6725
diff
changeset
|
547 |
aGC class == XGraphicsContext ifTrue:[ |
7032 | 548 |
"/ TODO: Following should be done atomically together with drawing... |
549 |
drawId := aGC xftDrawId. |
|
550 |
drawIdIsShared := false. |
|
551 |
drawId isNil ifTrue:[ |
|
6193 | 552 |
%{ |
7077 | 553 |
if (pixmapDepth != nil) { |
554 |
int __pixmapDepth = __intVal(pixmapDepth); |
|
555 |
if (__pixmapDepth == 1) { |
|
556 |
drawId = XFT_DRAW_HANDLE_NEW ( XftDrawCreateBitmap ( DISPLAY( displayId ) , |
|
557 |
DRAWABLE( drawableId ) ) ); |
|
558 |
} else { |
|
559 |
drawId = XFT_DRAW_HANDLE_NEW ( XftDrawCreateAlpha ( DISPLAY( displayId ) , |
|
560 |
DRAWABLE( drawableId ), __pixmapDepth) ); |
|
561 |
} |
|
7072 | 562 |
} else { |
563 |
drawId = XFT_DRAW_HANDLE_NEW ( XftDrawCreate ( DISPLAY( displayId ) , |
|
564 |
DRAWABLE( drawableId ) , |
|
565 |
DefaultVisual( DISPLAY( displayId), SCREEN (screen) ) , |
|
566 |
DefaultColormap( DISPLAY( displayId), SCREEN (screen) ) ) ); |
|
567 |
} |
|
6530
b4c269c96b08
Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6529
diff
changeset
|
568 |
%}. |
7032 | 569 |
aGC xftDrawId: drawId. |
570 |
]. |
|
6819
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
571 |
] ifFalse:[ |
7032 | 572 |
Logger log: 'GC passed to XftGraphicsContext is not an XGraphicsContext!!' severity: #error. |
573 |
drawId := sharedDrawId. |
|
574 |
drawIdIsShared := true. |
|
7075 | 575 |
]. |
6209 | 576 |
|
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
577 |
%{ /* UNLIMITEDSTACK */ |
6193 | 578 |
#ifdef XFT |
579 |
XftColor color; |
|
580 |
XGlyphInfo extents; |
|
581 |
XRectangle clipRX; |
|
6936 | 582 |
char *string; |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
583 |
int len; |
6209 | 584 |
int __bytesPerCharacter; |
6936 | 585 |
XftDraw *__sharedDrawId; |
586 |
XftFont *__xftFont = XFT_FONT(__INST(fontId)); |
|
6193 | 587 |
|
6209 | 588 |
if (!(__bothSmallInteger(drawX, drawY) |
7115 | 589 |
&& __bothSmallInteger(index1, index2) |
590 |
&& __isSmallInteger(bytesPerCharacter) |
|
591 |
&& (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA))) |
|
592 |
&& (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA))) |
|
593 |
&& __isNonNilObject(aString) |
|
6209 | 594 |
)) { |
6936 | 595 |
goto err; |
6209 | 596 |
} |
597 |
||
598 |
__bytesPerCharacter = __intVal(bytesPerCharacter); |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
599 |
|
6530
b4c269c96b08
Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6529
diff
changeset
|
600 |
if (drawIdIsShared == true) { |
6936 | 601 |
if (__INST(sharedDrawId) == nil) { |
7077 | 602 |
if (pixmapDepth != nil) { |
603 |
int __pixmapDepth = __intVal(pixmapDepth); |
|
604 |
if (__pixmapDepth == 1) { |
|
605 |
__sharedDrawId = XftDrawCreateBitmap ( DISPLAY( displayId ) , |
|
606 |
DRAWABLE( drawableId ) ); |
|
607 |
} else { |
|
608 |
__sharedDrawId = XftDrawCreateAlpha ( DISPLAY( displayId ) , |
|
609 |
DRAWABLE( drawableId ), __pixmapDepth); |
|
610 |
} |
|
7115 | 611 |
} else { |
612 |
__sharedDrawId = XftDrawCreate(DISPLAY(displayId), |
|
613 |
DRAWABLE(drawableId), |
|
614 |
DefaultVisual(DISPLAY(displayId), SCREEN(screen)), |
|
615 |
DefaultColormap(DISPLAY(displayId), SCREEN(screen))); |
|
616 |
} |
|
6936 | 617 |
__INST(sharedDrawId) = XFT_DRAW_HANDLE_NEW(__sharedDrawId); |
618 |
__STORE(self, __INST(sharedDrawId)); |
|
619 |
} else if (XftDrawDrawable(__sharedDrawId = XFT_DRAW(__INST(sharedDrawId))) != DRAWABLE(drawableId)) { |
|
620 |
XftDrawChange(__sharedDrawId, DRAWABLE(drawableId)); |
|
7032 | 621 |
} |
7069 | 622 |
} else { |
7032 | 623 |
__sharedDrawId = XFT_DRAW ( drawId ); |
6193 | 624 |
} |
625 |
||
6936 | 626 |
string = __stringVal(aString) + ((__intVal(index1) - 1 ) * __bytesPerCharacter); |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
627 |
len = __intVal(index2) - __intVal(index1) + 1; |
6193 | 628 |
|
7050 | 629 |
if (clipRect != nil) { |
7115 | 630 |
clipRX.x = __intVal(clipX); |
631 |
clipRX.y = __intVal(clipY); |
|
632 |
clipRX.width = __intVal(clipW); |
|
633 |
clipRX.height = __intVal(clipH); |
|
634 |
XftDrawSetClipRectangles(__sharedDrawId, 0, 0, &clipRX, 1); |
|
6193 | 635 |
} else { |
7115 | 636 |
XftDrawSetClip(__sharedDrawId, 0); |
6193 | 637 |
} |
638 |
||
6223 | 639 |
if (opaque == true) { |
7115 | 640 |
if (bgPixel != nil) { |
641 |
color.pixel = (unsigned long)__intVal(bgPixel); |
|
642 |
} |
|
643 |
color.color.red = __intVal(bgR); |
|
644 |
color.color.green = __intVal(bgG); |
|
645 |
color.color.blue = __intVal(bgB); |
|
646 |
color.color.alpha = __intVal(bgA); |
|
7068 | 647 |
|
7115 | 648 |
switch (__bytesPerCharacter) { |
649 |
case 1: |
|
650 |
XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents); |
|
651 |
break; |
|
652 |
case 2: |
|
653 |
XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents); |
|
654 |
break; |
|
655 |
case 4: |
|
656 |
XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents); |
|
657 |
break; |
|
658 |
} |
|
659 |
XftDrawRect(__sharedDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height); |
|
6193 | 660 |
} |
6223 | 661 |
if (fgPixel != nil) { |
7115 | 662 |
color.pixel = (unsigned long)__intVal(fgPixel); |
6223 | 663 |
} |
7068 | 664 |
color.color.red = __intVal(fgR); |
665 |
color.color.green = __intVal(fgG); |
|
666 |
color.color.blue = __intVal(fgB); |
|
667 |
color.color.alpha = __intVal(fgA); |
|
668 |
||
6209 | 669 |
switch (__bytesPerCharacter) { |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
670 |
case 1: |
7115 | 671 |
XftDrawString8(__sharedDrawId, &color,__xftFont, |
672 |
__intVal(drawX), |
|
673 |
__intVal(drawY), |
|
674 |
(FcChar8*)string, |
|
675 |
len); |
|
676 |
break; |
|
6936 | 677 |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
678 |
case 2: |
7115 | 679 |
XftDrawString16(__sharedDrawId, &color, __xftFont, |
680 |
__intVal(drawX), |
|
681 |
__intVal(drawY), |
|
682 |
(FcChar16*)string, |
|
683 |
len); |
|
684 |
break; |
|
6936 | 685 |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
686 |
case 4: |
7115 | 687 |
XftDrawString32(__sharedDrawId, &color, __xftFont, |
688 |
__intVal(drawX), |
|
689 |
__intVal(drawY), |
|
690 |
(FcChar32*)string, |
|
691 |
len); |
|
692 |
break; |
|
6936 | 693 |
|
694 |
default: |
|
695 |
goto err; |
|
6193 | 696 |
} |
6936 | 697 |
|
7075 | 698 |
if (pixmapDepth != nil) { |
7115 | 699 |
XftDrawDestroy(__sharedDrawId); |
7070 | 700 |
} |
701 |
||
6936 | 702 |
# if 0 // this has been superseeded by receiving change messages on view destroy |
703 |
// Have to disassociate the drawableId - otherwise we get an X11 error 'RenderBadPicture (invalid Picture parameter)' |
|
704 |
// when the drawable (the window) is destroyed. |
|
705 |
XftDrawChange(__sharedDrawId, None); |
|
706 |
# endif |
|
707 |
RETURN(self); |
|
708 |
||
6193 | 709 |
#endif |
710 |
err:; |
|
711 |
%}. |
|
712 |
self primitiveFailed: error. |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
713 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
714 |
"Created: / 21-12-2013 / 21:11:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6530
b4c269c96b08
Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6529
diff
changeset
|
715 |
"Modified: / 23-06-2014 / 22:06:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6176 | 716 |
! ! |
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 |
|
7154
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
723 |
ConfigurableFeatures hasXFT ifFalse:[ |
6936 | 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 |
|
7154
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
732 |
ConfigurableFeatures hasXFT ifFalse:[ |
6936 | 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 |
finalizationLobby |
|
741 |
^ Lobby |
|
742 |
! |
|
743 |
||
744 |
finalize |
|
745 |
self xftDrawDestroy |
|
746 |
! ! |
|
747 |
||
6176 | 748 |
!XftFontDescription methodsFor:'getting a device font'! |
749 |
||
750 |
onDevice:aGraphicsDevice |
|
751 |
"Create a new XftFont representing the closes font as |
|
752 |
myself on aDevice; if one already exists, return the one." |
|
753 |
||
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
754 |
^ self onDevice: aGraphicsDevice ifAbsent: nil |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
755 |
|
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
756 |
"Modified: / 14-04-1997 / 18:22:31 / cg" |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
757 |
"Modified: / 29-02-2016 / 07:08:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7114 | 758 |
! |
759 |
||
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
760 |
onDevice:aGraphicsDevice ifAbsent: aBlock |
7114 | 761 |
"Create a new XftFont representing the closes font as |
762 |
myself on aDevice; if one already exists, return the one." |
|
6176 | 763 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
764 |
| myPatternId closestPatternId1 closestPatternId2 newFontId | |
6176 | 765 |
|
7114 | 766 |
(device == aGraphicsDevice) ifTrue:[ |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
767 |
"I am already assigned to that device ..." |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
768 |
^ self |
7114 | 769 |
]. |
770 |
aGraphicsDevice isNil ifTrue:[ |
|
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
771 |
^ self |
6544 | 772 |
]. |
7121 | 773 |
aGraphicsDevice supportsXftFonts ifFalse:[ |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
774 |
^ super onDevice:aGraphicsDevice ifAbsent:aBlock. |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
775 |
]. |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
776 |
|
6389 | 777 |
RecentlyUsedFonts isNil ifTrue:[ |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
778 |
RecentlyUsedFonts := OrderedCollection new:20. |
6389 | 779 |
]. |
780 |
||
781 |
RecentlyUsedFonts keysAndValuesDo:[:index :aFont | |
|
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
782 |
((aFont class == self class) and:[(self sameDeviceFontAs:aFont)]) ifTrue:[ |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
783 |
"/ Transcript showCR:'hit'. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
784 |
RecentlyUsedFonts |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
785 |
removeIndex:index; |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
786 |
addFirst:aFont. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
787 |
^ aFont |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
788 |
] |
6389 | 789 |
]. |
790 |
||
6974 | 791 |
RecentlyUsedFonts size >= 20 ifTrue:[ |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
792 |
RecentlyUsedFonts removeLast. |
6389 | 793 |
]. |
794 |
||
6176 | 795 |
aGraphicsDevice deviceFonts do:[:aFont | |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
796 |
((aFont class == self class) and:[self sameDeviceFontAs:aFont]) ifTrue:[ |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
797 |
RecentlyUsedFonts addFirst:aFont. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
798 |
^ aFont |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
799 |
]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
800 |
]. |
6176 | 801 |
|
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
802 |
"/ Transcript show: 'XFT font not found in cache:'; showCR: self printString. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
803 |
[ |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
804 |
myPatternId := FcPattern fromFontDescription: self. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
805 |
newFontId := self xftFontOpenPattern: aGraphicsDevice displayId pattern: myPatternId. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
806 |
newFontId notNil ifTrue:[ |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
807 |
"/ Good, this font exists!! |
7103 | 808 |
myPatternId := nil. |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
809 |
] ifFalse:[ |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
810 |
closestPatternId1 := self xftFontMatch: aGraphicsDevice displayId screen: aGraphicsDevice screen pattern: myPatternId. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
811 |
closestPatternId1 isNil ifTrue:[ |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
812 |
self error: 'No font matches'. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
813 |
]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
814 |
closestPatternId2 := closestPatternId1 copy. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
815 |
newFontId := self xftFontOpenPattern: aGraphicsDevice displayId pattern: closestPatternId1. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
816 |
"/ !!!!!!!! closestPatternId is no longer valid !!!!!!!! |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
817 |
closestPatternId1 := nil. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
818 |
newFontId isNil ifTrue:[ |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
819 |
^ aBlock value |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
820 |
]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
821 |
]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
822 |
fontId := newFontId. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
823 |
device := aGraphicsDevice. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
824 |
aGraphicsDevice registerFont:self. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
825 |
RecentlyUsedFonts addFirst:self. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
826 |
myPatternId notNil ifTrue:[myPatternId release]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
827 |
closestPatternId1 notNil ifTrue:[closestPatternId1 release]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
828 |
closestPatternId2 notNil ifTrue:[closestPatternId2 release]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
829 |
^ self. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
830 |
] ensure:[ |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
831 |
myPatternId notNil ifTrue:[myPatternId release]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
832 |
closestPatternId1 notNil ifTrue:[closestPatternId1 release]. |
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
833 |
closestPatternId2 notNil ifTrue:[closestPatternId2 release]. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
834 |
]. |
6176 | 835 |
|
836 |
" |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
837 |
(XftFontDescription family:'monospace' size:16) onDevice:Screen current |
6176 | 838 |
" |
839 |
||
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
840 |
"Modified: / 29-02-2016 / 08:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6176 | 841 |
! ! |
842 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
843 |
!XftFontDescription methodsFor:'initialization'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
844 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
845 |
setDevice: deviceArg patternId: patternIdArg fontId: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
846 |
device := deviceArg. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
847 |
fontId := fontIdArg. |
6325 | 848 |
patternIdArg notNil ifTrue:[ |
7169
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
849 |
family := patternIdArg at: FC_FAMILY index: 1. |
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
850 |
size := patternIdArg at: FC_SIZE index: 1. |
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
851 |
face := patternIdArg at: FC_WEIGHT index: 1. |
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
852 |
face := StXFace2FCWeightMap keyAtValue: face. |
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
853 |
face isEmptyOrNil ifTrue:[ face := nil ]. |
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
854 |
style := patternIdArg at: FC_SLANT index: 1. |
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
855 |
style := StXStyle2FCSlantMap keyAtValue: style. |
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
856 |
style isEmptyOrNil ifTrue:[ style := nil ]. |
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
857 |
name := patternIdArg at: FC_FULLNAME index: 1. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
858 |
|
7169
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
859 |
encoding:= patternIdArg at: 'encoding' index: 1. |
6963 | 860 |
]. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
861 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
862 |
"Created: / 21-12-2013 / 00:46:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7171
71c34a23762b
X11/XFT: Fixed a baaad bug in font caching causing horrible performance regression
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7169
diff
changeset
|
863 |
"Modified: / 29-02-2016 / 07:43:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
864 |
! |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
865 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
866 |
setName: aString |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
867 |
"Initializes font description from a string like 'times-12' or 'times,charter-12:bold'" |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
868 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
869 |
| pattern | |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
870 |
|
7151
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
871 |
pattern := FcPattern fromString: aString. |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
872 |
pattern notNil ifTrue:[ |
7151
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
873 |
family := pattern at: FC_FAMILY index: 1. |
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
874 |
size := pattern at: FC_SIZE index: 1. |
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
875 |
face := pattern at: FC_WEIGHT index: 1. |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
876 |
face := StXFace2FCWeightMap keyAtValue: face. |
7151
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
877 |
style := pattern at: FC_SLANT index: 1. |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
878 |
style := StXStyle2FCSlantMap keyAtValue: style. |
7151
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
879 |
name := pattern at: FC_FULLNAME index: 1. |
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
880 |
encoding:= pattern at: 'encoding' index: 1. |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
881 |
encoding notNil ifTrue:[encoding := encoding asSymbol]. |
7151
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
882 |
pattern release. |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
883 |
]. |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
884 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
885 |
" |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
886 |
XftFontDescription named: 'times-12' |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
887 |
XftFontDescription named: 'times,charter-12:bold' |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
888 |
XftFontDescription named: 'Sans-10' |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
889 |
" |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
890 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
891 |
"Created: / 05-03-2015 / 05:19:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
892 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
893 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
894 |
!XftFontDescription methodsFor:'primitives'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
895 |
|
6936 | 896 |
disassociateXftDrawableFrom:drawableId |
897 |
"Disassociate the XftDrawable from drawableId. |
|
898 |
This mist be done before the drawable is destroyed, |
|
899 |
otherwise the XftDrawable is destroyed together with the drawable, |
|
900 |
and X11 errors will be signaled." |
|
901 |
||
902 |
| error | |
|
903 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
904 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
905 |
#ifdef XFT |
6936 | 906 |
if (!__isExternalAddressLike(__INST(sharedDrawId))) { |
907 |
// nothing to disasassociate from... |
|
908 |
RETURN(self); |
|
909 |
} |
|
910 |
if (!__isExternalAddressLike(drawableId)) { |
|
911 |
error = @symbol(BadArg); |
|
912 |
goto err; |
|
913 |
} |
|
914 |
if (XftDrawDrawable(XFT_DRAW(__INST(sharedDrawId))) == DRAWABLE(drawableId)) { |
|
915 |
XftDrawChange(XFT_DRAW(__INST(sharedDrawId)), None); |
|
916 |
} |
|
917 |
RETURN(self); |
|
918 |
err:; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
919 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
920 |
%}. |
6936 | 921 |
self primitiveFailed: error |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
922 |
|
6936 | 923 |
"Created: / 26-12-2013 / 12:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
924 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
925 |
|
6936 | 926 |
xftDrawChange:xftDrawId drawable:drawableId |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
927 |
| error | |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
928 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
929 |
%{ |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
930 |
#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
|
931 |
if ( ! __isExternalAddressLike(xftDrawId) ) { |
6936 | 932 |
error = @symbol(BadArg1); |
933 |
goto err; |
|
934 |
} |
|
935 |
if (drawableId == nil) { |
|
936 |
XftDrawChange(XFT_DRAW(xftDrawId), None); |
|
937 |
RETURN (self); |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
938 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
939 |
if ( ! __isExternalAddressLike(drawableId) ) { |
6936 | 940 |
error = @symbol(BadArg2); |
941 |
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
|
942 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
943 |
if (XftDrawDrawable( XFT_DRAW(xftDrawId) ) != DRAWABLE( drawableId ) ) { |
6936 | 944 |
XftDrawChange( XFT_DRAW(xftDrawId) , DRAWABLE( drawableId ) ); |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
945 |
} |
6936 | 946 |
RETURN (self); |
947 |
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
|
948 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
949 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
950 |
self primitiveFailed: error |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
951 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
952 |
"Created: / 26-12-2013 / 12:17:36 / 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
|
953 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
954 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
955 |
xftDrawCreate: displayId screen: screen drawable: drawableId |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
956 |
| error | |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
957 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
958 |
%{ |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
959 |
#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
|
960 |
if ( ! __isExternalAddressLike(displayId) ) { |
6198 | 961 |
error = @symbol(BadArg1); |
962 |
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
|
963 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
964 |
if ( ! __isSmallInteger(screen) ) { |
6198 | 965 |
error = @symbol(BadArg2); |
966 |
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
|
967 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
968 |
if ( ! __isExternalAddressLike(drawableId) ) { |
6198 | 969 |
error = @symbol(BadArg3); |
970 |
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
|
971 |
} |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
972 |
RETURN ( XFT_DRAW_HANDLE_NEW ( XftDrawCreate ( DISPLAY( displayId ) , |
6198 | 973 |
DRAWABLE( drawableId ) , |
974 |
DefaultVisual( DISPLAY( displayId), SCREEN (screen) ) , |
|
975 |
DefaultColormap( DISPLAY( displayId), SCREEN (screen) ) ) ) ); |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
976 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
977 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
978 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
979 |
self primitiveFailed: error |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
980 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
981 |
"Created: / 21-12-2013 / 21:12: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
|
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 |
|
6946 | 984 |
xftDrawDestroy |
985 |
%{ |
|
986 |
#ifdef XFT |
|
987 |
if (__INST(sharedDrawId) != nil) { |
|
988 |
XftDraw *xftDrawable = XFT_DRAW(__INST(sharedDrawId)); |
|
989 |
__INST(sharedDrawId) = nil; |
|
990 |
XftDrawDestroy(xftDrawable); |
|
991 |
} |
|
992 |
RETURN (self); |
|
993 |
#endif |
|
994 |
%}. |
|
995 |
self primitiveFailed. |
|
996 |
! |
|
997 |
||
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
998 |
xftDrawRect: drawIdArg color: aColor x: x y: y width: w height: h |
6198 | 999 |
| error r g b a pix | |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1000 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1001 |
aColor isColor ifFalse:[^self primitiveFailed: #BadArg2]. |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1002 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1003 |
r := aColor scaledRed. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1004 |
g := aColor scaledGreen. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1005 |
b := aColor scaledBlue. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1006 |
a := aColor alpha * 65535. |
6263 | 1007 |
r isNil ifTrue:[ |
1008 |
"/ when drawing into a pixmap... |
|
1009 |
aColor colorId == 0 ifTrue:[ |
|
1010 |
r := g := b := 0. |
|
1011 |
] ifFalse:[ |
|
1012 |
r := g := b := 16rFFFF. |
|
1013 |
] |
|
1014 |
]. |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1015 |
pix := aColor colorId. |
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1016 |
%{ /* UNLIMITEDSTACK */ |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1017 |
#ifdef XFT |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1018 |
XftColor clr; |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1019 |
if ( ! __isExternalAddressLike(drawIdArg) ) { |
6198 | 1020 |
error = @symbol(BadArg1); |
1021 |
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
|
1022 |
} |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1023 |
if ( ! __isSmallInteger(pix) ) { |
6198 | 1024 |
error = @symbol(BadColorId); |
1025 |
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
|
1026 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1027 |
if ( ! __isSmallInteger(x) ) { |
6198 | 1028 |
error = @symbol(BadArg3); |
1029 |
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
|
1030 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1031 |
if ( ! __isSmallInteger(y) ) { |
6198 | 1032 |
error = @symbol(BadArg4); |
1033 |
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
|
1034 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1035 |
if ( ! __isSmallInteger(w) ) { |
6198 | 1036 |
error = @symbol(BadArg5); |
1037 |
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
|
1038 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1039 |
if ( ! __isSmallInteger(h) ) { |
6198 | 1040 |
error = @symbol(BadArg6); |
1041 |
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
|
1042 |
} |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1043 |
clr.pixel = (unsigned long)__intVal(pix); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1044 |
clr.color.red = __intVal(r); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1045 |
clr.color.green = __intVal(g); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1046 |
clr.color.blue = __intVal(b); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1047 |
clr.color.alpha = __intVal(a); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1048 |
|
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1049 |
XftDrawRect(XFT_DRAW(drawIdArg), &clr, |
6198 | 1050 |
__intVal(x), __intVal(y), __intVal(w) ,__intVal(h)); |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1051 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1052 |
RETURN ( self ); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1053 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1054 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1055 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1056 |
self primitiveFailed: error. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1057 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1058 |
"Created: / 28-12-2013 / 23:35:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1059 |
"Modified: / 31-12-2013 / 00:37:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1060 |
! |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1061 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1062 |
xftDrawSetClip: drawIdArg rectangle: rect |
6198 | 1063 |
| error xObj yObj wObj hObj | |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1064 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1065 |
rect notNil ifTrue:[ |
6198 | 1066 |
xObj := rect left. |
1067 |
yObj := rect top. |
|
1068 |
wObj := rect width. |
|
1069 |
hObj := rect height. |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1070 |
]. |
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1071 |
%{ /* UNLIMITEDSTACK */ |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1072 |
#ifdef XFT |
6191
86ef1e69ffc1
Call XftConfigSubstitute() & XftDefaultSubstitute() before matching fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6190
diff
changeset
|
1073 |
XRectangle r; |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1074 |
if ( ! __isExternalAddressLike(drawIdArg) ) { |
6198 | 1075 |
error = @symbol(BadArg1); |
1076 |
goto err; |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1077 |
} |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1078 |
if (rect != nil) { |
6198 | 1079 |
r.x = __intVal(xObj); |
1080 |
r.y = __intVal(yObj); |
|
1081 |
r.width = __intVal(wObj); |
|
1082 |
r.height = __intVal(hObj); |
|
1083 |
XftDrawSetClipRectangles( XFT_DRAW(drawIdArg) , 0, 0, &r, 1); |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1084 |
} else { |
6198 | 1085 |
XftDrawSetClipRectangles( XFT_DRAW(drawIdArg) , 0, 0, (XRectangle*)NULL, 0); |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1086 |
} |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1087 |
RETURN ( self ); |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1088 |
err:; |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1089 |
#endif |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1090 |
%}. |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1091 |
self primitiveFailed: error. |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1092 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1093 |
"Created: / 31-12-2013 / 01:24:39 / 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
|
1094 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1095 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1096 |
xftDrawString: drawIdArg color: aColor font: fontIdArg x: x y: y string: text from: start to: stop |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1097 |
| error r g b a pix | |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1098 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1099 |
aColor isColor ifFalse:[^self primitiveFailed: #BadArg2]. |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1100 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1101 |
r := aColor scaledRed. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1102 |
g := aColor scaledGreen. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1103 |
b := aColor scaledBlue. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1104 |
a := aColor alpha * 65535. |
6263 | 1105 |
r isNil ifTrue:[ |
1106 |
"/ when drawing into a pixmap... |
|
1107 |
aColor colorId == 0 ifTrue:[ |
|
1108 |
r := g := b := 0. |
|
1109 |
] ifFalse:[ |
|
1110 |
r := g := b := 16rFFFF. |
|
1111 |
] |
|
1112 |
]. |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1113 |
pix := aColor colorId. |
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1114 |
%{ /* UNLIMITEDSTACK */ |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1115 |
#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
|
1116 |
int _start, _stop; |
6707 | 1117 |
int __x, __y; |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1118 |
XftColor clr; |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1119 |
if ( ! __isExternalAddressLike(drawIdArg) ) { |
6198 | 1120 |
error = @symbol(BadArg1); |
1121 |
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
|
1122 |
} |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1123 |
if ( ! __isSmallInteger(pix) ) { |
6198 | 1124 |
error = @symbol(BadColorId); |
1125 |
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
|
1126 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1127 |
if ( ! __isSmallInteger(x) ) { |
6198 | 1128 |
error = @symbol(BadArg4); |
1129 |
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
|
1130 |
} |
6707 | 1131 |
__x = __intVal(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
|
1132 |
if ( ! __isSmallInteger(y) ) { |
6198 | 1133 |
error = @symbol(BadArg5); |
1134 |
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
|
1135 |
} |
6707 | 1136 |
__y = __intVal(y); |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1137 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1138 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1139 |
if ( ! __isSmallInteger(start) ) { |
6198 | 1140 |
error = @symbol(BadArg6); |
1141 |
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
|
1142 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1143 |
_start = __intVal(start); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1144 |
if ( ! __isSmallInteger(stop) ) { |
6198 | 1145 |
error = @symbol(BadArg7); |
1146 |
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
|
1147 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1148 |
_stop = __intVal(stop); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1149 |
|
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1150 |
clr.pixel = (unsigned long)__intVal(pix); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1151 |
clr.color.red = __intVal(r); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1152 |
clr.color.green = __intVal(g); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1153 |
clr.color.blue = __intVal(b); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1154 |
clr.color.alpha = __intVal(a); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1155 |
|
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
|
1156 |
if ( __isStringLike(text) ) { |
6198 | 1157 |
XftDrawString8(XFT_DRAW(drawIdArg), &clr, XFT_FONT(fontIdArg), |
6707 | 1158 |
__x, __y, |
6198 | 1159 |
__stringVal(text) + (_start - 1), _stop - _start + 1); |
1160 |
RETURN ( self ); |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1161 |
} else { |
6198 | 1162 |
error = @symbol(BadArg5); |
1163 |
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
|
1164 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1165 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1166 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1167 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1168 |
self primitiveFailed: error. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1169 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1170 |
"Created: / 28-12-2013 / 12:32:18 / 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
|
1171 |
"Modified: / 30-12-2013 / 20:00:49 / 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
|
1172 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1173 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1174 |
xftFontGetAscent: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1175 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1176 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1177 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1178 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1179 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1180 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7221 | 1181 |
error = @symbol(BadArg1); |
1182 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1183 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1184 |
v = XFT_FONT(fontIdArg)->ascent; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1185 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1186 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1187 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1188 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1189 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1190 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1191 |
"Created: / 21-12-2013 / 00:56:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1192 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1193 |
|
6198 | 1194 |
xftFontGetDescent:fontIdArg |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1195 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1196 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1197 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1198 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1199 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1200 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7221 | 1201 |
error = @symbol(BadArg1); |
1202 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1203 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1204 |
v = XFT_FONT(fontIdArg)->descent; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1205 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1206 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1207 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1208 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1209 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1210 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1211 |
"Created: / 21-12-2013 / 00:56:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1212 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1213 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1214 |
xftFontGetHeight: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1215 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1216 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1217 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1218 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1219 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1220 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7221 | 1221 |
error = @symbol(BadArg1); |
1222 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1223 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1224 |
v = XFT_FONT(fontIdArg)->height; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1225 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1226 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1227 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1228 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1229 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1230 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1231 |
"Created: / 21-12-2013 / 00:56:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1232 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1233 |
|
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
|
1234 |
xftFontGetMaxAdvanceWidth: fontIdArg |
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
|
1235 |
| error | |
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
|
1236 |
|
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
|
1237 |
%{ |
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
|
1238 |
#ifdef XFT |
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
|
1239 |
int v; |
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
|
1240 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7221 | 1241 |
error = @symbol(BadArg1); |
1242 |
goto err; |
|
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
|
1243 |
} |
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
|
1244 |
v = XFT_FONT(fontIdArg)->max_advance_width; |
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
|
1245 |
RETURN ( __MKINT( v ) ); |
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
|
1246 |
err:; |
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
|
1247 |
#endif |
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
|
1248 |
%}. |
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
|
1249 |
self primitiveFailed: error |
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
|
1250 |
|
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
|
1251 |
"Created: / 30-12-2013 / 20:02:20 / 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
|
1252 |
! |
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
|
1253 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1254 |
xftFontGetPattern: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1255 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1256 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1257 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1258 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1259 |
XftPattern* p; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1260 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7221 | 1261 |
error = @symbol(BadArg1); |
1262 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1263 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1264 |
p = XFT_FONT(fontIdArg)->pattern; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1265 |
if (p == NULL) { |
7221 | 1266 |
RETURN ( nil ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1267 |
} else { |
7221 | 1268 |
RETURN ( FC_PATTERN_HANDLE_NEW ( p ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1269 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1270 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1271 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1272 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1273 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1274 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1275 |
"Created: / 21-12-2013 / 00:55:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1276 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1277 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1278 |
xftFontMatch: displayId screen: screen pattern: patternId |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1279 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1280 |
|
7103 | 1281 |
%{ /* UNLIMITEDSTACK */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1282 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1283 |
XftPattern* p; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1284 |
XftResult r; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1285 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1286 |
if ( ! __isExternalAddressLike(displayId) ) { |
6198 | 1287 |
error = @symbol(BadArg1); |
1288 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1289 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1290 |
if ( ! __isSmallInteger( screen ) ) { |
6198 | 1291 |
error = @symbol(BadArg2); |
1292 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1293 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1294 |
if ( ! __isExternalAddressLike(patternId) ) { |
6198 | 1295 |
error = @symbol(BadArg3); |
1296 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1297 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1298 |
|
6191
86ef1e69ffc1
Call XftConfigSubstitute() & XftDefaultSubstitute() before matching fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6190
diff
changeset
|
1299 |
XftConfigSubstitute(FC_PATTERN( patternId )); |
86ef1e69ffc1
Call XftConfigSubstitute() & XftDefaultSubstitute() before matching fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6190
diff
changeset
|
1300 |
XftDefaultSubstitute(DISPLAY(displayId) , SCREEN( screen ), FC_PATTERN( patternId )); |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1301 |
p = XftFontMatch( DISPLAY(displayId) , SCREEN( screen ), FC_PATTERN( patternId ), &r ); |
6192
d79a5e546361
Fixes in call to XftFontMatch() - ignore result value (last arg).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6191
diff
changeset
|
1302 |
if (p) { |
6198 | 1303 |
RETURN ( FC_PATTERN_HANDLE_NEW ( p ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1304 |
} else { |
6198 | 1305 |
error = @symbol(XftFontMatchReturnedNull); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1306 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1307 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1308 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1309 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1310 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1311 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1312 |
"Created: / 21-12-2013 / 00:08:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1313 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1314 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1315 |
xftFontOpenPattern: displayId pattern: patternId |
7103 | 1316 |
"Note: the pattern is destroyed when the font is closed" |
1317 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1318 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1319 |
|
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1320 |
%{ /* UNLIMITEDSTACK */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1321 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1322 |
XftFont* f; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1323 |
if ( ! __isExternalAddressLike(displayId) ) { |
7114 | 1324 |
error = @symbol(BadArg1); |
1325 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1326 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1327 |
if ( ! __isExternalAddressLike(patternId) ) { |
7103 | 1328 |
error = @symbol(BadArg2); |
1329 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1330 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1331 |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1332 |
f = XftFontOpenPattern( DISPLAY(displayId) , FC_PATTERN( patternId ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1333 |
if (f == NULL) { |
7103 | 1334 |
RETURN ( nil ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1335 |
} else { |
7103 | 1336 |
RETURN ( XFT_FONT_HANDLE_NEW ( f ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1337 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1338 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1339 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1340 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1341 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1342 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1343 |
"Created: / 20-12-2013 / 23:53:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1344 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1345 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1346 |
xftTextExtents: displayIdArg font: fontIdArg string: text from: start to: stop |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1347 |
| error extents bitsPerCharacter | |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1348 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1349 |
extents := Array new: 6. |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1350 |
bitsPerCharacter := text bitsPerCharacter. |
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1351 |
%{ /* UNLIMITEDSTACK */ |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1352 |
#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
|
1353 |
XGlyphInfo info; |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1354 |
int bytesPerCharacter; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1355 |
char *string; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1356 |
int len; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1357 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1358 |
bytesPerCharacter = __intVal(bitsPerCharacter) / 8; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1359 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1360 |
if ( ! __isExternalAddressLike(displayIdArg) ) { |
7221 | 1361 |
error = @symbol(BadArg1); |
1362 |
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
|
1363 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1364 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7221 | 1365 |
error = @symbol(BadArg2); |
1366 |
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
|
1367 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1368 |
if ( ! __isSmallInteger(start) ) { |
7221 | 1369 |
error = @symbol(BadArg4); |
1370 |
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
|
1371 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1372 |
if ( ! __isSmallInteger(stop) ) { |
7221 | 1373 |
error = @symbol(BadArg5); |
1374 |
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
|
1375 |
} |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1376 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1377 |
string = __stringVal( text ) + (( __intVal(start) - 1 ) * bytesPerCharacter); |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1378 |
len = __intVal(stop) - __intVal(start) + 1; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1379 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1380 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1381 |
switch (bytesPerCharacter) { |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1382 |
case 1: |
7221 | 1383 |
XftTextExtents8(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar8*)string, len, &info); |
1384 |
break; |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1385 |
case 2: |
7221 | 1386 |
XftTextExtents16(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar16*)string, len, &info); |
1387 |
break; |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1388 |
case 4: |
7221 | 1389 |
XftTextExtents32(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar32*)string, len, &info); |
1390 |
break; |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1391 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1392 |
__ArrayInstPtr(extents)->a_element[0] = __MKSMALLINT(info.width); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1393 |
__ArrayInstPtr(extents)->a_element[1] = __MKSMALLINT(info.height); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1394 |
__ArrayInstPtr(extents)->a_element[2] = __MKSMALLINT(info.x); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1395 |
__ArrayInstPtr(extents)->a_element[3] = __MKSMALLINT(info.y); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1396 |
__ArrayInstPtr(extents)->a_element[4] = __MKSMALLINT(info.xOff); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1397 |
__ArrayInstPtr(extents)->a_element[5] = __MKSMALLINT(info.yOff); |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1398 |
error = nil; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1399 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1400 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1401 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1402 |
error notNil ifTrue:[ |
7221 | 1403 |
self primitiveFailed: error. |
1404 |
^ 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
|
1405 |
]. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1406 |
^ extents |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1407 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1408 |
"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
|
1409 |
"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
|
1410 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1411 |
|
6198 | 1412 |
!XftFontDescription methodsFor:'printing & storing'! |
1413 |
||
1414 |
storeOn:aStream |
|
1415 |
"append a character sequence to the argument, aStream from which the |
|
1416 |
receiver can be reconstructed using readFrom:." |
|
1417 |
||
1418 |
aStream nextPutAll:'(XftFontDescription family:'. family storeOn:aStream. |
|
1419 |
aStream nextPutAll:' face:'. face storeOn:aStream. |
|
1420 |
aStream nextPutAll:' style:'. style storeOn:aStream. |
|
1421 |
aStream nextPutAll:' size:'. size storeOn:aStream. |
|
1422 |
aStream nextPutAll:' encoding:'. encoding storeOn:aStream. |
|
1423 |
aStream nextPut:$) |
|
1424 |
||
1425 |
" |
|
1426 |
(XftFontDescription family: 'DejaVu Sans' size: 8) storeString |
|
1427 |
" |
|
1428 |
! ! |
|
1429 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1430 |
!XftFontDescription methodsFor:'queries-dimensions'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1431 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1432 |
ascent |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1433 |
"return the ascent - the number of pixels above the baseLine." |
6656 | 1434 |
ascent isNil ifTrue:[ |
6707 | 1435 |
ascent := self xftFontGetAscent: fontId |
6656 | 1436 |
]. |
1437 |
^ ascent |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1438 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1439 |
"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
|
1440 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1441 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1442 |
descent |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1443 |
"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
|
1444 |
|
6656 | 1445 |
descent isNil ifTrue:[ |
6707 | 1446 |
descent := self xftFontGetDescent: fontId |
6656 | 1447 |
]. |
1448 |
^ descent |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1449 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1450 |
"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
|
1451 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1452 |
|
6314 | 1453 |
getFontMetrics |
1454 |
|info| |
|
1455 |
||
1456 |
info := DeviceWorkstation::DeviceFontMetrics new. |
|
1457 |
info |
|
1458 |
ascent:self ascent |
|
1459 |
descent:self descent |
|
1460 |
maxAscent:self maxAscent |
|
1461 |
maxDescent:self maxDescent |
|
1462 |
minWidth:self maxWidth |
|
1463 |
maxWidth:self maxWidth |
|
1464 |
avgWidth:self maxWidth |
|
1465 |
minCode:self minCode |
|
1466 |
maxCode:self maxCode |
|
1467 |
direction:#LeftToRight. |
|
1468 |
^ info |
|
1469 |
! |
|
1470 |
||
6543 | 1471 |
getFontResolution |
1472 |
device isNil ifTrue:[ ^ 72 @ 72 ]. |
|
1473 |
^ device resolution |
|
1474 |
! |
|
1475 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1476 |
height |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1477 |
"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
|
1478 |
|
6656 | 1479 |
height isNil ifTrue:[ |
6707 | 1480 |
height := self xftFontGetHeight: fontId |
6656 | 1481 |
]. |
1482 |
^ height |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1483 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1484 |
"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
|
1485 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1486 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1487 |
isFixedWidth |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1488 |
"return true, if this is a fixed pitch font (i.e. all characters |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1489 |
are of the same width)" |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1490 |
|
7342 | 1491 |
fixedWidth isNil ifTrue:[ |
1492 |
(device notNil and:[fontId notNil]) ifTrue:[ |
|
1493 |
|w| |
|
1494 |
||
1495 |
"/ take some obvously different chars |
|
1496 |
w := self widthOf:'.'. |
|
1497 |
((self widthOf:'i') == w |
|
1498 |
and:[ (self widthOf:'W') == w |
|
1499 |
and:[ (self widthOf:' ') == w ]] |
|
1500 |
) ifTrue:[ |
|
1501 |
fixedWidth := w. |
|
1502 |
] ifFalse:[ |
|
1503 |
fixedWidth := false |
|
1504 |
] |
|
1505 |
] |
|
1506 |
]. |
|
1507 |
^ fixedWidth notNil and:[fixedWidth isInteger] |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1508 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1509 |
"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
|
1510 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1511 |
|
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
|
1512 |
maxAscent |
7342 | 1513 |
"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
|
1514 |
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
|
1515 |
|
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
|
1516 |
^ 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
|
1517 |
|
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
|
1518 |
"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
|
1519 |
! |
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
|
1520 |
|
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
|
1521 |
maxDescent |
7342 | 1522 |
"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
|
1523 |
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
|
1524 |
|
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
|
1525 |
^ 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
|
1526 |
|
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
|
1527 |
"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
|
1528 |
! |
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
|
1529 |
|
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
|
1530 |
maxWidth |
7342 | 1531 |
"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
|
1532 |
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
|
1533 |
|
7342 | 1534 |
(fixedWidth class == SmallInteger) ifTrue:[ |
1535 |
^ fixedWidth |
|
1536 |
]. |
|
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
|
1537 |
^ self xftFontGetMaxAdvanceWidth: fontId |
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
|
1538 |
|
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
|
1539 |
"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
|
1540 |
! |
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
|
1541 |
|
7342 | 1542 |
width |
1543 |
"return the font's characters width; |
|
1544 |
That is a number of units (usually pixels). |
|
1545 |
For variable pitch fonts, the width of the space character is returned. |
|
1546 |
For fixed fonts, this is the same as minWidth or maxWidth (or any character). |
|
1547 |
The receiver must be associated to a device, for this query to be legal." |
|
1548 |
||
1549 |
fixedWidth class == SmallInteger ifTrue:[ |
|
1550 |
^ fixedWidth |
|
1551 |
]. |
|
1552 |
^ self widthOf:' ' |
|
1553 |
||
1554 |
"Modified: 30.4.1996 / 16:43:45 / cg" |
|
1555 |
! |
|
1556 |
||
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1557 |
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
|
1558 |
"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
|
1559 |
|
6472 | 1560 |
|extents maxWidthOfSingleGlyph| |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1561 |
|
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1562 |
(stop < start) ifTrue:[^ 0]. |
6472 | 1563 |
maxWidthOfSingleGlyph := self maxWidth. |
1564 |
"xOff from XFTTextExtents is a signed short. |
|
1565 |
Work arond for long strings" |
|
1566 |
(stop - start + 1) * maxWidthOfSingleGlyph > 32767 ifTrue:[ |
|
6819
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1567 |
|total chunkSize| |
6472 | 1568 |
|
6819
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1569 |
chunkSize := (32767 // maxWidthOfSingleGlyph) - 1. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1570 |
total := 0. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1571 |
start to:stop by:chunkSize do:[:eachChunkStart| |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1572 |
extents := self xftTextExtents:device displayId font:fontId string:aString |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1573 |
from:eachChunkStart to:((eachChunkStart+chunkSize-1) min:stop). |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1574 |
"/ extents --> #(width height x y xOff yOff) |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1575 |
total := total + extents fifth. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1576 |
]. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1577 |
^ total. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1578 |
]. |
6472 | 1579 |
extents := self xftTextExtents: device displayId font:fontId string:aString from:start to:stop. |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1580 |
"/ extents --> #(width height x y xOff yOff) |
7342 | 1581 |
"/ cg: shouln't this be first ?!! |
6183
a21827076de1
Fix for bad layout and segfault when selecting whole line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6182
diff
changeset
|
1582 |
^ extents fifth. |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1583 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1584 |
"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
|
1585 |
"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
|
1586 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1587 |
|
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1588 |
!XftFontDescription methodsFor:'release'! |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1589 |
|
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1590 |
releaseDrawIfAssociatedWith: view |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1591 |
| drawableId | |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1592 |
|
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1593 |
view isNil ifTrue:[ ^ self ]. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1594 |
drawableId := view id. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1595 |
drawableId isNil ifTrue: [ ^ self ]. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1596 |
%{ |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1597 |
#ifdef XFT |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1598 |
if ( __INST(sharedDrawId) != nil ) { |
6393 | 1599 |
if (XftDrawDrawable(XFT_DRAW(__INST(sharedDrawId))) == DRAWABLE(drawableId)) { |
1600 |
__INST(sharedDrawId) = nil; |
|
1601 |
XftDrawDestroy(DRAWABLE(drawableId)); |
|
1602 |
} |
|
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1603 |
} |
6339 | 1604 |
RETURN (self); |
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1605 |
#endif |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1606 |
%}. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1607 |
self primitiveFailed |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1608 |
|
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1609 |
"Created: / 12-01-2014 / 19:48:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1610 |
"Modified: / 12-01-2014 / 22:09:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6344 | 1611 |
! |
1612 |
||
1613 |
releaseFromDevice |
|
1614 |
"I am no longer available on the device" |
|
1615 |
||
6946 | 1616 |
Lobby unregister:self. |
7055 | 1617 |
"/ cg: no, xftDrawDestroy should not be done. |
1618 |
"/ (releaseFromDevice is called when either the display connection |
|
1619 |
"/ is lost, or a snapshot image is restarted) |
|
1620 |
"/ self xftDrawDestroy. |
|
6946 | 1621 |
|
7298
6cc9d56cb05d
Issue #76: XFT: Flush `RecentlyUsedFonts` cache when restarting from snapahot
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7223
diff
changeset
|
1622 |
RecentlyUsedFonts := nil. |
6344 | 1623 |
device := nil. |
1624 |
fontId := nil. |
|
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1625 |
sharedDrawId := nil. |
6946 | 1626 |
closestFont := nil. |
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1627 |
! ! |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1628 |
|
6319 | 1629 |
!XftFontDescription methodsFor:'testing'! |
1630 |
||
6936 | 1631 |
isScaledFont |
1632 |
"Xft fonts are always scaled" |
|
1633 |
||
1634 |
^ true |
|
1635 |
! |
|
1636 |
||
6339 | 1637 |
isUsed |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1638 |
^ sharedDrawId notNil |
6339 | 1639 |
! |
1640 |
||
6319 | 1641 |
isXftFont |
1642 |
^ true |
|
1643 |
! ! |
|
1644 |
||
6264 | 1645 |
!XftFontDescription::FCFontListParser class methodsFor:'documentation'! |
1646 |
||
1647 |
documentation |
|
1648 |
" |
|
1649 |
parses fc-list output to get a list of XftFontDescriptions |
|
1650 |
||
1651 |
[author:] |
|
6319 | 1652 |
cg |
6264 | 1653 |
|
1654 |
[instance variables:] |
|
1655 |
||
1656 |
[class variables:] |
|
1657 |
||
1658 |
[see also:] |
|
1659 |
||
1660 |
" |
|
1661 |
! ! |
|
1662 |
||
6263 | 1663 |
!XftFontDescription::FCFontListParser methodsFor:'api'! |
1664 |
||
1665 |
listOfAvailableFonts |
|
6337 | 1666 |
|readEntry list l fcListProg| |
6263 | 1667 |
|
1668 |
list := OrderedCollection new. |
|
1669 |
||
6319 | 1670 |
readEntry := |
6656 | 1671 |
[ |
1672 |
|key| |
|
6263 | 1673 |
|
6656 | 1674 |
[l startsWith:'Pattern has'] whileFalse:[ |
1675 |
l := pipeStream nextLine. Transcript showCR:l. |
|
1676 |
]. |
|
6263 | 1677 |
|
7221 | 1678 |
currentDescription := XftFontDescription new. |
6656 | 1679 |
[ l := pipeStream nextLine. l notEmptyOrNil ] whileTrue:[ |
7221 | 1680 |
"/ Transcript showCR:l. |
6656 | 1681 |
lineStream := l readStream. lineStream skipSeparators. |
1682 |
key := lineStream upToSeparator. |
|
7221 | 1683 |
( |
6656 | 1684 |
#('family:' 'style:' 'slant:' 'weight:' 'width:' |
1685 |
'pixelsize:' 'spacing:' 'foundry:' 'antialias:' |
|
1686 |
'file:' 'outline' 'scalable:' 'charset:' 'lang:' |
|
1687 |
'fontversion:' 'fontformat:' 'decorative:' 'index:' |
|
1688 |
'outline:' 'familylang:' 'stylelang:' 'fullname:' |
|
1689 |
'fullnamelang:' 'capability:' 'hash:' 'postscriptname:' |
|
1690 |
) includes:key |
|
7221 | 1691 |
) ifTrue:[ |
6656 | 1692 |
self perform:('fc_',(key allButLast)) asSymbol |
7221 | 1693 |
] ifFalse:[ |
6656 | 1694 |
Transcript show:'Xft ignored line: '; showCR:l. |
1695 |
self breakPoint:#cg. |
|
7221 | 1696 |
]. |
1697 |
]. |
|
1698 |
list add:currentDescription |
|
1699 |
]. |
|
6319 | 1700 |
|
6337 | 1701 |
fcListProg := #('/usr/bin/fc-list' '/usr/X11/bin/fc-list') detect:[:eachProg| |
7221 | 1702 |
eachProg asFilename isExecutableProgram |
1703 |
] ifNone:[ |
|
1704 |
'XftFontDescription [warning]: fc-list program not found - no XFT fonts' errorPrintCR. |
|
1705 |
^ list. |
|
1706 |
]. |
|
6337 | 1707 |
|
1708 |
pipeStream := PipeStream readingFrom:fcListProg, ' -v'. |
|
6263 | 1709 |
[ |
7221 | 1710 |
[pipeStream atEnd] whileFalse:[ |
6656 | 1711 |
l := pipeStream nextLine. |
7221 | 1712 |
readEntry value. |
1713 |
] |
|
6263 | 1714 |
] ensure:[ |
7221 | 1715 |
pipeStream close |
6263 | 1716 |
]. |
1717 |
^ list |
|
1718 |
||
1719 |
" |
|
6337 | 1720 |
FCFontListParser new listOfAvailableFonts |
6263 | 1721 |
" |
1722 |
! ! |
|
1723 |
||
1724 |
!XftFontDescription::FCFontListParser methodsFor:'font list keywords'! |
|
1725 |
||
1726 |
fc_antialias |
|
1727 |
"helper for font listing" |
|
1728 |
||
6319 | 1729 |
currentDescription isAntialiasedFont:(self getBoolean). |
6263 | 1730 |
! |
1731 |
||
6264 | 1732 |
fc_capability |
1733 |
"helper for font listing" |
|
1734 |
||
6319 | 1735 |
"currentDescription capability:" (self getString). |
6264 | 1736 |
! |
1737 |
||
6263 | 1738 |
fc_charset |
1739 |
"helper for font listing" |
|
1740 |
||
6319 | 1741 |
|page bits l min max minCode maxCode| |
6263 | 1742 |
|
1743 |
[ l := pipeStream nextLine. l notEmpty ] whileTrue:[ |
|
7221 | 1744 |
"/ Transcript show:'->'; showCR:l. |
1745 |
(l startsWith:Character tab) ifFalse:[ |
|
1746 |
(l startsWith:'(') ifFalse:[self halt]. |
|
6393 | 1747 |
currentDescription minCode:minCode. |
1748 |
currentDescription maxCode:maxCode. |
|
7221 | 1749 |
^ self. |
1750 |
]. |
|
6264 | 1751 |
|
7221 | 1752 |
lineStream := l readStream. |
1753 |
lineStream skipSeparators. |
|
1754 |
page := Integer readFrom:(lineStream upTo:$:) radix:16. |
|
1755 |
lineStream next. |
|
1756 |
bits := 0 to:7 collect:[:i| |
|
1757 |
lineStream skipSeparators. |
|
1758 |
Integer readFrom:(lineStream upToSeparator) radix:16. |
|
1759 |
]. |
|
1760 |
min := (page * 256 + 0). |
|
1761 |
max := (page * 256 + 255). |
|
1762 |
minCode isNil ifTrue:[ |
|
1763 |
minCode := min. |
|
1764 |
maxCode := max. |
|
1765 |
] ifFalse:[ |
|
1766 |
minCode := minCode min:min. |
|
1767 |
maxCode := maxCode max:max. |
|
1768 |
]. |
|
6263 | 1769 |
]. |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1770 |
"/ currentDescription characterSet:(self getString). |
6319 | 1771 |
currentDescription minCode:minCode. |
1772 |
currentDescription maxCode:maxCode. |
|
6263 | 1773 |
! |
1774 |
||
6319 | 1775 |
fc_decorative |
6263 | 1776 |
"helper for font listing" |
1777 |
||
6319 | 1778 |
currentDescription isDecorativeFont:(self getBoolean). |
6263 | 1779 |
! |
1780 |
||
1781 |
fc_family |
|
1782 |
"helper for font listing" |
|
1783 |
||
6319 | 1784 |
currentDescription family:(self getString). |
6263 | 1785 |
! |
1786 |
||
1787 |
fc_familylang |
|
1788 |
"helper for font listing" |
|
1789 |
||
6319 | 1790 |
"currentDescription familylang:" (self getString). |
6263 | 1791 |
! |
1792 |
||
6319 | 1793 |
fc_file |
6263 | 1794 |
"helper for font listing" |
1795 |
||
6319 | 1796 |
currentDescription file:(self getString). |
6263 | 1797 |
! |
1798 |
||
1799 |
fc_fontformat |
|
1800 |
"helper for font listing" |
|
1801 |
||
6319 | 1802 |
currentDescription fontFormat:(self getString). |
6263 | 1803 |
! |
1804 |
||
1805 |
fc_fontversion |
|
1806 |
"helper for font listing" |
|
1807 |
||
6319 | 1808 |
currentDescription fontVersion:(self getInteger). |
6263 | 1809 |
! |
1810 |
||
1811 |
fc_foundry |
|
1812 |
"helper for font listing" |
|
1813 |
||
6319 | 1814 |
currentDescription foundry:(self getString). |
6263 | 1815 |
! |
1816 |
||
6264 | 1817 |
fc_fullname |
1818 |
"helper for font listing" |
|
1819 |
||
6319 | 1820 |
"currentDescription fullname:" (self getString). |
6264 | 1821 |
! |
1822 |
||
1823 |
fc_fullnamelang |
|
1824 |
"helper for font listing" |
|
1825 |
||
6319 | 1826 |
"currentDescription fullnamelang:" (self getString). |
6264 | 1827 |
! |
1828 |
||
6338 | 1829 |
fc_hash |
1830 |
"helper for font listing" |
|
1831 |
||
1832 |
"currentDescription hash:" self getString. |
|
1833 |
! |
|
1834 |
||
6264 | 1835 |
fc_index |
1836 |
"helper for font listing" |
|
1837 |
||
6319 | 1838 |
"currentDescription index:" (self getInteger). |
6264 | 1839 |
! |
1840 |
||
6263 | 1841 |
fc_lang |
1842 |
"helper for font listing" |
|
1843 |
||
6319 | 1844 |
"/ currentDescription characterSet:(self getString). |
6263 | 1845 |
! |
1846 |
||
1847 |
fc_outline |
|
1848 |
"helper for font listing" |
|
1849 |
||
6319 | 1850 |
currentDescription isOutlineFont:(self getBoolean). |
6263 | 1851 |
! |
1852 |
||
1853 |
fc_pixelsize |
|
1854 |
"helper for font listing" |
|
1855 |
||
6325 | 1856 |
currentDescription setPixelSize:(self getInteger). |
1857 |
currentDescription setSizeUnit:#px. |
|
1858 |
"/ currentDescription setSize:(self getInteger). |
|
1859 |
"/ currentDescription setSizeUnit:#pt. |
|
6263 | 1860 |
! |
1861 |
||
6338 | 1862 |
fc_postscriptname |
1863 |
"helper for font listing" |
|
1864 |
||
1865 |
"currentDescription postscriptname:" self getString. |
|
1866 |
! |
|
1867 |
||
6263 | 1868 |
fc_scalable |
1869 |
"helper for font listing" |
|
1870 |
||
6319 | 1871 |
currentDescription isScalableFont:(self getBoolean). |
6263 | 1872 |
! |
1873 |
||
1874 |
fc_slant |
|
1875 |
"helper for font listing" |
|
1876 |
||
6319 | 1877 |
currentDescription slant:(self getInteger). |
6263 | 1878 |
! |
1879 |
||
1880 |
fc_spacing |
|
1881 |
"helper for font listing" |
|
1882 |
||
6319 | 1883 |
currentDescription spacing:(self getInteger). |
6263 | 1884 |
! |
1885 |
||
1886 |
fc_style |
|
1887 |
"helper for font listing" |
|
1888 |
||
6319 | 1889 |
|xftStyle| |
1890 |
||
1891 |
xftStyle := self getString. |
|
6391 | 1892 |
"/ ((xftStyle includesString:'Bold') or:[xftStyle includesString:'Fett']) ifTrue:[ |
1893 |
"/ currentDescription face:'bold'. |
|
1894 |
"/ currentDescription style:'roman'. |
|
1895 |
"/ ^ self. |
|
1896 |
"/ ]. |
|
1897 |
((xftStyle includesString:'Italic') or:[xftStyle includesString:'Oblique']) ifTrue:[ |
|
1898 |
"/ currentDescription face:'medium'. |
|
6393 | 1899 |
currentDescription style:'italic'. |
7221 | 1900 |
^ self. |
6319 | 1901 |
]. |
6391 | 1902 |
"/ (xftStyle includesString:'Regular') ifTrue:[ |
1903 |
"/ currentDescription face:'regular'. |
|
1904 |
"/ currentDescription style:'roman'. |
|
1905 |
"/ ^ self. |
|
1906 |
"/ ]. |
|
6319 | 1907 |
"/ self halt. |
6391 | 1908 |
"/ currentDescription face:'medium'. |
6319 | 1909 |
currentDescription style:'roman'. |
6263 | 1910 |
! |
1911 |
||
6264 | 1912 |
fc_stylelang |
1913 |
"helper for font listing" |
|
1914 |
||
6319 | 1915 |
"currentDescription stylelang:" (self getString). |
6264 | 1916 |
! |
1917 |
||
6263 | 1918 |
fc_weight |
1919 |
"helper for font listing" |
|
1920 |
||
6319 | 1921 |
currentDescription weight:(self getInteger). |
6263 | 1922 |
! |
1923 |
||
1924 |
fc_width |
|
1925 |
"helper for font listing" |
|
1926 |
||
6319 | 1927 |
currentDescription width:(self getInteger). |
6263 | 1928 |
! ! |
1929 |
||
1930 |
!XftFontDescription::FCFontListParser methodsFor:'helpers'! |
|
1931 |
||
6319 | 1932 |
getBoolean |
6263 | 1933 |
"helper for font listing" |
1934 |
||
1935 |
|s| |
|
1936 |
||
1937 |
lineStream skipSeparators. |
|
6319 | 1938 |
s := lineStream nextAlphaNumericWord. |
1939 |
^ s = 'FcTrue'. |
|
6263 | 1940 |
! |
1941 |
||
6264 | 1942 |
getInteger |
1943 |
"helper for font listing" |
|
1944 |
||
1945 |
lineStream skipSeparators. |
|
6319 | 1946 |
^ Integer readFrom:lineStream. |
6264 | 1947 |
! |
1948 |
||
6319 | 1949 |
getString |
6263 | 1950 |
"helper for font listing" |
1951 |
||
1952 |
lineStream skipSeparators. |
|
6319 | 1953 |
lineStream peekFor:$". |
1954 |
^ (lineStream upTo:$"). |
|
7114 | 1955 |
! ! |
1956 |
||
6176 | 1957 |
!XftFontDescription class methodsFor:'documentation'! |
1958 |
||
1959 |
version |
|
6936 | 1960 |
^ '$Header$' |
6176 | 1961 |
! |
1962 |
||
1963 |
version_CVS |
|
6936 | 1964 |
^ '$Header$' |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1965 |
! |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1966 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1967 |
version_HG |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1968 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1969 |
^ '$Changeset: <not expanded> $' |
6176 | 1970 |
! ! |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1971 |
|
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
|
1972 |
|
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
|
1973 |
XftFontDescription initialize! |