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