author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 29 Feb 2016 07:18:01 +0000 | |
branch | jv |
changeset 7171 | 71c34a23762b |
parent 7169 | ae5df93e3b78 |
child 7223 | bce4cd6c45cd |
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 |
7 |
descent height' |
|
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 |
6319 | 355 |
! |
356 |
||
6391 | 357 |
weight:aNumber |
358 |
"set the weight" |
|
359 |
||
360 |
self assert:(self fontId isNil). "/ cannot change an instantiated font |
|
361 |
||
362 |
aNumber == FC_WEIGHT_THIN ifTrue:[ face := 'thin'. ^ self]. |
|
363 |
aNumber == FC_WEIGHT_EXTRALIGHT ifTrue:[ face := 'extralight'. ^ self]. |
|
364 |
aNumber == FC_WEIGHT_LIGHT ifTrue:[ face := 'light'. ^ self]. |
|
365 |
aNumber == FC_WEIGHT_BOOK ifTrue:[ face := 'book'. ^ self]. |
|
366 |
aNumber == FC_WEIGHT_REGULAR ifTrue:[ face := 'regular'. ^ self]. |
|
367 |
aNumber == FC_WEIGHT_MEDIUM ifTrue:[ face := 'medium'. ^ self]. |
|
368 |
aNumber == FC_WEIGHT_DEMIBOLD ifTrue:[ face := 'demibold'. ^ self]. |
|
369 |
aNumber == FC_WEIGHT_BOLD ifTrue:[ face := 'bold'. ^ self]. |
|
370 |
aNumber == FC_WEIGHT_EXTRABOLD ifTrue:[ face := 'extrabold'. ^ self]. |
|
371 |
aNumber == FC_WEIGHT_BLACK ifTrue:[ face := 'black'. ^ self]. |
|
372 |
aNumber == FC_WEIGHT_EXTRABLACK ifTrue:[ face := 'extrablack'. ^ self]. |
|
373 |
||
374 |
aNumber <= (FC_WEIGHT_EXTRALIGHT + FC_WEIGHT_LIGHT // 2) ifTrue:[ |
|
6393 | 375 |
face := 'extralight'. |
376 |
^ self. |
|
6391 | 377 |
]. |
378 |
aNumber <= (FC_WEIGHT_LIGHT + FC_WEIGHT_BOOK // 2) ifTrue:[ |
|
6393 | 379 |
face := 'light'. |
380 |
^ self. |
|
6391 | 381 |
]. |
382 |
aNumber <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD // 2) ifTrue:[ |
|
6393 | 383 |
face := 'medium'. |
384 |
^ self. |
|
6391 | 385 |
]. |
386 |
aNumber <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD // 2) ifTrue:[ |
|
6393 | 387 |
face := 'demibold'. |
388 |
^ self. |
|
6391 | 389 |
]. |
390 |
aNumber <= (FC_WEIGHT_BOLD + FC_WEIGHT_BLACK // 2) ifTrue:[ |
|
6393 | 391 |
face := 'bold'. |
392 |
^ self. |
|
6391 | 393 |
]. |
394 |
face := 'extrabold'. |
|
395 |
^ self |
|
396 |
||
397 |
"/ FC_WEIGHT_THIN := 0. |
|
398 |
"/ FC_WEIGHT_EXTRALIGHT := 40. |
|
399 |
"/ FC_WEIGHT_ULTRALIGHT := FC_WEIGHT_EXTRALIGHT. |
|
400 |
"/ FC_WEIGHT_LIGHT := 50. |
|
401 |
"/ FC_WEIGHT_BOOK := 75. |
|
402 |
"/ FC_WEIGHT_REGULAR := 80. |
|
403 |
"/ FC_WEIGHT_NORMAL := FC_WEIGHT_REGULAR. |
|
404 |
"/ FC_WEIGHT_MEDIUM := 100. |
|
405 |
"/ FC_WEIGHT_DEMIBOLD := 180. |
|
406 |
"/ FC_WEIGHT_SEMIBOLD := FC_WEIGHT_DEMIBOLD. |
|
407 |
"/ FC_WEIGHT_BOLD := 200. |
|
408 |
"/ FC_WEIGHT_EXTRABOLD := 205. |
|
409 |
"/ FC_WEIGHT_ULTRABOLD := FC_WEIGHT_EXTRABOLD. |
|
410 |
"/ FC_WEIGHT_BLACK := 210. |
|
411 |
"/ FC_WEIGHT_HEAVY := FC_WEIGHT_BLACK. |
|
412 |
"/ FC_WEIGHT_EXTRABLACK := 215. |
|
413 |
"/ FC_WEIGHT_ULTRABLACK := FC_WEIGHT_EXTRABLACK. |
|
6317 | 414 |
! ! |
415 |
||
416 |
!XftFontDescription methodsFor:'accessing-private'! |
|
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
417 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
418 |
getFontId |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
419 |
^ fontId |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
420 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
421 |
"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
|
422 |
! ! |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
423 |
|
6936 | 424 |
!XftFontDescription methodsFor:'change & update'! |
425 |
||
426 |
update:anAspect with:something from:changedObject |
|
427 |
"I want to be informed when a view that printed something with me is destroyed. |
|
428 |
Disassociate the view from the XFT drawable" |
|
429 |
||
430 |
|drawableId| |
|
431 |
||
432 |
anAspect == #aboutToDestroy ifTrue:[ |
|
433 |
drawableId := changedObject drawableId. |
|
434 |
drawableId notNil ifTrue:[ |
|
435 |
self disassociateXftDrawableFrom:drawableId. |
|
436 |
]. |
|
437 |
changedObject removeDependent:self. |
|
438 |
]. |
|
439 |
! ! |
|
440 |
||
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
441 |
!XftFontDescription methodsFor:'converting'! |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
442 |
|
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
443 |
asNonXftFont |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
444 |
|newFont| |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
445 |
|
6656 | 446 |
newFont := FontDescription |
447 |
family:family |
|
448 |
face:face |
|
449 |
style:style |
|
450 |
size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) |
|
451 |
sizeUnit:sizeUnit |
|
452 |
encoding:encoding. |
|
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
453 |
|
6656 | 454 |
^ newFont |
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
455 |
! ! |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
456 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
457 |
!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
|
458 |
|
6351 | 459 |
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
|
460 |
"display a partial string at some position in aGC." |
7035 | 461 |
|
6707 | 462 |
|index2 bytesPerCharacter transformation |
7061 | 463 |
clipOrg clipCorn clipRect clipX clipY clipW clipH clipPnt |
6707 | 464 |
fg fgR fgG fgB fgA fgPixel bg bgR bgG bgB bgA bgPixel |
7035 | 465 |
drawX drawY drawPnt displayId screen drawableId error stringLen drawId drawIdIsShared |
7075 | 466 |
newXftDrawId newDrawableAssociation pixmapDepth| |
7035 | 467 |
|
6351 | 468 |
"limit the string len, otherwise bad output is generated" |
6477 | 469 |
stringLen := index2Arg - index1 + 1. |
6351 | 470 |
stringLen > 8000 ifTrue:[ |
7115 | 471 |
index2 := index1 + 8000 - 1. |
6351 | 472 |
] ifFalse:[ |
7115 | 473 |
stringLen <= 0 ifTrue:[^ self]. |
474 |
index2 := index2Arg. |
|
6351 | 475 |
]. |
6209 | 476 |
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
|
477 |
|
7061 | 478 |
clipRect := aGC deviceClippingRectangle. |
7050 | 479 |
clipRect notNil ifTrue:[ |
7115 | 480 |
clipX := clipRect left. |
481 |
clipY := clipRect top. |
|
482 |
clipW := clipRect width. |
|
483 |
clipH := clipRect height. |
|
6489 | 484 |
]. |
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
|
485 |
|
7061 | 486 |
transformation := aGC transformation. |
6356 | 487 |
transformation isNil ifTrue:[ |
7115 | 488 |
drawX := xArg. |
489 |
drawY := yArg. |
|
6356 | 490 |
] ifFalse:[ |
7115 | 491 |
drawPnt := transformation transformPoint:(xArg @ yArg). |
492 |
drawX := drawPnt x ceiling. |
|
493 |
drawY := drawPnt y ceiling. |
|
6356 | 494 |
]. |
495 |
||
7068 | 496 |
fg := aGC paint. |
497 |
fgR := fg scaledRed. |
|
498 |
fgG := fg scaledGreen. |
|
499 |
fgB := fg scaledBlue. |
|
500 |
fgA := fg scaledAlpha. |
|
501 |
||
6263 | 502 |
fgR isNil ifTrue:[ |
7115 | 503 |
"/ when drawing into a pixmap... |
504 |
fgPixel := fg colorId. |
|
505 |
fgPixel == 0 ifTrue:[ |
|
506 |
fgR := fgG := fgB := 0. |
|
507 |
] ifFalse:[ |
|
508 |
fgR := fgG := fgB := 16rFFFF. |
|
509 |
] |
|
6263 | 510 |
]. |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
511 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
512 |
opaque ifTrue:[ |
7115 | 513 |
bg := aGC backgroundPaint. |
514 |
bg isColor ifTrue:[ |
|
515 |
bgR := bg scaledRed. |
|
516 |
bgG := bg scaledGreen. |
|
517 |
bgB := bg scaledBlue. |
|
518 |
bgA := bg scaledAlpha. |
|
519 |
] ifFalse:[ |
|
520 |
"images are not yet implemented" |
|
521 |
"/ #todo: fill background rectangle |
|
522 |
bgR := bgG := bgB := bgA := 16rFFFF. |
|
523 |
]. |
|
524 |
bgR isNil ifTrue:[ |
|
525 |
"/ when drawing into a pixmap... |
|
526 |
bgPixel := bg colorId. |
|
527 |
bgPixel == 0 ifTrue:[ |
|
528 |
bgR := bgG := bgB := 0. |
|
529 |
] ifFalse:[ |
|
530 |
bgR := bgG := bgB := 16rFFFF. |
|
531 |
] |
|
532 |
]. |
|
6193 | 533 |
]. |
6333 | 534 |
displayId := device displayIdOrErrorIfBroken. |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
535 |
displayId isNil ifTrue:[ |
7115 | 536 |
^ self. |
6333 | 537 |
]. |
6193 | 538 |
screen := device screen. |
6351 | 539 |
drawableId := aGC drawableId. |
7075 | 540 |
aGC isForm ifTrue:[ |
7115 | 541 |
pixmapDepth := aGC depth. |
7075 | 542 |
]. |
6936 | 543 |
aGC addDependent:self. "I need to be informed, when the GC is destroyed" |
6209 | 544 |
|
6726
9f16fe1701f5
XGraphicsContext made public to allow subclassing and extending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6725
diff
changeset
|
545 |
aGC class == XGraphicsContext ifTrue:[ |
7032 | 546 |
"/ TODO: Following should be done atomically together with drawing... |
547 |
drawId := aGC xftDrawId. |
|
548 |
drawIdIsShared := false. |
|
549 |
drawId isNil ifTrue:[ |
|
6193 | 550 |
%{ |
7077 | 551 |
if (pixmapDepth != nil) { |
552 |
int __pixmapDepth = __intVal(pixmapDepth); |
|
553 |
if (__pixmapDepth == 1) { |
|
554 |
drawId = XFT_DRAW_HANDLE_NEW ( XftDrawCreateBitmap ( DISPLAY( displayId ) , |
|
555 |
DRAWABLE( drawableId ) ) ); |
|
556 |
} else { |
|
557 |
drawId = XFT_DRAW_HANDLE_NEW ( XftDrawCreateAlpha ( DISPLAY( displayId ) , |
|
558 |
DRAWABLE( drawableId ), __pixmapDepth) ); |
|
559 |
} |
|
7072 | 560 |
} else { |
561 |
drawId = XFT_DRAW_HANDLE_NEW ( XftDrawCreate ( DISPLAY( displayId ) , |
|
562 |
DRAWABLE( drawableId ) , |
|
563 |
DefaultVisual( DISPLAY( displayId), SCREEN (screen) ) , |
|
564 |
DefaultColormap( DISPLAY( displayId), SCREEN (screen) ) ) ); |
|
565 |
} |
|
6530
b4c269c96b08
Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6529
diff
changeset
|
566 |
%}. |
7032 | 567 |
aGC xftDrawId: drawId. |
568 |
]. |
|
6819
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
569 |
] ifFalse:[ |
7032 | 570 |
Logger log: 'GC passed to XftGraphicsContext is not an XGraphicsContext!!' severity: #error. |
571 |
drawId := sharedDrawId. |
|
572 |
drawIdIsShared := true. |
|
6530
b4c269c96b08
Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6529
diff
changeset
|
573 |
]. |
b4c269c96b08
Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6529
diff
changeset
|
574 |
|
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
575 |
%{ /* UNLIMITEDSTACK */ |
6193 | 576 |
#ifdef XFT |
577 |
XftColor color; |
|
578 |
XGlyphInfo extents; |
|
579 |
XRectangle clipRX; |
|
6936 | 580 |
char *string; |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
581 |
int len; |
6209 | 582 |
int __bytesPerCharacter; |
6936 | 583 |
XftDraw *__sharedDrawId; |
584 |
XftFont *__xftFont = XFT_FONT(__INST(fontId)); |
|
6193 | 585 |
|
6209 | 586 |
if (!(__bothSmallInteger(drawX, drawY) |
7115 | 587 |
&& __bothSmallInteger(index1, index2) |
588 |
&& __isSmallInteger(bytesPerCharacter) |
|
589 |
&& (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA))) |
|
590 |
&& (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA))) |
|
591 |
&& __isNonNilObject(aString) |
|
6209 | 592 |
)) { |
6936 | 593 |
goto err; |
6209 | 594 |
} |
595 |
||
596 |
__bytesPerCharacter = __intVal(bytesPerCharacter); |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
597 |
|
6530
b4c269c96b08
Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6529
diff
changeset
|
598 |
if (drawIdIsShared == true) { |
6936 | 599 |
if (__INST(sharedDrawId) == nil) { |
7077 | 600 |
if (pixmapDepth != nil) { |
601 |
int __pixmapDepth = __intVal(pixmapDepth); |
|
602 |
if (__pixmapDepth == 1) { |
|
603 |
__sharedDrawId = XftDrawCreateBitmap ( DISPLAY( displayId ) , |
|
604 |
DRAWABLE( drawableId ) ); |
|
605 |
} else { |
|
606 |
__sharedDrawId = XftDrawCreateAlpha ( DISPLAY( displayId ) , |
|
607 |
DRAWABLE( drawableId ), __pixmapDepth); |
|
608 |
} |
|
7115 | 609 |
} else { |
610 |
__sharedDrawId = XftDrawCreate(DISPLAY(displayId), |
|
611 |
DRAWABLE(drawableId), |
|
612 |
DefaultVisual(DISPLAY(displayId), SCREEN(screen)), |
|
613 |
DefaultColormap(DISPLAY(displayId), SCREEN(screen))); |
|
614 |
} |
|
6936 | 615 |
__INST(sharedDrawId) = XFT_DRAW_HANDLE_NEW(__sharedDrawId); |
616 |
__STORE(self, __INST(sharedDrawId)); |
|
617 |
} else if (XftDrawDrawable(__sharedDrawId = XFT_DRAW(__INST(sharedDrawId))) != DRAWABLE(drawableId)) { |
|
618 |
XftDrawChange(__sharedDrawId, DRAWABLE(drawableId)); |
|
7032 | 619 |
} |
620 |
} else { |
|
621 |
__sharedDrawId = XFT_DRAW ( drawId ); |
|
6193 | 622 |
} |
623 |
||
6936 | 624 |
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
|
625 |
len = __intVal(index2) - __intVal(index1) + 1; |
6193 | 626 |
|
7050 | 627 |
if (clipRect != nil) { |
7115 | 628 |
clipRX.x = __intVal(clipX); |
629 |
clipRX.y = __intVal(clipY); |
|
630 |
clipRX.width = __intVal(clipW); |
|
631 |
clipRX.height = __intVal(clipH); |
|
632 |
XftDrawSetClipRectangles(__sharedDrawId, 0, 0, &clipRX, 1); |
|
6193 | 633 |
} else { |
7115 | 634 |
XftDrawSetClip(__sharedDrawId, 0); |
6193 | 635 |
} |
636 |
||
6223 | 637 |
if (opaque == true) { |
7115 | 638 |
if (bgPixel != nil) { |
639 |
color.pixel = (unsigned long)__intVal(bgPixel); |
|
640 |
} |
|
641 |
color.color.red = __intVal(bgR); |
|
642 |
color.color.green = __intVal(bgG); |
|
643 |
color.color.blue = __intVal(bgB); |
|
644 |
color.color.alpha = __intVal(bgA); |
|
7068 | 645 |
|
7115 | 646 |
switch (__bytesPerCharacter) { |
647 |
case 1: |
|
648 |
XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents); |
|
649 |
break; |
|
650 |
case 2: |
|
651 |
XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents); |
|
652 |
break; |
|
653 |
case 4: |
|
654 |
XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents); |
|
655 |
break; |
|
656 |
} |
|
657 |
XftDrawRect(__sharedDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height); |
|
6193 | 658 |
} |
6223 | 659 |
if (fgPixel != nil) { |
7115 | 660 |
color.pixel = (unsigned long)__intVal(fgPixel); |
6223 | 661 |
} |
7068 | 662 |
color.color.red = __intVal(fgR); |
663 |
color.color.green = __intVal(fgG); |
|
664 |
color.color.blue = __intVal(fgB); |
|
665 |
color.color.alpha = __intVal(fgA); |
|
666 |
||
6209 | 667 |
switch (__bytesPerCharacter) { |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
668 |
case 1: |
7115 | 669 |
XftDrawString8(__sharedDrawId, &color,__xftFont, |
670 |
__intVal(drawX), |
|
671 |
__intVal(drawY), |
|
672 |
(FcChar8*)string, |
|
673 |
len); |
|
674 |
break; |
|
6936 | 675 |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
676 |
case 2: |
7115 | 677 |
XftDrawString16(__sharedDrawId, &color, __xftFont, |
678 |
__intVal(drawX), |
|
679 |
__intVal(drawY), |
|
680 |
(FcChar16*)string, |
|
681 |
len); |
|
682 |
break; |
|
6936 | 683 |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
684 |
case 4: |
7115 | 685 |
XftDrawString32(__sharedDrawId, &color, __xftFont, |
686 |
__intVal(drawX), |
|
687 |
__intVal(drawY), |
|
688 |
(FcChar32*)string, |
|
689 |
len); |
|
690 |
break; |
|
6936 | 691 |
|
692 |
default: |
|
693 |
goto err; |
|
6193 | 694 |
} |
6936 | 695 |
|
7075 | 696 |
if (pixmapDepth != nil) { |
7115 | 697 |
XftDrawDestroy(__sharedDrawId); |
7070 | 698 |
} |
699 |
||
6936 | 700 |
# if 0 // this has been superseeded by receiving change messages on view destroy |
701 |
// Have to disassociate the drawableId - otherwise we get an X11 error 'RenderBadPicture (invalid Picture parameter)' |
|
702 |
// when the drawable (the window) is destroyed. |
|
703 |
XftDrawChange(__sharedDrawId, None); |
|
704 |
# endif |
|
705 |
RETURN(self); |
|
706 |
||
6193 | 707 |
#endif |
708 |
err:; |
|
709 |
%}. |
|
710 |
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
|
711 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
712 |
"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
|
713 |
"Modified: / 23-06-2014 / 22:06:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6176 | 714 |
! ! |
715 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
716 |
!XftFontDescription methodsFor:'error reporting'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
717 |
|
6198 | 718 |
primitiveFailed |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
719 |
<resource: #skipInDebuggersWalkBack> |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
720 |
|
7154
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
721 |
ConfigurableFeatures hasXFT ifFalse:[ |
6936 | 722 |
super primitiveFailed:'Xft support is not configured'. |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
723 |
]. |
6198 | 724 |
super primitiveFailed |
725 |
! |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
726 |
|
6198 | 727 |
primitiveFailed:errorString |
728 |
<resource: #skipInDebuggersWalkBack> |
|
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
729 |
|
7154
f2d585b5f20e
X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7151
diff
changeset
|
730 |
ConfigurableFeatures hasXFT ifFalse:[ |
6936 | 731 |
super primitiveFailed:'Xft support is not configured'. |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
732 |
]. |
6198 | 733 |
super primitiveFailed:errorString |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
734 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
735 |
|
6946 | 736 |
!XftFontDescription methodsFor:'finalization'! |
737 |
||
738 |
finalizationLobby |
|
739 |
^ Lobby |
|
740 |
! |
|
741 |
||
742 |
finalize |
|
743 |
self xftDrawDestroy |
|
744 |
! ! |
|
745 |
||
6176 | 746 |
!XftFontDescription methodsFor:'getting a device font'! |
747 |
||
748 |
onDevice:aGraphicsDevice |
|
749 |
"Create a new XftFont representing the closes font as |
|
750 |
myself on aDevice; if one already exists, return the one." |
|
751 |
||
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
|
752 |
^ 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
|
753 |
|
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 |
"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
|
755 |
"Modified: / 29-02-2016 / 07:08:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
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 |
! |
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 |
|
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
|
758 |
onDevice:aGraphicsDevice ifAbsent: aBlock |
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
|
759 |
"Create a new XftFont representing the closes font as |
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 |
myself on aDevice; if one already exists, return the one." |
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
|
761 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
762 |
| myPatternId closestPatternId1 closestPatternId2 newFontId | |
6176 | 763 |
|
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
|
764 |
(device == aGraphicsDevice) 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
|
765 |
"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
|
766 |
^ 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
|
767 |
]. |
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 |
aGraphicsDevice 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
|
769 |
^ self |
6544 | 770 |
]. |
7121 | 771 |
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
|
772 |
^ super onDevice:aGraphicsDevice ifAbsent:aBlock. |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
773 |
]. |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
774 |
|
6389 | 775 |
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
|
776 |
RecentlyUsedFonts := OrderedCollection new:20. |
6389 | 777 |
]. |
778 |
||
779 |
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
|
780 |
((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
|
781 |
"/ 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
|
782 |
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
|
783 |
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
|
784 |
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
|
785 |
^ 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
|
786 |
] |
6389 | 787 |
]. |
788 |
||
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
|
789 |
RecentlyUsedFonts size >= 20 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
|
790 |
RecentlyUsedFonts removeLast. |
6389 | 791 |
]. |
792 |
||
6176 | 793 |
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
|
794 |
((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
|
795 |
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
|
796 |
^ 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
|
797 |
]. |
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 |
]. |
7121 | 799 |
|
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
|
800 |
"/ 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
|
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 |
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
|
803 |
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
|
804 |
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
|
805 |
"/ Good, this font exists!! |
7103 | 806 |
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
|
807 |
] 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
|
808 |
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
|
809 |
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
|
810 |
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
|
811 |
]. |
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 |
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
|
813 |
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
|
814 |
"/ !!!!!!!! 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
|
815 |
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
|
816 |
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
|
817 |
^ 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
|
818 |
]. |
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 |
]. |
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 |
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
|
821 |
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
|
822 |
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
|
823 |
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
|
824 |
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
|
825 |
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
|
826 |
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
|
827 |
^ self. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
828 |
] 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
|
829 |
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
|
830 |
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
|
831 |
closestPatternId2 notNil ifTrue:[closestPatternId2 release]. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
832 |
]. |
6176 | 833 |
|
834 |
" |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
835 |
(XftFontDescription family:'monospace' size:16) onDevice:Screen current |
6176 | 836 |
" |
837 |
||
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
|
838 |
"Modified: / 29-02-2016 / 08:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6176 | 839 |
! ! |
840 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
841 |
!XftFontDescription methodsFor:'initialization'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
842 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
843 |
setDevice: deviceArg patternId: patternIdArg fontId: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
844 |
device := deviceArg. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
845 |
fontId := fontIdArg. |
6325 | 846 |
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
|
847 |
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
|
848 |
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
|
849 |
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
|
850 |
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
|
851 |
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
|
852 |
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
|
853 |
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
|
854 |
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
|
855 |
name := patternIdArg at: FC_FULLNAME index: 1. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
856 |
|
7169
ae5df93e3b78
X11/XFT: Make sure `style` and `face` are never empty strings
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7154
diff
changeset
|
857 |
encoding:= patternIdArg at: 'encoding' index: 1. |
6963 | 858 |
]. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
859 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
860 |
"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
|
861 |
"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
|
862 |
! |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
863 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
864 |
setName: aString |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
865 |
"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
|
866 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
867 |
| pattern | |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
868 |
|
7151
51e71e95c952
X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7128
diff
changeset
|
869 |
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
|
870 |
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
|
871 |
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
|
872 |
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
|
873 |
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
|
874 |
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
|
875 |
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
|
876 |
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
|
877 |
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
|
878 |
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
|
879 |
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
|
880 |
pattern release. |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
881 |
]. |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
882 |
|
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 |
XftFontDescription named: 'times-12' |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
885 |
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
|
886 |
XftFontDescription named: 'Sans-10' |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
887 |
" |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
888 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
889 |
"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
|
890 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
891 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
892 |
!XftFontDescription methodsFor:'primitives'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
893 |
|
6936 | 894 |
disassociateXftDrawableFrom:drawableId |
895 |
"Disassociate the XftDrawable from drawableId. |
|
896 |
This mist be done before the drawable is destroyed, |
|
897 |
otherwise the XftDrawable is destroyed together with the drawable, |
|
898 |
and X11 errors will be signaled." |
|
899 |
||
900 |
| error | |
|
901 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
902 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
903 |
#ifdef XFT |
6936 | 904 |
if (!__isExternalAddressLike(__INST(sharedDrawId))) { |
905 |
// nothing to disasassociate from... |
|
906 |
RETURN(self); |
|
907 |
} |
|
908 |
if (!__isExternalAddressLike(drawableId)) { |
|
909 |
error = @symbol(BadArg); |
|
910 |
goto err; |
|
911 |
} |
|
912 |
if (XftDrawDrawable(XFT_DRAW(__INST(sharedDrawId))) == DRAWABLE(drawableId)) { |
|
913 |
XftDrawChange(XFT_DRAW(__INST(sharedDrawId)), None); |
|
914 |
} |
|
915 |
RETURN(self); |
|
916 |
err:; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
917 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
918 |
%}. |
6936 | 919 |
self primitiveFailed: error |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
920 |
|
6936 | 921 |
"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
|
922 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
923 |
|
6936 | 924 |
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
|
925 |
| error | |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
926 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
927 |
%{ |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
928 |
#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
|
929 |
if ( ! __isExternalAddressLike(xftDrawId) ) { |
6936 | 930 |
error = @symbol(BadArg1); |
931 |
goto err; |
|
932 |
} |
|
933 |
if (drawableId == nil) { |
|
934 |
XftDrawChange(XFT_DRAW(xftDrawId), None); |
|
935 |
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
|
936 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
937 |
if ( ! __isExternalAddressLike(drawableId) ) { |
6936 | 938 |
error = @symbol(BadArg2); |
939 |
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
|
940 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
941 |
if (XftDrawDrawable( XFT_DRAW(xftDrawId) ) != DRAWABLE( drawableId ) ) { |
6936 | 942 |
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
|
943 |
} |
6936 | 944 |
RETURN (self); |
945 |
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
|
946 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
947 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
948 |
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
|
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 |
"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
|
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 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
953 |
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
|
954 |
| error | |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
955 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
956 |
%{ |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
957 |
#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
|
958 |
if ( ! __isExternalAddressLike(displayId) ) { |
6198 | 959 |
error = @symbol(BadArg1); |
960 |
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
|
961 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
962 |
if ( ! __isSmallInteger(screen) ) { |
6198 | 963 |
error = @symbol(BadArg2); |
964 |
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
|
965 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
966 |
if ( ! __isExternalAddressLike(drawableId) ) { |
6198 | 967 |
error = @symbol(BadArg3); |
968 |
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
|
969 |
} |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
970 |
RETURN ( XFT_DRAW_HANDLE_NEW ( XftDrawCreate ( DISPLAY( displayId ) , |
6198 | 971 |
DRAWABLE( drawableId ) , |
972 |
DefaultVisual( DISPLAY( displayId), SCREEN (screen) ) , |
|
973 |
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
|
974 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
975 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
976 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
977 |
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
|
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 |
"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
|
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 |
|
6946 | 982 |
xftDrawDestroy |
983 |
%{ |
|
984 |
#ifdef XFT |
|
985 |
if (__INST(sharedDrawId) != nil) { |
|
986 |
XftDraw *xftDrawable = XFT_DRAW(__INST(sharedDrawId)); |
|
987 |
__INST(sharedDrawId) = nil; |
|
988 |
XftDrawDestroy(xftDrawable); |
|
989 |
} |
|
990 |
RETURN (self); |
|
991 |
#endif |
|
992 |
%}. |
|
993 |
self primitiveFailed. |
|
994 |
! |
|
995 |
||
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
996 |
xftDrawRect: drawIdArg color: aColor x: x y: y width: w height: h |
6198 | 997 |
| 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
|
998 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
999 |
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
|
1000 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1001 |
r := aColor scaledRed. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1002 |
g := aColor scaledGreen. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1003 |
b := aColor scaledBlue. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1004 |
a := aColor alpha * 65535. |
6263 | 1005 |
r isNil ifTrue:[ |
1006 |
"/ when drawing into a pixmap... |
|
1007 |
aColor colorId == 0 ifTrue:[ |
|
1008 |
r := g := b := 0. |
|
1009 |
] ifFalse:[ |
|
1010 |
r := g := b := 16rFFFF. |
|
1011 |
] |
|
1012 |
]. |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1013 |
pix := aColor colorId. |
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1014 |
%{ /* 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
|
1015 |
#ifdef XFT |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1016 |
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
|
1017 |
if ( ! __isExternalAddressLike(drawIdArg) ) { |
6198 | 1018 |
error = @symbol(BadArg1); |
1019 |
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
|
1020 |
} |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1021 |
if ( ! __isSmallInteger(pix) ) { |
6198 | 1022 |
error = @symbol(BadColorId); |
1023 |
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
|
1024 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1025 |
if ( ! __isSmallInteger(x) ) { |
6198 | 1026 |
error = @symbol(BadArg3); |
1027 |
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
|
1028 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1029 |
if ( ! __isSmallInteger(y) ) { |
6198 | 1030 |
error = @symbol(BadArg4); |
1031 |
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
|
1032 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1033 |
if ( ! __isSmallInteger(w) ) { |
6198 | 1034 |
error = @symbol(BadArg5); |
1035 |
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
|
1036 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1037 |
if ( ! __isSmallInteger(h) ) { |
6198 | 1038 |
error = @symbol(BadArg6); |
1039 |
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
|
1040 |
} |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1041 |
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
|
1042 |
clr.color.red = __intVal(r); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1043 |
clr.color.green = __intVal(g); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1044 |
clr.color.blue = __intVal(b); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1045 |
clr.color.alpha = __intVal(a); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1046 |
|
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1047 |
XftDrawRect(XFT_DRAW(drawIdArg), &clr, |
6198 | 1048 |
__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
|
1049 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1050 |
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
|
1051 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1052 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1053 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1054 |
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
|
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 |
"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
|
1057 |
"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
|
1058 |
! |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1059 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1060 |
xftDrawSetClip: drawIdArg rectangle: rect |
6198 | 1061 |
| error xObj yObj wObj hObj | |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1062 |
|
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1063 |
rect notNil ifTrue:[ |
6198 | 1064 |
xObj := rect left. |
1065 |
yObj := rect top. |
|
1066 |
wObj := rect width. |
|
1067 |
hObj := rect height. |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1068 |
]. |
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1069 |
%{ /* UNLIMITEDSTACK */ |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1070 |
#ifdef XFT |
6191
86ef1e69ffc1
Call XftConfigSubstitute() & XftDefaultSubstitute() before matching fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6190
diff
changeset
|
1071 |
XRectangle r; |
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1072 |
if ( ! __isExternalAddressLike(drawIdArg) ) { |
6198 | 1073 |
error = @symbol(BadArg1); |
1074 |
goto err; |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1075 |
} |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1076 |
if (rect != nil) { |
6198 | 1077 |
r.x = __intVal(xObj); |
1078 |
r.y = __intVal(yObj); |
|
1079 |
r.width = __intVal(wObj); |
|
1080 |
r.height = __intVal(hObj); |
|
1081 |
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
|
1082 |
} else { |
6198 | 1083 |
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
|
1084 |
} |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1085 |
RETURN ( self ); |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1086 |
err:; |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1087 |
#endif |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1088 |
%}. |
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1089 |
self primitiveFailed: error. |
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 |
"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
|
1092 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1093 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1094 |
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
|
1095 |
| 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
|
1096 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1097 |
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
|
1098 |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1099 |
r := aColor scaledRed. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1100 |
g := aColor scaledGreen. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1101 |
b := aColor scaledBlue. |
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1102 |
a := aColor alpha * 65535. |
6263 | 1103 |
r isNil ifTrue:[ |
1104 |
"/ when drawing into a pixmap... |
|
1105 |
aColor colorId == 0 ifTrue:[ |
|
1106 |
r := g := b := 0. |
|
1107 |
] ifFalse:[ |
|
1108 |
r := g := b := 16rFFFF. |
|
1109 |
] |
|
1110 |
]. |
|
6189
9194261bf002
fixed - a structure field conflicted with a local variable name
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1111 |
pix := aColor colorId. |
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1112 |
%{ /* 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
|
1113 |
#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
|
1114 |
int _start, _stop; |
6707 | 1115 |
int __x, __y; |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1116 |
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
|
1117 |
if ( ! __isExternalAddressLike(drawIdArg) ) { |
6198 | 1118 |
error = @symbol(BadArg1); |
1119 |
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
|
1120 |
} |
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1121 |
if ( ! __isSmallInteger(pix) ) { |
6198 | 1122 |
error = @symbol(BadColorId); |
1123 |
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
|
1124 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1125 |
if ( ! __isSmallInteger(x) ) { |
6198 | 1126 |
error = @symbol(BadArg4); |
1127 |
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
|
1128 |
} |
6707 | 1129 |
__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
|
1130 |
if ( ! __isSmallInteger(y) ) { |
6198 | 1131 |
error = @symbol(BadArg5); |
1132 |
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
|
1133 |
} |
6707 | 1134 |
__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
|
1135 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1136 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1137 |
if ( ! __isSmallInteger(start) ) { |
6198 | 1138 |
error = @symbol(BadArg6); |
1139 |
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
|
1140 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1141 |
_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
|
1142 |
if ( ! __isSmallInteger(stop) ) { |
6198 | 1143 |
error = @symbol(BadArg7); |
1144 |
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
|
1145 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1146 |
_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
|
1147 |
|
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1148 |
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
|
1149 |
clr.color.red = __intVal(r); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1150 |
clr.color.green = __intVal(g); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1151 |
clr.color.blue = __intVal(b); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1152 |
clr.color.alpha = __intVal(a); |
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1153 |
|
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
|
1154 |
if ( __isStringLike(text) ) { |
6198 | 1155 |
XftDrawString8(XFT_DRAW(drawIdArg), &clr, XFT_FONT(fontIdArg), |
6707 | 1156 |
__x, __y, |
6198 | 1157 |
__stringVal(text) + (_start - 1), _stop - _start + 1); |
1158 |
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
|
1159 |
} else { |
6198 | 1160 |
error = @symbol(BadArg5); |
1161 |
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
|
1162 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1163 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1164 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1165 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1166 |
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
|
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 |
"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
|
1169 |
"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
|
1170 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1171 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1172 |
xftFontGetAscent: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1173 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1174 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1175 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1176 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1177 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1178 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
6198 | 1179 |
error = @symbol(BadArg1); |
1180 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1181 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1182 |
v = XFT_FONT(fontIdArg)->ascent; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1183 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1184 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1185 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1186 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1187 |
self primitiveFailed: error |
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 |
"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
|
1190 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1191 |
|
6198 | 1192 |
xftFontGetDescent:fontIdArg |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1193 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1194 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1195 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1196 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1197 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1198 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
6198 | 1199 |
error = @symbol(BadArg1); |
1200 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1201 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1202 |
v = XFT_FONT(fontIdArg)->descent; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1203 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1204 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1205 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1206 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1207 |
self primitiveFailed: error |
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 |
"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
|
1210 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1211 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1212 |
xftFontGetHeight: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1213 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1214 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1215 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1216 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1217 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1218 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
6198 | 1219 |
error = @symbol(BadArg1); |
1220 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1221 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1222 |
v = XFT_FONT(fontIdArg)->height; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1223 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1224 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1225 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1226 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1227 |
self primitiveFailed: error |
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 |
"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
|
1230 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1231 |
|
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
|
1232 |
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
|
1233 |
| 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
|
1234 |
|
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 |
%{ |
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 |
#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
|
1237 |
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
|
1238 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
6198 | 1239 |
error = @symbol(BadArg1); |
1240 |
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
|
1241 |
} |
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
|
1242 |
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
|
1243 |
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
|
1244 |
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
|
1245 |
#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
|
1246 |
%}. |
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 |
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
|
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 |
"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
|
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 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1252 |
xftFontGetPattern: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1253 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1254 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1255 |
%{ |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1256 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1257 |
XftPattern* p; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1258 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
6198 | 1259 |
error = @symbol(BadArg1); |
1260 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1261 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1262 |
p = XFT_FONT(fontIdArg)->pattern; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1263 |
if (p == NULL) { |
6198 | 1264 |
RETURN ( nil ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1265 |
} else { |
6198 | 1266 |
RETURN ( FC_PATTERN_HANDLE_NEW ( p ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1267 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1268 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1269 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1270 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1271 |
self primitiveFailed: error |
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 |
"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
|
1274 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1275 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1276 |
xftFontMatch: displayId screen: screen pattern: patternId |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1277 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1278 |
|
7103 | 1279 |
%{ /* UNLIMITEDSTACK */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1280 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1281 |
XftPattern* p; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1282 |
XftResult r; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1283 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1284 |
if ( ! __isExternalAddressLike(displayId) ) { |
6198 | 1285 |
error = @symbol(BadArg1); |
1286 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1287 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1288 |
if ( ! __isSmallInteger( screen ) ) { |
6198 | 1289 |
error = @symbol(BadArg2); |
1290 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1291 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1292 |
if ( ! __isExternalAddressLike(patternId) ) { |
6198 | 1293 |
error = @symbol(BadArg3); |
1294 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1295 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1296 |
|
6191
86ef1e69ffc1
Call XftConfigSubstitute() & XftDefaultSubstitute() before matching fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6190
diff
changeset
|
1297 |
XftConfigSubstitute(FC_PATTERN( patternId )); |
86ef1e69ffc1
Call XftConfigSubstitute() & XftDefaultSubstitute() before matching fonts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6190
diff
changeset
|
1298 |
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
|
1299 |
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
|
1300 |
if (p) { |
6198 | 1301 |
RETURN ( FC_PATTERN_HANDLE_NEW ( p ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1302 |
} else { |
6198 | 1303 |
error = @symbol(XftFontMatchReturnedNull); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1304 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1305 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1306 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1307 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1308 |
self primitiveFailed: error |
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 |
"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
|
1311 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1312 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1313 |
xftFontOpenPattern: displayId pattern: patternId |
7103 | 1314 |
"Note: the pattern is destroyed when the font is closed" |
1315 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1316 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1317 |
|
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1318 |
%{ /* UNLIMITEDSTACK */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1319 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1320 |
XftFont* f; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1321 |
if ( ! __isExternalAddressLike(displayId) ) { |
7114 | 1322 |
error = @symbol(BadArg1); |
1323 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1324 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1325 |
if ( ! __isExternalAddressLike(patternId) ) { |
7103 | 1326 |
error = @symbol(BadArg2); |
1327 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1328 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1329 |
|
6188
9d09f76582b7
Fixed problem with clipping.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6187
diff
changeset
|
1330 |
f = XftFontOpenPattern( DISPLAY(displayId) , FC_PATTERN( patternId ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1331 |
if (f == NULL) { |
7103 | 1332 |
RETURN ( nil ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1333 |
} else { |
7103 | 1334 |
RETURN ( XFT_FONT_HANDLE_NEW ( f ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1335 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1336 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1337 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1338 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1339 |
self primitiveFailed: error |
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 |
"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
|
1342 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1343 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1344 |
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
|
1345 |
| 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
|
1346 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1347 |
extents := Array new: 6. |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1348 |
bitsPerCharacter := text bitsPerCharacter. |
6918
c5cb9d5dfaae
Fixed memory corruption caused by Xft fonts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6883
diff
changeset
|
1349 |
%{ /* 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
|
1350 |
#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
|
1351 |
XGlyphInfo info; |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1352 |
int bytesPerCharacter; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1353 |
char *string; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1354 |
int len; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1355 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1356 |
bytesPerCharacter = __intVal(bitsPerCharacter) / 8; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1357 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1358 |
if ( ! __isExternalAddressLike(displayIdArg) ) { |
6198 | 1359 |
error = @symbol(BadArg1); |
1360 |
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
|
1361 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1362 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
6198 | 1363 |
error = @symbol(BadArg2); |
1364 |
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
|
1365 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1366 |
if ( ! __isSmallInteger(start) ) { |
6198 | 1367 |
error = @symbol(BadArg4); |
1368 |
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
|
1369 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1370 |
if ( ! __isSmallInteger(stop) ) { |
6198 | 1371 |
error = @symbol(BadArg5); |
1372 |
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
|
1373 |
} |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1374 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1375 |
string = __stringVal( text ) + (( __intVal(start) - 1 ) * bytesPerCharacter); |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1376 |
len = __intVal(stop) - __intVal(start) + 1; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1377 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1378 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1379 |
switch (bytesPerCharacter) { |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1380 |
case 1: |
6198 | 1381 |
XftTextExtents8(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar8*)string, len, &info); |
1382 |
break; |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1383 |
case 2: |
6198 | 1384 |
XftTextExtents16(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar16*)string, len, &info); |
1385 |
break; |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1386 |
case 4: |
6198 | 1387 |
XftTextExtents32(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar32*)string, len, &info); |
1388 |
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
|
1389 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1390 |
__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
|
1391 |
__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
|
1392 |
__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
|
1393 |
__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
|
1394 |
__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
|
1395 |
__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
|
1396 |
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
|
1397 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1398 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1399 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1400 |
error notNil ifTrue:[ |
6198 | 1401 |
self primitiveFailed: error. |
1402 |
^ 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
|
1403 |
]. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1404 |
^ extents |
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 |
"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
|
1407 |
"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
|
1408 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1409 |
|
6198 | 1410 |
!XftFontDescription methodsFor:'printing & storing'! |
1411 |
||
1412 |
storeOn:aStream |
|
1413 |
"append a character sequence to the argument, aStream from which the |
|
1414 |
receiver can be reconstructed using readFrom:." |
|
1415 |
||
1416 |
aStream nextPutAll:'(XftFontDescription family:'. family storeOn:aStream. |
|
1417 |
aStream nextPutAll:' face:'. face storeOn:aStream. |
|
1418 |
aStream nextPutAll:' style:'. style storeOn:aStream. |
|
1419 |
aStream nextPutAll:' size:'. size storeOn:aStream. |
|
1420 |
aStream nextPutAll:' encoding:'. encoding storeOn:aStream. |
|
1421 |
aStream nextPut:$) |
|
1422 |
||
1423 |
" |
|
1424 |
(XftFontDescription family: 'DejaVu Sans' size: 8) storeString |
|
1425 |
" |
|
1426 |
! ! |
|
1427 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1428 |
!XftFontDescription methodsFor:'queries-dimensions'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1429 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1430 |
ascent |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1431 |
"return the ascent - the number of pixels above the baseLine." |
6656 | 1432 |
ascent isNil ifTrue:[ |
6707 | 1433 |
ascent := self xftFontGetAscent: fontId |
6656 | 1434 |
]. |
1435 |
^ ascent |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1436 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1437 |
"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
|
1438 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1439 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1440 |
descent |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1441 |
"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
|
1442 |
|
6656 | 1443 |
descent isNil ifTrue:[ |
6707 | 1444 |
descent := self xftFontGetDescent: fontId |
6656 | 1445 |
]. |
1446 |
^ descent |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1447 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1448 |
"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
|
1449 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1450 |
|
6314 | 1451 |
getFontMetrics |
1452 |
|info| |
|
1453 |
||
1454 |
info := DeviceWorkstation::DeviceFontMetrics new. |
|
1455 |
info |
|
1456 |
ascent:self ascent |
|
1457 |
descent:self descent |
|
1458 |
maxAscent:self maxAscent |
|
1459 |
maxDescent:self maxDescent |
|
1460 |
minWidth:self maxWidth |
|
1461 |
maxWidth:self maxWidth |
|
1462 |
avgWidth:self maxWidth |
|
1463 |
minCode:self minCode |
|
1464 |
maxCode:self maxCode |
|
1465 |
direction:#LeftToRight. |
|
1466 |
^ info |
|
1467 |
! |
|
1468 |
||
6543 | 1469 |
getFontResolution |
1470 |
device isNil ifTrue:[ ^ 72 @ 72 ]. |
|
1471 |
^ device resolution |
|
1472 |
! |
|
1473 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1474 |
height |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1475 |
"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
|
1476 |
|
6656 | 1477 |
height isNil ifTrue:[ |
6707 | 1478 |
height := self xftFontGetHeight: fontId |
6656 | 1479 |
]. |
1480 |
^ height |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1481 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1482 |
"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
|
1483 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1484 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1485 |
isFixedWidth |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1486 |
"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
|
1487 |
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
|
1488 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1489 |
^ false "/ How to check? |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1490 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1491 |
"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
|
1492 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1493 |
|
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
|
1494 |
maxAscent |
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
|
1495 |
"return the fonts maximum-ascent (i.e. the maximum of all characters); |
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
|
1496 |
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
|
1497 |
|
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
|
1498 |
^ 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
|
1499 |
|
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
|
1500 |
"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
|
1501 |
! |
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
|
1502 |
|
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
|
1503 |
maxDescent |
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
|
1504 |
"return the fonts maximum-descent (i.e. the maximum of all characters); |
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
|
1505 |
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
|
1506 |
|
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
|
1507 |
^ 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
|
1508 |
|
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
|
1509 |
"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
|
1510 |
! |
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
|
1511 |
|
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 |
maxWidth |
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
|
1513 |
"return the fonts maximum-width character (i.e. the maximum of all characters); |
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 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
|
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 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
|
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: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
|
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 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1521 |
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
|
1522 |
"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
|
1523 |
|
6472 | 1524 |
|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
|
1525 |
|
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1526 |
(stop < start) ifTrue:[^ 0]. |
6472 | 1527 |
maxWidthOfSingleGlyph := self maxWidth. |
1528 |
"xOff from XFTTextExtents is a signed short. |
|
1529 |
Work arond for long strings" |
|
1530 |
(stop - start + 1) * maxWidthOfSingleGlyph > 32767 ifTrue:[ |
|
6819
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1531 |
|total chunkSize| |
6472 | 1532 |
|
6819
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1533 |
chunkSize := (32767 // maxWidthOfSingleGlyph) - 1. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1534 |
total := 0. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1535 |
start to:stop by:chunkSize do:[:eachChunkStart| |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1536 |
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
|
1537 |
from:eachChunkStart to:((eachChunkStart+chunkSize-1) min:stop). |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1538 |
"/ extents --> #(width height x y xOff yOff) |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1539 |
total := total + extents fifth. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1540 |
]. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1541 |
^ total. |
f91377f97414
Merged 1e33b4eeb725 and ee648b604f67 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
1542 |
]. |
6472 | 1543 |
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
|
1544 |
"/ extents --> #(width height x y xOff yOff) |
6183
a21827076de1
Fix for bad layout and segfault when selecting whole line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6182
diff
changeset
|
1545 |
^ 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
|
1546 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1547 |
"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
|
1548 |
"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
|
1549 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1550 |
|
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1551 |
!XftFontDescription methodsFor:'release'! |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1552 |
|
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1553 |
releaseDrawIfAssociatedWith: view |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1554 |
| drawableId | |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1555 |
|
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1556 |
view isNil ifTrue:[ ^ self ]. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1557 |
drawableId := view id. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1558 |
drawableId isNil ifTrue: [ ^ self ]. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1559 |
%{ |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1560 |
#ifdef XFT |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1561 |
if ( __INST(sharedDrawId) != nil ) { |
6393 | 1562 |
if (XftDrawDrawable(XFT_DRAW(__INST(sharedDrawId))) == DRAWABLE(drawableId)) { |
1563 |
__INST(sharedDrawId) = nil; |
|
1564 |
XftDrawDestroy(DRAWABLE(drawableId)); |
|
1565 |
} |
|
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1566 |
} |
6339 | 1567 |
RETURN (self); |
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1568 |
#endif |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1569 |
%}. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1570 |
self primitiveFailed |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1571 |
|
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1572 |
"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
|
1573 |
"Modified: / 12-01-2014 / 22:09:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6344 | 1574 |
! |
1575 |
||
1576 |
releaseFromDevice |
|
1577 |
"I am no longer available on the device" |
|
1578 |
||
6946 | 1579 |
Lobby unregister:self. |
7055 | 1580 |
"/ cg: no, xftDrawDestroy should not be done. |
1581 |
"/ (releaseFromDevice is called when either the display connection |
|
1582 |
"/ is lost, or a snapshot image is restarted) |
|
1583 |
"/ self xftDrawDestroy. |
|
6946 | 1584 |
|
6344 | 1585 |
device := nil. |
1586 |
fontId := nil. |
|
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1587 |
sharedDrawId := nil. |
6946 | 1588 |
closestFont := nil. |
6200
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 |
|
6319 | 1591 |
!XftFontDescription methodsFor:'testing'! |
1592 |
||
6936 | 1593 |
isScaledFont |
1594 |
"Xft fonts are always scaled" |
|
1595 |
||
1596 |
^ true |
|
1597 |
! |
|
1598 |
||
6339 | 1599 |
isUsed |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1600 |
^ sharedDrawId notNil |
6339 | 1601 |
! |
1602 |
||
6319 | 1603 |
isXftFont |
1604 |
^ true |
|
1605 |
! ! |
|
1606 |
||
6264 | 1607 |
!XftFontDescription::FCFontListParser class methodsFor:'documentation'! |
1608 |
||
1609 |
documentation |
|
1610 |
" |
|
1611 |
parses fc-list output to get a list of XftFontDescriptions |
|
1612 |
||
1613 |
[author:] |
|
6319 | 1614 |
cg |
6264 | 1615 |
|
1616 |
[instance variables:] |
|
1617 |
||
1618 |
[class variables:] |
|
1619 |
||
1620 |
[see also:] |
|
1621 |
||
1622 |
" |
|
1623 |
! ! |
|
1624 |
||
6263 | 1625 |
!XftFontDescription::FCFontListParser methodsFor:'api'! |
1626 |
||
1627 |
listOfAvailableFonts |
|
6337 | 1628 |
|readEntry list l fcListProg| |
6263 | 1629 |
|
1630 |
list := OrderedCollection new. |
|
1631 |
||
6319 | 1632 |
readEntry := |
6656 | 1633 |
[ |
1634 |
|key| |
|
6263 | 1635 |
|
6656 | 1636 |
[l startsWith:'Pattern has'] whileFalse:[ |
1637 |
l := pipeStream nextLine. Transcript showCR:l. |
|
1638 |
]. |
|
6263 | 1639 |
|
6656 | 1640 |
currentDescription := XftFontDescription new. |
1641 |
[ l := pipeStream nextLine. l notEmptyOrNil ] whileTrue:[ |
|
1642 |
"/ Transcript showCR:l. |
|
1643 |
lineStream := l readStream. lineStream skipSeparators. |
|
1644 |
key := lineStream upToSeparator. |
|
1645 |
( |
|
1646 |
#('family:' 'style:' 'slant:' 'weight:' 'width:' |
|
1647 |
'pixelsize:' 'spacing:' 'foundry:' 'antialias:' |
|
1648 |
'file:' 'outline' 'scalable:' 'charset:' 'lang:' |
|
1649 |
'fontversion:' 'fontformat:' 'decorative:' 'index:' |
|
1650 |
'outline:' 'familylang:' 'stylelang:' 'fullname:' |
|
1651 |
'fullnamelang:' 'capability:' 'hash:' 'postscriptname:' |
|
1652 |
) includes:key |
|
1653 |
) ifTrue:[ |
|
1654 |
self perform:('fc_',(key allButLast)) asSymbol |
|
1655 |
] ifFalse:[ |
|
1656 |
Transcript show:'Xft ignored line: '; showCR:l. |
|
1657 |
self breakPoint:#cg. |
|
1658 |
]. |
|
1659 |
]. |
|
1660 |
list add:currentDescription |
|
1661 |
]. |
|
6319 | 1662 |
|
6337 | 1663 |
fcListProg := #('/usr/bin/fc-list' '/usr/X11/bin/fc-list') detect:[:eachProg| |
6656 | 1664 |
eachProg asFilename isExecutableProgram |
1665 |
] ifNone:[ |
|
1666 |
'XftFontDescription [warning]: fc-list program not found - no XFT fonts' errorPrintCR. |
|
1667 |
^ list. |
|
1668 |
]. |
|
6337 | 1669 |
|
1670 |
pipeStream := PipeStream readingFrom:fcListProg, ' -v'. |
|
6263 | 1671 |
[ |
6656 | 1672 |
[pipeStream atEnd] whileFalse:[ |
1673 |
l := pipeStream nextLine. |
|
1674 |
readEntry value. |
|
1675 |
] |
|
6263 | 1676 |
] ensure:[ |
6656 | 1677 |
pipeStream close |
6263 | 1678 |
]. |
1679 |
^ list |
|
1680 |
||
1681 |
" |
|
6337 | 1682 |
FCFontListParser new listOfAvailableFonts |
6263 | 1683 |
" |
1684 |
! ! |
|
1685 |
||
1686 |
!XftFontDescription::FCFontListParser methodsFor:'font list keywords'! |
|
1687 |
||
1688 |
fc_antialias |
|
1689 |
"helper for font listing" |
|
1690 |
||
6319 | 1691 |
currentDescription isAntialiasedFont:(self getBoolean). |
6263 | 1692 |
! |
1693 |
||
6264 | 1694 |
fc_capability |
1695 |
"helper for font listing" |
|
1696 |
||
6319 | 1697 |
"currentDescription capability:" (self getString). |
6264 | 1698 |
! |
1699 |
||
6263 | 1700 |
fc_charset |
1701 |
"helper for font listing" |
|
1702 |
||
6319 | 1703 |
|page bits l min max minCode maxCode| |
6263 | 1704 |
|
1705 |
[ l := pipeStream nextLine. l notEmpty ] whileTrue:[ |
|
6393 | 1706 |
"/ Transcript show:'->'; showCR:l. |
1707 |
(l startsWith:Character tab) ifFalse:[ |
|
1708 |
(l startsWith:'(') ifFalse:[self halt]. |
|
1709 |
currentDescription minCode:minCode. |
|
1710 |
currentDescription maxCode:maxCode. |
|
1711 |
^ self. |
|
1712 |
]. |
|
6264 | 1713 |
|
6393 | 1714 |
lineStream := l readStream. |
1715 |
lineStream skipSeparators. |
|
1716 |
page := Integer readFrom:(lineStream upTo:$:) radix:16. |
|
1717 |
lineStream next. |
|
1718 |
bits := 0 to:7 collect:[:i| |
|
1719 |
lineStream skipSeparators. |
|
1720 |
Integer readFrom:(lineStream upToSeparator) radix:16. |
|
1721 |
]. |
|
1722 |
min := (page * 256 + 0). |
|
1723 |
max := (page * 256 + 255). |
|
1724 |
minCode isNil ifTrue:[ |
|
1725 |
minCode := min. |
|
1726 |
maxCode := max. |
|
1727 |
] ifFalse:[ |
|
1728 |
minCode := minCode min:min. |
|
1729 |
maxCode := maxCode max:max. |
|
1730 |
]. |
|
6263 | 1731 |
]. |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1732 |
"/ currentDescription characterSet:(self getString). |
6319 | 1733 |
currentDescription minCode:minCode. |
1734 |
currentDescription maxCode:maxCode. |
|
6263 | 1735 |
! |
1736 |
||
6319 | 1737 |
fc_decorative |
6263 | 1738 |
"helper for font listing" |
1739 |
||
6319 | 1740 |
currentDescription isDecorativeFont:(self getBoolean). |
6263 | 1741 |
! |
1742 |
||
1743 |
fc_family |
|
1744 |
"helper for font listing" |
|
1745 |
||
6319 | 1746 |
currentDescription family:(self getString). |
6263 | 1747 |
! |
1748 |
||
1749 |
fc_familylang |
|
1750 |
"helper for font listing" |
|
1751 |
||
6319 | 1752 |
"currentDescription familylang:" (self getString). |
6263 | 1753 |
! |
1754 |
||
6319 | 1755 |
fc_file |
6263 | 1756 |
"helper for font listing" |
1757 |
||
6319 | 1758 |
currentDescription file:(self getString). |
6263 | 1759 |
! |
1760 |
||
1761 |
fc_fontformat |
|
1762 |
"helper for font listing" |
|
1763 |
||
6319 | 1764 |
currentDescription fontFormat:(self getString). |
6263 | 1765 |
! |
1766 |
||
1767 |
fc_fontversion |
|
1768 |
"helper for font listing" |
|
1769 |
||
6319 | 1770 |
currentDescription fontVersion:(self getInteger). |
6263 | 1771 |
! |
1772 |
||
1773 |
fc_foundry |
|
1774 |
"helper for font listing" |
|
1775 |
||
6319 | 1776 |
currentDescription foundry:(self getString). |
6263 | 1777 |
! |
1778 |
||
6264 | 1779 |
fc_fullname |
1780 |
"helper for font listing" |
|
1781 |
||
6319 | 1782 |
"currentDescription fullname:" (self getString). |
6264 | 1783 |
! |
1784 |
||
1785 |
fc_fullnamelang |
|
1786 |
"helper for font listing" |
|
1787 |
||
6319 | 1788 |
"currentDescription fullnamelang:" (self getString). |
6264 | 1789 |
! |
1790 |
||
6338 | 1791 |
fc_hash |
1792 |
"helper for font listing" |
|
1793 |
||
1794 |
"currentDescription hash:" self getString. |
|
1795 |
! |
|
1796 |
||
6264 | 1797 |
fc_index |
1798 |
"helper for font listing" |
|
1799 |
||
6319 | 1800 |
"currentDescription index:" (self getInteger). |
6264 | 1801 |
! |
1802 |
||
6263 | 1803 |
fc_lang |
1804 |
"helper for font listing" |
|
1805 |
||
6319 | 1806 |
"/ currentDescription characterSet:(self getString). |
6263 | 1807 |
! |
1808 |
||
1809 |
fc_outline |
|
1810 |
"helper for font listing" |
|
1811 |
||
6319 | 1812 |
currentDescription isOutlineFont:(self getBoolean). |
6263 | 1813 |
! |
1814 |
||
1815 |
fc_pixelsize |
|
1816 |
"helper for font listing" |
|
1817 |
||
6325 | 1818 |
currentDescription setPixelSize:(self getInteger). |
1819 |
currentDescription setSizeUnit:#px. |
|
1820 |
"/ currentDescription setSize:(self getInteger). |
|
1821 |
"/ currentDescription setSizeUnit:#pt. |
|
6263 | 1822 |
! |
1823 |
||
6338 | 1824 |
fc_postscriptname |
1825 |
"helper for font listing" |
|
1826 |
||
1827 |
"currentDescription postscriptname:" self getString. |
|
1828 |
! |
|
1829 |
||
6263 | 1830 |
fc_scalable |
1831 |
"helper for font listing" |
|
1832 |
||
6319 | 1833 |
currentDescription isScalableFont:(self getBoolean). |
6263 | 1834 |
! |
1835 |
||
1836 |
fc_slant |
|
1837 |
"helper for font listing" |
|
1838 |
||
6319 | 1839 |
currentDescription slant:(self getInteger). |
6263 | 1840 |
! |
1841 |
||
1842 |
fc_spacing |
|
1843 |
"helper for font listing" |
|
1844 |
||
6319 | 1845 |
currentDescription spacing:(self getInteger). |
6263 | 1846 |
! |
1847 |
||
1848 |
fc_style |
|
1849 |
"helper for font listing" |
|
1850 |
||
6319 | 1851 |
|xftStyle| |
1852 |
||
1853 |
xftStyle := self getString. |
|
6391 | 1854 |
"/ ((xftStyle includesString:'Bold') or:[xftStyle includesString:'Fett']) ifTrue:[ |
1855 |
"/ currentDescription face:'bold'. |
|
1856 |
"/ currentDescription style:'roman'. |
|
1857 |
"/ ^ self. |
|
1858 |
"/ ]. |
|
1859 |
((xftStyle includesString:'Italic') or:[xftStyle includesString:'Oblique']) ifTrue:[ |
|
1860 |
"/ currentDescription face:'medium'. |
|
6393 | 1861 |
currentDescription style:'italic'. |
1862 |
^ self. |
|
6319 | 1863 |
]. |
6391 | 1864 |
"/ (xftStyle includesString:'Regular') ifTrue:[ |
1865 |
"/ currentDescription face:'regular'. |
|
1866 |
"/ currentDescription style:'roman'. |
|
1867 |
"/ ^ self. |
|
1868 |
"/ ]. |
|
6319 | 1869 |
"/ self halt. |
6391 | 1870 |
"/ currentDescription face:'medium'. |
6319 | 1871 |
currentDescription style:'roman'. |
6263 | 1872 |
! |
1873 |
||
6264 | 1874 |
fc_stylelang |
1875 |
"helper for font listing" |
|
1876 |
||
6319 | 1877 |
"currentDescription stylelang:" (self getString). |
6264 | 1878 |
! |
1879 |
||
6263 | 1880 |
fc_weight |
1881 |
"helper for font listing" |
|
1882 |
||
6319 | 1883 |
currentDescription weight:(self getInteger). |
6263 | 1884 |
! |
1885 |
||
1886 |
fc_width |
|
1887 |
"helper for font listing" |
|
1888 |
||
6319 | 1889 |
currentDescription width:(self getInteger). |
6263 | 1890 |
! ! |
1891 |
||
1892 |
!XftFontDescription::FCFontListParser methodsFor:'helpers'! |
|
1893 |
||
6319 | 1894 |
getBoolean |
6263 | 1895 |
"helper for font listing" |
1896 |
||
1897 |
|s| |
|
1898 |
||
1899 |
lineStream skipSeparators. |
|
6319 | 1900 |
s := lineStream nextAlphaNumericWord. |
1901 |
^ s = 'FcTrue'. |
|
6263 | 1902 |
! |
1903 |
||
6264 | 1904 |
getInteger |
1905 |
"helper for font listing" |
|
1906 |
||
1907 |
lineStream skipSeparators. |
|
6319 | 1908 |
^ Integer readFrom:lineStream. |
6264 | 1909 |
! |
1910 |
||
6319 | 1911 |
getString |
6263 | 1912 |
"helper for font listing" |
1913 |
||
1914 |
lineStream skipSeparators. |
|
6319 | 1915 |
lineStream peekFor:$". |
1916 |
^ (lineStream upTo:$"). |
|
7114 | 1917 |
! ! |
1918 |
||
6176 | 1919 |
!XftFontDescription class methodsFor:'documentation'! |
1920 |
||
1921 |
version |
|
6936 | 1922 |
^ '$Header$' |
6176 | 1923 |
! |
1924 |
||
1925 |
version_CVS |
|
6936 | 1926 |
^ '$Header$' |
6821
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1927 |
! |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1928 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1929 |
version_HG |
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1930 |
|
0e2fb9a04314
Added XftFontDescription class>>named: and corresponding primitived (XftNameParse())
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6819
diff
changeset
|
1931 |
^ '$Changeset: <not expanded> $' |
6176 | 1932 |
! ! |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1933 |
|
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
|
1934 |
|
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
|
1935 |
XftFontDescription initialize! |