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