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