author | Stefan Vogel <sv@exept.de> |
Tue, 02 Feb 2016 18:57:44 +0100 | |
changeset 7121 | a3833df3f396 |
parent 7116 | ab09e688e134 |
child 7128 | e49af1b43177 |
child 7219 | 970a3474e5fc |
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:[ |
7121 | 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:{ |
7121 | 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:{ |
7121 | 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 |
|
7121 | 507 |
"set the weight. The face is the string representation of weight." |
6391 | 508 |
|
509 |
self assert:(self fontId isNil). "/ cannot change an instantiated font |
|
510 |
||
7121 | 511 |
weight := aNumber. |
512 |
||
513 |
aNumber == FC_WEIGHT_THIN ifTrue:[ face := #thin. ^ self]. |
|
514 |
aNumber == FC_WEIGHT_EXTRALIGHT ifTrue:[ face := #extralight. ^ self]. |
|
515 |
aNumber == FC_WEIGHT_LIGHT ifTrue:[ face := #light. ^ self]. |
|
516 |
aNumber == FC_WEIGHT_BOOK ifTrue:[ face := #book. ^ self]. |
|
517 |
aNumber == FC_WEIGHT_REGULAR ifTrue:[ face := #regular. ^ self]. |
|
518 |
aNumber == FC_WEIGHT_MEDIUM ifTrue:[ face := #medium. ^ self]. |
|
519 |
aNumber == FC_WEIGHT_DEMIBOLD ifTrue:[ face := #demibold. ^ self]. |
|
520 |
aNumber == FC_WEIGHT_BOLD ifTrue:[ face := #bold. ^ self]. |
|
521 |
aNumber == FC_WEIGHT_EXTRABOLD ifTrue:[ face := #extrabold. ^ self]. |
|
522 |
aNumber == FC_WEIGHT_BLACK ifTrue:[ face := #black. ^ self]. |
|
523 |
aNumber == FC_WEIGHT_EXTRABLACK ifTrue:[ face := #extrablack. ^ self]. |
|
6391 | 524 |
|
525 |
aNumber <= (FC_WEIGHT_EXTRALIGHT + FC_WEIGHT_LIGHT // 2) ifTrue:[ |
|
7121 | 526 |
face := #extralight. |
527 |
^ self. |
|
6391 | 528 |
]. |
529 |
aNumber <= (FC_WEIGHT_LIGHT + FC_WEIGHT_BOOK // 2) ifTrue:[ |
|
7121 | 530 |
face := #light. |
531 |
^ self. |
|
6391 | 532 |
]. |
533 |
aNumber <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD // 2) ifTrue:[ |
|
7121 | 534 |
face := #medium. |
535 |
^ self. |
|
6391 | 536 |
]. |
537 |
aNumber <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD // 2) ifTrue:[ |
|
7121 | 538 |
face := #demibold. |
539 |
^ self. |
|
6391 | 540 |
]. |
541 |
aNumber <= (FC_WEIGHT_BOLD + FC_WEIGHT_BLACK // 2) ifTrue:[ |
|
7121 | 542 |
face := #bold. |
543 |
^ self. |
|
6391 | 544 |
]. |
7121 | 545 |
face := #extrabold. |
6391 | 546 |
^ self |
547 |
||
548 |
"/ FC_WEIGHT_THIN := 0. |
|
549 |
"/ FC_WEIGHT_EXTRALIGHT := 40. |
|
550 |
"/ FC_WEIGHT_ULTRALIGHT := FC_WEIGHT_EXTRALIGHT. |
|
551 |
"/ FC_WEIGHT_LIGHT := 50. |
|
552 |
"/ FC_WEIGHT_BOOK := 75. |
|
553 |
"/ FC_WEIGHT_REGULAR := 80. |
|
554 |
"/ FC_WEIGHT_NORMAL := FC_WEIGHT_REGULAR. |
|
555 |
"/ FC_WEIGHT_MEDIUM := 100. |
|
556 |
"/ FC_WEIGHT_DEMIBOLD := 180. |
|
557 |
"/ FC_WEIGHT_SEMIBOLD := FC_WEIGHT_DEMIBOLD. |
|
558 |
"/ FC_WEIGHT_BOLD := 200. |
|
559 |
"/ FC_WEIGHT_EXTRABOLD := 205. |
|
560 |
"/ FC_WEIGHT_ULTRABOLD := FC_WEIGHT_EXTRABOLD. |
|
561 |
"/ FC_WEIGHT_BLACK := 210. |
|
562 |
"/ FC_WEIGHT_HEAVY := FC_WEIGHT_BLACK. |
|
563 |
"/ FC_WEIGHT_EXTRABLACK := 215. |
|
564 |
"/ FC_WEIGHT_ULTRABLACK := FC_WEIGHT_EXTRABLACK. |
|
6317 | 565 |
! ! |
566 |
||
567 |
!XftFontDescription methodsFor:'accessing-private'! |
|
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
568 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
569 |
getFontId |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
570 |
^ fontId |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
571 |
|
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
572 |
"Created: / 02-01-2014 / 23:29:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7114 | 573 |
! |
574 |
||
575 |
setFontId:fontIdArg |
|
576 |
fontId := fontIdArg. |
|
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
577 |
! ! |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
578 |
|
6936 | 579 |
!XftFontDescription methodsFor:'change & update'! |
580 |
||
581 |
update:anAspect with:something from:changedObject |
|
582 |
"I want to be informed when a view that printed something with me is destroyed. |
|
583 |
Disassociate the view from the XFT drawable" |
|
584 |
||
585 |
|drawableId| |
|
586 |
||
587 |
anAspect == #aboutToDestroy ifTrue:[ |
|
588 |
drawableId := changedObject drawableId. |
|
7114 | 589 |
(sharedDrawId notNil and:[drawableId notNil]) ifTrue:[ |
590 |
sharedDrawId disassociateFrom:drawableId. |
|
6936 | 591 |
]. |
592 |
changedObject removeDependent:self. |
|
593 |
]. |
|
594 |
! ! |
|
595 |
||
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
596 |
!XftFontDescription methodsFor:'converting'! |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
597 |
|
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
598 |
asNonXftFont |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
599 |
|newFont| |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
600 |
|
6656 | 601 |
newFont := FontDescription |
602 |
family:family |
|
603 |
face:face |
|
604 |
style:style |
|
605 |
size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) |
|
606 |
sizeUnit:sizeUnit |
|
607 |
encoding:encoding. |
|
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
608 |
|
6656 | 609 |
^ newFont |
6587
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
610 |
! ! |
c1790bb9af59
In case of not configured but installed Xft Fonts convert XftFonts
ab
parents:
6544
diff
changeset
|
611 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
612 |
!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
|
613 |
|
6351 | 614 |
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
|
615 |
"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
|
616 |
|
6707 | 617 |
|index2 bytesPerCharacter transformation |
7061 | 618 |
clipOrg clipCorn clipRect clipX clipY clipW clipH clipPnt |
6707 | 619 |
fg fgR fgG fgB fgA fgPixel bg bgR bgG bgB bgA bgPixel |
7114 | 620 |
drawX drawY drawPnt displayId screen drawableId error stringLen |
7075 | 621 |
newXftDrawId newDrawableAssociation pixmapDepth| |
6193 | 622 |
|
6351 | 623 |
"limit the string len, otherwise bad output is generated" |
6477 | 624 |
stringLen := index2Arg - index1 + 1. |
6351 | 625 |
stringLen > 8000 ifTrue:[ |
7115 | 626 |
index2 := index1 + 8000 - 1. |
6351 | 627 |
] ifFalse:[ |
7115 | 628 |
stringLen <= 0 ifTrue:[^ self]. |
629 |
index2 := index2Arg. |
|
6351 | 630 |
]. |
6209 | 631 |
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
|
632 |
|
7061 | 633 |
clipRect := aGC deviceClippingRectangle. |
7050 | 634 |
clipRect notNil ifTrue:[ |
7115 | 635 |
clipX := clipRect left. |
636 |
clipY := clipRect top. |
|
637 |
clipW := clipRect width. |
|
638 |
clipH := clipRect height. |
|
6489 | 639 |
]. |
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
|
640 |
|
7061 | 641 |
transformation := aGC transformation. |
6356 | 642 |
transformation isNil ifTrue:[ |
7115 | 643 |
drawX := xArg. |
644 |
drawY := yArg. |
|
6356 | 645 |
] ifFalse:[ |
7115 | 646 |
drawPnt := transformation transformPoint:(xArg @ yArg). |
647 |
drawX := drawPnt x ceiling. |
|
648 |
drawY := drawPnt y ceiling. |
|
6356 | 649 |
]. |
650 |
||
7068 | 651 |
fg := aGC paint. |
652 |
fgR := fg scaledRed. |
|
653 |
fgG := fg scaledGreen. |
|
654 |
fgB := fg scaledBlue. |
|
655 |
fgA := fg scaledAlpha. |
|
656 |
||
6263 | 657 |
fgR isNil ifTrue:[ |
7115 | 658 |
"/ when drawing into a pixmap... |
659 |
fgPixel := fg colorId. |
|
660 |
fgPixel == 0 ifTrue:[ |
|
661 |
fgR := fgG := fgB := 0. |
|
662 |
] ifFalse:[ |
|
663 |
fgR := fgG := fgB := 16rFFFF. |
|
664 |
] |
|
6263 | 665 |
]. |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
666 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
667 |
opaque ifTrue:[ |
7115 | 668 |
bg := aGC backgroundPaint. |
669 |
bg isColor ifTrue:[ |
|
670 |
bgR := bg scaledRed. |
|
671 |
bgG := bg scaledGreen. |
|
672 |
bgB := bg scaledBlue. |
|
673 |
bgA := bg scaledAlpha. |
|
674 |
] ifFalse:[ |
|
675 |
"images are not yet implemented" |
|
676 |
"/ #todo: fill background rectangle |
|
677 |
bgR := bgG := bgB := bgA := 16rFFFF. |
|
678 |
]. |
|
679 |
bgR isNil ifTrue:[ |
|
680 |
"/ when drawing into a pixmap... |
|
681 |
bgPixel := bg colorId. |
|
682 |
bgPixel == 0 ifTrue:[ |
|
683 |
bgR := bgG := bgB := 0. |
|
684 |
] ifFalse:[ |
|
685 |
bgR := bgG := bgB := 16rFFFF. |
|
686 |
] |
|
687 |
]. |
|
6193 | 688 |
]. |
6333 | 689 |
displayId := device displayIdOrErrorIfBroken. |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
690 |
displayId isNil ifTrue:[ |
7115 | 691 |
^ self. |
6333 | 692 |
]. |
6193 | 693 |
screen := device screen. |
6351 | 694 |
drawableId := aGC drawableId. |
7075 | 695 |
aGC isForm ifTrue:[ |
7115 | 696 |
pixmapDepth := aGC depth. |
7075 | 697 |
]. |
6209 | 698 |
|
7115 | 699 |
%{ /* STACK: 64000 */ |
6193 | 700 |
#ifdef XFT |
701 |
XftColor color; |
|
702 |
XGlyphInfo extents; |
|
703 |
XRectangle clipRX; |
|
6936 | 704 |
char *string; |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
705 |
int len; |
6209 | 706 |
int __bytesPerCharacter; |
6936 | 707 |
XftDraw *__sharedDrawId; |
708 |
XftFont *__xftFont = XFT_FONT(__INST(fontId)); |
|
6193 | 709 |
|
6209 | 710 |
if (!(__bothSmallInteger(drawX, drawY) |
7115 | 711 |
&& __bothSmallInteger(index1, index2) |
712 |
&& __isSmallInteger(bytesPerCharacter) |
|
713 |
&& (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA))) |
|
714 |
&& (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA))) |
|
715 |
&& __isNonNilObject(aString) |
|
6209 | 716 |
)) { |
7115 | 717 |
error = @symbol(badArgument); |
718 |
goto out; |
|
6209 | 719 |
} |
720 |
||
721 |
__bytesPerCharacter = __intVal(bytesPerCharacter); |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
722 |
|
7075 | 723 |
if (pixmapDepth != nil) { |
7115 | 724 |
int __pixmapDepth = __intVal(pixmapDepth); |
7075 | 725 |
|
7115 | 726 |
if (__pixmapDepth == 1) { |
727 |
__sharedDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(drawableId)); |
|
728 |
} else { |
|
729 |
__sharedDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(drawableId), __pixmapDepth); |
|
730 |
} |
|
7069 | 731 |
} else { |
7115 | 732 |
if (__INST(sharedDrawId) == nil) { |
733 |
__sharedDrawId = XftDrawCreate(DISPLAY(displayId), |
|
734 |
DRAWABLE(drawableId), |
|
735 |
DefaultVisual(DISPLAY(displayId), SCREEN(screen)), |
|
736 |
DefaultColormap(DISPLAY(displayId), SCREEN(screen))); |
|
737 |
__INST(sharedDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__sharedDrawId); |
|
738 |
__STORE(self, __INST(sharedDrawId)); |
|
739 |
} else if (XftDrawDrawable(__sharedDrawId = XFT_DRAW(__INST(sharedDrawId))) != DRAWABLE(drawableId)) { |
|
740 |
XftDrawChange(__sharedDrawId, DRAWABLE(drawableId)); |
|
741 |
} |
|
6193 | 742 |
} |
743 |
||
6936 | 744 |
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
|
745 |
len = __intVal(index2) - __intVal(index1) + 1; |
6193 | 746 |
|
7050 | 747 |
if (clipRect != nil) { |
7115 | 748 |
clipRX.x = __intVal(clipX); |
749 |
clipRX.y = __intVal(clipY); |
|
750 |
clipRX.width = __intVal(clipW); |
|
751 |
clipRX.height = __intVal(clipH); |
|
752 |
XftDrawSetClipRectangles(__sharedDrawId, 0, 0, &clipRX, 1); |
|
6193 | 753 |
} else { |
7115 | 754 |
XftDrawSetClip(__sharedDrawId, 0); |
6193 | 755 |
} |
756 |
||
6223 | 757 |
if (opaque == true) { |
7115 | 758 |
if (bgPixel != nil) { |
759 |
color.pixel = (unsigned long)__intVal(bgPixel); |
|
760 |
} |
|
761 |
color.color.red = __intVal(bgR); |
|
762 |
color.color.green = __intVal(bgG); |
|
763 |
color.color.blue = __intVal(bgB); |
|
764 |
color.color.alpha = __intVal(bgA); |
|
7068 | 765 |
|
7115 | 766 |
switch (__bytesPerCharacter) { |
767 |
case 1: |
|
768 |
XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents); |
|
769 |
break; |
|
770 |
case 2: |
|
771 |
XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents); |
|
772 |
break; |
|
773 |
case 4: |
|
774 |
XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents); |
|
775 |
break; |
|
776 |
} |
|
777 |
XftDrawRect(__sharedDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height); |
|
6193 | 778 |
} |
6223 | 779 |
if (fgPixel != nil) { |
7115 | 780 |
color.pixel = (unsigned long)__intVal(fgPixel); |
6223 | 781 |
} |
7068 | 782 |
color.color.red = __intVal(fgR); |
783 |
color.color.green = __intVal(fgG); |
|
784 |
color.color.blue = __intVal(fgB); |
|
785 |
color.color.alpha = __intVal(fgA); |
|
786 |
||
6209 | 787 |
switch (__bytesPerCharacter) { |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
788 |
case 1: |
7115 | 789 |
XftDrawString8(__sharedDrawId, &color,__xftFont, |
790 |
__intVal(drawX), |
|
791 |
__intVal(drawY), |
|
792 |
(FcChar8*)string, |
|
793 |
len); |
|
794 |
break; |
|
6936 | 795 |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
796 |
case 2: |
7115 | 797 |
XftDrawString16(__sharedDrawId, &color, __xftFont, |
798 |
__intVal(drawX), |
|
799 |
__intVal(drawY), |
|
800 |
(FcChar16*)string, |
|
801 |
len); |
|
802 |
break; |
|
6936 | 803 |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
804 |
case 4: |
7115 | 805 |
XftDrawString32(__sharedDrawId, &color, __xftFont, |
806 |
__intVal(drawX), |
|
807 |
__intVal(drawY), |
|
808 |
(FcChar32*)string, |
|
809 |
len); |
|
810 |
break; |
|
6936 | 811 |
|
812 |
default: |
|
7115 | 813 |
error = @symbol(invalidStringSize); |
814 |
goto out; |
|
6193 | 815 |
} |
6936 | 816 |
|
7075 | 817 |
if (pixmapDepth != nil) { |
7115 | 818 |
XftDrawDestroy(__sharedDrawId); |
7070 | 819 |
} |
820 |
||
6936 | 821 |
# if 0 // this has been superseeded by receiving change messages on view destroy |
822 |
// Have to disassociate the drawableId - otherwise we get an X11 error 'RenderBadPicture (invalid Picture parameter)' |
|
823 |
// when the drawable (the window) is destroyed. |
|
824 |
XftDrawChange(__sharedDrawId, None); |
|
825 |
# endif |
|
6946 | 826 |
out:; |
6193 | 827 |
#endif |
828 |
%}. |
|
6946 | 829 |
error notNil ifTrue:[ |
7115 | 830 |
self primitiveFailed: error. |
6946 | 831 |
]. |
6957 | 832 |
newXftDrawId notNil ifTrue:[ |
7115 | 833 |
Lobby register:self. |
6946 | 834 |
]. |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
835 |
"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
|
836 |
"Modified: / 10-01-2014 / 11:13:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6176 | 837 |
! ! |
838 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
839 |
!XftFontDescription methodsFor:'error reporting'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
840 |
|
6198 | 841 |
primitiveFailed |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
842 |
<resource: #skipInDebuggersWalkBack> |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
843 |
|
6936 | 844 |
self class xftAvailable ifFalse:[ |
7114 | 845 |
super primitiveFailed:'Xft support is not configured'. |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
846 |
]. |
6198 | 847 |
super primitiveFailed |
848 |
! |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
849 |
|
6198 | 850 |
primitiveFailed:errorString |
851 |
<resource: #skipInDebuggersWalkBack> |
|
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
852 |
|
6936 | 853 |
self class xftAvailable ifFalse:[ |
7114 | 854 |
super primitiveFailed:'Xft support is not configured'. |
6876
b1aa2b47d252
avoid ifdefs around smalltalk statements
Claus Gittinger <cg@exept.de>
parents:
6833
diff
changeset
|
855 |
]. |
6198 | 856 |
super primitiveFailed:errorString |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
857 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
858 |
|
6946 | 859 |
!XftFontDescription methodsFor:'finalization'! |
860 |
||
861 |
finalizationLobby |
|
862 |
^ Lobby |
|
863 |
! |
|
864 |
||
865 |
finalize |
|
7114 | 866 |
sharedDrawId notNil ifTrue:[ |
867 |
sharedDrawId destroy. |
|
868 |
sharedDrawId := nil. |
|
869 |
]. |
|
6946 | 870 |
! ! |
871 |
||
6176 | 872 |
!XftFontDescription methodsFor:'getting a device font'! |
873 |
||
874 |
onDevice:aGraphicsDevice |
|
875 |
"Create a new XftFont representing the closes font as |
|
876 |
myself on aDevice; if one already exists, return the one." |
|
877 |
||
7114 | 878 |
^ self onDevice:aGraphicsDevice ifAbsent:nil |
879 |
! |
|
880 |
||
881 |
onDevice:aGraphicsDevice ifAbsent:aBlock |
|
882 |
"Create a new XftFont representing the closes font as |
|
883 |
myself on aDevice; if one already exists, return the one." |
|
6176 | 884 |
|
7121 | 885 |
|displayId myPatternHandle closestPatternHandle newFontId computedWeight| |
6176 | 886 |
|
7114 | 887 |
(device == aGraphicsDevice) ifTrue:[ |
888 |
"I am already assigned to that device ..." |
|
889 |
^ self |
|
890 |
]. |
|
891 |
aGraphicsDevice isNil ifTrue:[ |
|
6974 | 892 |
^ self |
6544 | 893 |
]. |
7121 | 894 |
aGraphicsDevice supportsXftFonts ifFalse:[ |
7114 | 895 |
^ super onDevice:aGraphicsDevice ifAbsent:aBlock. |
6190
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
896 |
]. |
d651313d4044
Fixes to share XftFontDescription instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6189
diff
changeset
|
897 |
|
6389 | 898 |
RecentlyUsedFonts isNil ifTrue:[ |
6974 | 899 |
RecentlyUsedFonts := OrderedCollection new:20. |
6389 | 900 |
]. |
901 |
||
902 |
RecentlyUsedFonts keysAndValuesDo:[:index :aFont | |
|
6974 | 903 |
((aFont class == self class) and:[(self sameDeviceFontAs:aFont) and:[aFont getFontId notNil]]) ifTrue:[ |
904 |
"/ Transcript showCR:'hit'. |
|
7114 | 905 |
RecentlyUsedFonts |
6974 | 906 |
removeIndex:index; |
907 |
addFirst:aFont. |
|
908 |
^ aFont |
|
909 |
] |
|
6389 | 910 |
]. |
911 |
||
6974 | 912 |
RecentlyUsedFonts size >= 20 ifTrue:[ |
913 |
RecentlyUsedFonts removeLast. |
|
6389 | 914 |
]. |
915 |
||
6176 | 916 |
aGraphicsDevice deviceFonts do:[:aFont | |
6974 | 917 |
((aFont class == self class) and:[self sameDeviceFontAs:aFont]) ifTrue:[ |
918 |
RecentlyUsedFonts addFirst:aFont. |
|
919 |
^ aFont |
|
920 |
]. |
|
6176 | 921 |
]. |
922 |
||
7114 | 923 |
"/ ^ self asNonXftFont onDevice:aGraphicsDevice. |
7121 | 924 |
|
925 |
computedWeight := weight. |
|
926 |
computedWeight isNil ifTrue:[ |
|
927 |
computedWeight := StXFace2FCWeightMap at:(face ? '') asLowercase ifAbsent:[FC_WEIGHT_REGULAR]. |
|
928 |
]. |
|
929 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
930 |
[ |
7114 | 931 |
myPatternHandle := FCPatternHandle create. |
932 |
myPatternHandle |
|
7121 | 933 |
add:FC_FOUNDRY value:manufacturer; |
7114 | 934 |
add:FC_FAMILY value:family; |
7121 | 935 |
add:FC_WEIGHT value:computedWeight; |
936 |
add:FC_SLANT value:(StXStyle2FCSlantMap at:(style ? '') asLowercase ifAbsent:[FC_SLANT_ROMAN]). |
|
6974 | 937 |
sizeUnit = #px ifTrue:[ |
7114 | 938 |
myPatternHandle add:FC_PIXEL_SIZE value:(pixelSize isNil ifTrue:[nil] ifFalse:[pixelSize rounded]). |
6974 | 939 |
] ifFalse:[ |
7114 | 940 |
myPatternHandle add:FC_SIZE value:(size isNil ifTrue:[nil] ifFalse:[size rounded]). |
941 |
]. |
|
942 |
||
943 |
displayId := aGraphicsDevice displayId. |
|
6389 | 944 |
|
7114 | 945 |
closestPatternHandle := myPatternHandle matchFontOnDisplayId:displayId screen:aGraphicsDevice screen. |
946 |
closestPatternHandle notNil ifTrue:[ |
|
947 |
newFontId := closestPatternHandle getFontOnDisplayId:displayId. |
|
948 |
newFontId notNil ifTrue:[ |
|
949 |
"/ Good, this font exists!! |
|
950 |
closestPatternHandle := nil. |
|
951 |
fontId := newFontId. |
|
952 |
device := aGraphicsDevice. |
|
953 |
aGraphicsDevice registerFont:self. |
|
954 |
RecentlyUsedFonts addFirst:self. |
|
955 |
^ self. |
|
6974 | 956 |
]. |
957 |
]. |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
958 |
] ensure:[ |
7114 | 959 |
myPatternHandle notNil ifTrue:[myPatternHandle destroy]. |
960 |
closestPatternHandle notNil ifTrue:[closestPatternHandle destroy]. |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
961 |
]. |
7114 | 962 |
^ aBlock value |
6176 | 963 |
|
964 |
" |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
965 |
(XftFontDescription family:'monospace' size:16) onDevice:Screen current |
6176 | 966 |
" |
967 |
||
968 |
"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
|
969 |
"Modified: / 02-01-2014 / 23:43:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6176 | 970 |
! ! |
971 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
972 |
!XftFontDescription methodsFor:'initialization'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
973 |
|
6963 | 974 |
initialize |
975 |
"Invoked when a new instance is created." |
|
976 |
||
977 |
super initialize. |
|
978 |
size := 0. |
|
979 |
encoding := #'iso10646-1'. |
|
980 |
! |
|
981 |
||
6993 | 982 |
isScaledFont |
983 |
^ true |
|
984 |
! |
|
985 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
986 |
setDevice: deviceArg patternId: patternIdArg fontId: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
987 |
device := deviceArg. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
988 |
fontId := fontIdArg. |
6325 | 989 |
patternIdArg notNil ifTrue:[ |
7114 | 990 |
family := patternIdArg get: FC_FAMILY index: 0. |
991 |
size := patternIdArg get: FC_SIZE index: 0. |
|
992 |
face := patternIdArg get: FC_WEIGHT index: 0. |
|
993 |
face := StXFace2FCWeightMap keyAtValue: face. |
|
994 |
style := patternIdArg get: FC_SLANT index: 0. |
|
995 |
style := StXStyle2FCSlantMap keyAtValue: style. |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
996 |
|
7114 | 997 |
"/ name:= patternIdArg get: 'fullname' index: 0. |
998 |
"/ encoding:= patternIdArg get: 'encoding' index: 0. |
|
6957 | 999 |
]. |
1000 |
size isNil ifTrue:[ |
|
7114 | 1001 |
size := 0. |
6325 | 1002 |
]. |
6963 | 1003 |
encoding isNil ifTrue:[ |
7114 | 1004 |
encoding := #'iso10646-1'. |
6963 | 1005 |
]. |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1006 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1007 |
"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
|
1008 |
"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
|
1009 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1010 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1011 |
!XftFontDescription methodsFor:'primitives'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1012 |
|
7114 | 1013 |
xftFontClose:fontIdArg displayId:displayId |
6936 | 1014 |
| error | |
1015 |
||
7114 | 1016 |
%{ /* STACK: 64000 */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1017 |
#ifdef XFT |
7114 | 1018 |
int v; |
1019 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
|
1020 |
error = @symbol(BadArg1); |
|
6936 | 1021 |
goto err; |
1022 |
} |
|
7114 | 1023 |
if ( ! __isExternalAddressLike(displayId) ) { |
1024 |
error = @symbol(BadArg2); |
|
1025 |
goto err; |
|
6936 | 1026 |
} |
7114 | 1027 |
XftFontClose (DISPLAY(displayId), XFT_FONT(fontIdArg)); |
6936 | 1028 |
RETURN(self); |
1029 |
err:; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1030 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1031 |
%}. |
6936 | 1032 |
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
|
1033 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1034 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1035 |
xftFontGetAscent: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1036 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1037 |
|
7114 | 1038 |
%{ /* STACK: 64000 */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1039 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1040 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1041 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7114 | 1042 |
error = @symbol(BadArg1); |
1043 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1044 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1045 |
v = XFT_FONT(fontIdArg)->ascent; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1046 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1047 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1048 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1049 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1050 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1051 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1052 |
"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
|
1053 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1054 |
|
6198 | 1055 |
xftFontGetDescent:fontIdArg |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1056 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1057 |
|
7114 | 1058 |
%{ /* STACK: 64000 */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1059 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1060 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1061 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7114 | 1062 |
error = @symbol(BadArg1); |
1063 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1064 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1065 |
v = XFT_FONT(fontIdArg)->descent; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1066 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1067 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1068 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1069 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1070 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1071 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1072 |
"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
|
1073 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1074 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1075 |
xftFontGetHeight: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1076 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1077 |
|
7114 | 1078 |
%{ /* STACK: 64000 */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1079 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1080 |
int v; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1081 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7114 | 1082 |
error = @symbol(BadArg1); |
1083 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1084 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1085 |
v = XFT_FONT(fontIdArg)->height; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1086 |
RETURN ( __MKINT( v ) ); |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1087 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1088 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1089 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1090 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1091 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1092 |
"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
|
1093 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1094 |
|
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
|
1095 |
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
|
1096 |
| 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
|
1097 |
|
7114 | 1098 |
%{ /* 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
|
1099 |
#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
|
1100 |
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
|
1101 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7114 | 1102 |
error = @symbol(BadArg1); |
1103 |
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
|
1104 |
} |
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 |
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
|
1106 |
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
|
1107 |
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
|
1108 |
#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
|
1109 |
%}. |
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
|
1110 |
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
|
1111 |
|
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
|
1112 |
"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
|
1113 |
! |
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
|
1114 |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1115 |
xftFontGetPattern: fontIdArg |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1116 |
| error | |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1117 |
|
7114 | 1118 |
%{ /* STACK: 64000 */ |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1119 |
#ifdef XFT |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1120 |
XftPattern* p; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1121 |
if ( ! __isExternalAddressLike(fontIdArg) ) { |
7114 | 1122 |
error = @symbol(BadArg1); |
1123 |
goto err; |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1124 |
} |
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1125 |
p = XFT_FONT(fontIdArg)->pattern; |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1126 |
if (p == NULL) { |
7114 | 1127 |
RETURN ( nil ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1128 |
} else { |
7114 | 1129 |
RETURN ( FC_PATTERN_HANDLE_NEW ( p ) ); |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1130 |
} |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1131 |
err:; |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1132 |
#endif |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1133 |
%}. |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1134 |
self primitiveFailed: error |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1135 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1136 |
"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
|
1137 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1138 |
|
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1139 |
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
|
1140 |
| 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
|
1141 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1142 |
extents := Array new: 6. |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1143 |
bitsPerCharacter := text bitsPerCharacter. |
7114 | 1144 |
|
1145 |
%{ /* 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
|
1146 |
#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
|
1147 |
XGlyphInfo info; |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1148 |
char *string; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1149 |
int len; |
7114 | 1150 |
int bytesPerCharacter = __intVal(bitsPerCharacter) / 8; |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1151 |
|
6182
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 ( ! __isExternalAddressLike(displayIdArg) ) { |
7114 | 1153 |
error = @symbol(BadArg1); |
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 ( ! __isExternalAddressLike(fontIdArg) ) { |
7114 | 1157 |
error = @symbol(BadArg2); |
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 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1160 |
if ( ! __isSmallInteger(start) ) { |
7114 | 1161 |
error = @symbol(BadArg4); |
1162 |
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
|
1163 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1164 |
if ( ! __isSmallInteger(stop) ) { |
7114 | 1165 |
error = @symbol(BadArg5); |
1166 |
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
|
1167 |
} |
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1168 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1169 |
string = __stringVal( text ) + (( __intVal(start) - 1 ) * bytesPerCharacter); |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1170 |
len = __intVal(stop) - __intVal(start) + 1; |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1171 |
|
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1172 |
switch (bytesPerCharacter) { |
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1173 |
case 1: |
7114 | 1174 |
XftTextExtents8(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar8*)string, len, &info); |
1175 |
break; |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1176 |
case 2: |
7114 | 1177 |
XftTextExtents16(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar16*)string, len, &info); |
1178 |
break; |
|
6195
9a14f8e6c10c
Added support for wide strings.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6194
diff
changeset
|
1179 |
case 4: |
7114 | 1180 |
XftTextExtents32(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar32*)string, len, &info); |
1181 |
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
|
1182 |
} |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1183 |
__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
|
1184 |
__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
|
1185 |
__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
|
1186 |
__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
|
1187 |
__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
|
1188 |
__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
|
1189 |
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
|
1190 |
err:; |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1191 |
#endif |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1192 |
%}. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1193 |
error notNil ifTrue:[ |
7114 | 1194 |
self primitiveFailed: error. |
1195 |
^ 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
|
1196 |
]. |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1197 |
^ extents |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1198 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1199 |
"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
|
1200 |
"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
|
1201 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1202 |
|
6198 | 1203 |
!XftFontDescription methodsFor:'printing & storing'! |
1204 |
||
1205 |
storeOn:aStream |
|
1206 |
"append a character sequence to the argument, aStream from which the |
|
1207 |
receiver can be reconstructed using readFrom:." |
|
1208 |
||
1209 |
aStream nextPutAll:'(XftFontDescription family:'. family storeOn:aStream. |
|
1210 |
aStream nextPutAll:' face:'. face storeOn:aStream. |
|
1211 |
aStream nextPutAll:' style:'. style storeOn:aStream. |
|
1212 |
aStream nextPutAll:' size:'. size storeOn:aStream. |
|
1213 |
aStream nextPutAll:' encoding:'. encoding storeOn:aStream. |
|
1214 |
aStream nextPut:$) |
|
1215 |
||
1216 |
" |
|
1217 |
(XftFontDescription family: 'DejaVu Sans' size: 8) storeString |
|
1218 |
" |
|
1219 |
! ! |
|
1220 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1221 |
!XftFontDescription methodsFor:'queries-dimensions'! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1222 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1223 |
ascent |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1224 |
"return the ascent - the number of pixels above the baseLine." |
6656 | 1225 |
ascent isNil ifTrue:[ |
6707 | 1226 |
ascent := self xftFontGetAscent: fontId |
6656 | 1227 |
]. |
1228 |
^ ascent |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1229 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1230 |
"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
|
1231 |
! |
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 |
descent |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1234 |
"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
|
1235 |
|
6656 | 1236 |
descent isNil ifTrue:[ |
6707 | 1237 |
descent := self xftFontGetDescent: fontId |
6656 | 1238 |
]. |
1239 |
^ descent |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1240 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1241 |
"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
|
1242 |
! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1243 |
|
6314 | 1244 |
getFontMetrics |
1245 |
|info| |
|
1246 |
||
1247 |
info := DeviceWorkstation::DeviceFontMetrics new. |
|
1248 |
info |
|
1249 |
ascent:self ascent |
|
1250 |
descent:self descent |
|
1251 |
maxAscent:self maxAscent |
|
1252 |
maxDescent:self maxDescent |
|
1253 |
minWidth:self maxWidth |
|
1254 |
maxWidth:self maxWidth |
|
1255 |
avgWidth:self maxWidth |
|
1256 |
minCode:self minCode |
|
1257 |
maxCode:self maxCode |
|
1258 |
direction:#LeftToRight. |
|
1259 |
^ info |
|
1260 |
! |
|
1261 |
||
6543 | 1262 |
getFontResolution |
1263 |
device isNil ifTrue:[ ^ 72 @ 72 ]. |
|
1264 |
^ device resolution |
|
1265 |
! |
|
1266 |
||
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1267 |
height |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1268 |
"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
|
1269 |
|
6656 | 1270 |
height isNil ifTrue:[ |
6707 | 1271 |
height := self xftFontGetHeight: fontId |
6656 | 1272 |
]. |
1273 |
^ height |
|
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1274 |
|
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1275 |
"Created: / 21-12-2013 / 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
|
1276 |
! |
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 |
isFixedWidth |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1279 |
"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
|
1280 |
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
|
1281 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1282 |
^ 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
|
1283 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1284 |
"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
|
1285 |
! |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1286 |
|
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
|
1287 |
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
|
1288 |
"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
|
1289 |
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
|
1290 |
|
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 |
^ 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
|
1292 |
|
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 |
"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
|
1294 |
! |
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 |
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
|
1297 |
"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
|
1298 |
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
|
1299 |
|
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 |
^ 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
|
1301 |
|
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 |
"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
|
1303 |
! |
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 |
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
|
1306 |
"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
|
1307 |
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
|
1308 |
|
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
|
1309 |
^ 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
|
1310 |
|
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
|
1311 |
"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
|
1312 |
! |
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
|
1313 |
|
7114 | 1314 |
patternStringForId:patternIdArg |
1315 |
|name family size pixelSize face style encoding foundry width| |
|
1316 |
||
1317 |
patternIdArg notNil ifTrue:[ |
|
1318 |
foundry := patternIdArg get: FC_FOUNDRY index: 0. |
|
1319 |
family := patternIdArg get: FC_FAMILY index: 0. |
|
1320 |
size := patternIdArg get: FC_SIZE index: 0. |
|
1321 |
pixelSize := patternIdArg get: FC_PIXEL_SIZE index: 0. |
|
1322 |
face := patternIdArg get: FC_WEIGHT index: 0. |
|
1323 |
face := StXFace2FCWeightMap keyAtValue: face. |
|
1324 |
style := patternIdArg get: FC_SLANT index: 0. |
|
1325 |
style := StXStyle2FCSlantMap keyAtValue: style. |
|
1326 |
width := patternIdArg get: FC_WIDTH index: 0. |
|
1327 |
||
1328 |
name:= patternIdArg get: 'fullname' index: 0. |
|
1329 |
||
1330 |
encoding:= patternIdArg get: 'encoding' index: 0. |
|
1331 |
]. |
|
1332 |
||
1333 |
^ '%8-%1-%2-%3-%4pt/%5px-%6-%9 (%7)' bindWith:family with:face with:style with:size with:pixelSize with:encoding with:name |
|
1334 |
with:foundry with:width. |
|
1335 |
! |
|
1336 |
||
6182
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1337 |
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
|
1338 |
"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
|
1339 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1340 |
| extents | |
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1341 |
|
6187
cfe33a9940ee
Memory/performance optimization - use stack-allocated XftColor.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6186
diff
changeset
|
1342 |
(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
|
1343 |
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
|
1344 |
"/ 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
|
1345 |
^ 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
|
1346 |
|
8bf2372670d9
Fixes to make XftFontDescription>>example1 to render something. Sometimes it segfaults
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6180
diff
changeset
|
1347 |
"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
|
1348 |
"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
|
1349 |
! ! |
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
1350 |
|
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1351 |
!XftFontDescription methodsFor:'release'! |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1352 |
|
7114 | 1353 |
disassociateXftDrawableFrom:drawableId |
1354 |
"Disassociate the XftDrawable from drawableId. |
|
1355 |
This mist be done before the drawable is destroyed, |
|
1356 |
otherwise the XftDrawable is destroyed together with the drawable, |
|
1357 |
and X11 errors will be signaled." |
|
1358 |
||
1359 |
sharedDrawId notNil ifTrue:[ |
|
1360 |
sharedDrawId disassociateFrom:drawableId. |
|
1361 |
]. |
|
1362 |
! |
|
1363 |
||
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1364 |
releaseDrawIfAssociatedWith: view |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1365 |
| drawableId | |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1366 |
|
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1367 |
view isNil ifTrue:[ ^ self ]. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1368 |
drawableId := view id. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1369 |
drawableId isNil ifTrue: [ ^ self ]. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1370 |
%{ |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1371 |
#ifdef XFT |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1372 |
if ( __INST(sharedDrawId) != nil ) { |
6963 | 1373 |
XftDraw *xftDrawable = XFT_DRAW(__INST(sharedDrawId)); |
1374 |
||
1375 |
if (XftDrawDrawable(xftDrawable) == DRAWABLE(drawableId)) { |
|
6393 | 1376 |
__INST(sharedDrawId) = nil; |
6963 | 1377 |
XftDrawDestroy(xftDrawable); |
6393 | 1378 |
} |
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1379 |
} |
6339 | 1380 |
RETURN (self); |
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1381 |
#endif |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1382 |
%}. |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1383 |
self primitiveFailed |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1384 |
|
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1385 |
"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
|
1386 |
"Modified: / 12-01-2014 / 22:09:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6344 | 1387 |
! |
1388 |
||
1389 |
releaseFromDevice |
|
1390 |
"I am no longer available on the device" |
|
1391 |
||
6946 | 1392 |
Lobby unregister:self. |
7055 | 1393 |
"/ cg: no, xftDrawDestroy should not be done. |
1394 |
"/ (releaseFromDevice is called when either the display connection |
|
1395 |
"/ is lost, or a snapshot image is restarted) |
|
1396 |
"/ self xftDrawDestroy. |
|
6946 | 1397 |
|
6344 | 1398 |
device := nil. |
1399 |
fontId := nil. |
|
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1400 |
sharedDrawId := nil. |
6200
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1401 |
! ! |
8f0d25eec888
class: XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6199
diff
changeset
|
1402 |
|
6319 | 1403 |
!XftFontDescription methodsFor:'testing'! |
1404 |
||
6339 | 1405 |
isUsed |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1406 |
^ sharedDrawId notNil |
6339 | 1407 |
! |
1408 |
||
6319 | 1409 |
isXftFont |
1410 |
^ true |
|
1411 |
! ! |
|
1412 |
||
7116 | 1413 |
!XftFontDescription::FCFontListParser class methodsFor:'api'! |
1414 |
||
1415 |
listOfAvailableFonts |
|
1416 |
^ self new listOfAvailableFonts |
|
1417 |
||
1418 |
" |
|
1419 |
self listOfAvailableFonts |
|
1420 |
" |
|
1421 |
! ! |
|
1422 |
||
6264 | 1423 |
!XftFontDescription::FCFontListParser class methodsFor:'documentation'! |
1424 |
||
1425 |
documentation |
|
1426 |
" |
|
1427 |
parses fc-list output to get a list of XftFontDescriptions |
|
1428 |
||
1429 |
[author:] |
|
6319 | 1430 |
cg |
6264 | 1431 |
|
1432 |
[instance variables:] |
|
1433 |
||
1434 |
[class variables:] |
|
1435 |
||
1436 |
[see also:] |
|
1437 |
||
1438 |
" |
|
1439 |
! ! |
|
1440 |
||
6263 | 1441 |
!XftFontDescription::FCFontListParser methodsFor:'api'! |
1442 |
||
1443 |
listOfAvailableFonts |
|
7116 | 1444 |
|readEntry list fcListProg| |
6263 | 1445 |
|
1446 |
list := OrderedCollection new. |
|
1447 |
||
7116 | 1448 |
readEntry := [ |
1449 |
|key line| |
|
6263 | 1450 |
|
7116 | 1451 |
[ |
1452 |
line := pipeStream nextLine. |
|
1453 |
] doUntil:[(line startsWith:'Pattern has') or:[Transcript showCR:line. false]]. |
|
6263 | 1454 |
|
7116 | 1455 |
currentDescription := XftFontDescription new. |
1456 |
[line := pipeStream nextLine. line notEmptyOrNil] whileTrue:[ |
|
1457 |
"/ Transcript showCR:l. |
|
1458 |
lineStream := line readStream. lineStream skipSeparators. |
|
1459 |
key := ('fc_', (lineStream upTo:$:)) asSymbolIfInterned. |
|
1460 |
( |
|
1461 |
#(fc_family fc_style fc_slant fc_weight fc_width |
|
1462 |
fc_pixelsize fc_spacing fc_foundry fc_antialias |
|
1463 |
fc_file fc_outline fc_scalable fc_charset fc_lang |
|
1464 |
fc_fontversion fc_fontformat fc_decorative fc_index |
|
1465 |
fc_outline fc_familylang fc_stylelang fc_fullname |
|
1466 |
fc_fullnamelang fc_capability fc_hash fc_postscriptname |
|
1467 |
) includesIdentical:key |
|
1468 |
) ifTrue:[ |
|
1469 |
self perform:key. |
|
1470 |
] ifFalse:[ |
|
1471 |
Transcript show:'Xft ignored line: '; showCR:line. |
|
1472 |
]. |
|
1473 |
]. |
|
1474 |
list add:currentDescription |
|
1475 |
]. |
|
6319 | 1476 |
|
6337 | 1477 |
fcListProg := #('/usr/bin/fc-list' '/usr/X11/bin/fc-list') detect:[:eachProg| |
7116 | 1478 |
eachProg asFilename isExecutableProgram |
1479 |
] ifNone:[ |
|
1480 |
'XftFontDescription [warning]: fc-list program not found - no XFT fonts' errorPrintCR. |
|
1481 |
^ list. |
|
1482 |
]. |
|
6337 | 1483 |
|
1484 |
pipeStream := PipeStream readingFrom:fcListProg, ' -v'. |
|
6263 | 1485 |
[ |
7116 | 1486 |
[pipeStream atEnd] whileFalse:[ |
1487 |
readEntry value. |
|
1488 |
] |
|
6263 | 1489 |
] ensure:[ |
7116 | 1490 |
pipeStream close |
6263 | 1491 |
]. |
1492 |
^ list |
|
1493 |
||
1494 |
" |
|
6337 | 1495 |
FCFontListParser new listOfAvailableFonts |
6263 | 1496 |
" |
1497 |
! ! |
|
1498 |
||
1499 |
!XftFontDescription::FCFontListParser methodsFor:'font list keywords'! |
|
1500 |
||
1501 |
fc_antialias |
|
1502 |
"helper for font listing" |
|
1503 |
||
6319 | 1504 |
currentDescription isAntialiasedFont:(self getBoolean). |
6263 | 1505 |
! |
1506 |
||
6264 | 1507 |
fc_capability |
1508 |
"helper for font listing" |
|
1509 |
||
6319 | 1510 |
"currentDescription capability:" (self getString). |
6264 | 1511 |
! |
1512 |
||
6263 | 1513 |
fc_charset |
1514 |
"helper for font listing" |
|
1515 |
||
6319 | 1516 |
|page bits l min max minCode maxCode| |
6263 | 1517 |
|
1518 |
[ l := pipeStream nextLine. l notEmpty ] whileTrue:[ |
|
7116 | 1519 |
"/ Transcript show:'->'; showCR:l. |
1520 |
(l startsWith:Character tab) ifFalse:[ |
|
1521 |
(l startsWith:'(') ifFalse:[self halt]. |
|
1522 |
currentDescription minCode:minCode; maxCode:maxCode. |
|
1523 |
^ self. |
|
1524 |
]. |
|
6264 | 1525 |
|
7116 | 1526 |
lineStream := l readStream. |
1527 |
lineStream skipSeparators. |
|
1528 |
page := Integer readFrom:(lineStream upTo:$:) radix:16. |
|
1529 |
lineStream next. |
|
1530 |
bits := 0 to:7 collect:[:i| |
|
1531 |
lineStream skipSeparators. |
|
1532 |
Integer readFrom:(lineStream upToSeparator) radix:16. |
|
1533 |
]. |
|
1534 |
min := (page * 256 + 0). |
|
1535 |
max := (page * 256 + 255). |
|
1536 |
minCode isNil ifTrue:[ |
|
1537 |
minCode := min. |
|
1538 |
maxCode := max. |
|
1539 |
] ifFalse:[ |
|
1540 |
minCode := minCode min:min. |
|
1541 |
maxCode := maxCode max:max. |
|
1542 |
]. |
|
6263 | 1543 |
]. |
6365
cf89c4bedea4
Instvar drawId renamed to sharedDrawId.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6356
diff
changeset
|
1544 |
"/ currentDescription characterSet:(self getString). |
7116 | 1545 |
currentDescription minCode:minCode; maxCode:maxCode. |
6263 | 1546 |
! |
1547 |
||
6319 | 1548 |
fc_decorative |
6263 | 1549 |
"helper for font listing" |
1550 |
||
6319 | 1551 |
currentDescription isDecorativeFont:(self getBoolean). |
6263 | 1552 |
! |
1553 |
||
1554 |
fc_family |
|
1555 |
"helper for font listing" |
|
1556 |
||
6319 | 1557 |
currentDescription family:(self getString). |
6263 | 1558 |
! |
1559 |
||
1560 |
fc_familylang |
|
1561 |
"helper for font listing" |
|
1562 |
||
6319 | 1563 |
"currentDescription familylang:" (self getString). |
6263 | 1564 |
! |
1565 |
||
6319 | 1566 |
fc_file |
6263 | 1567 |
"helper for font listing" |
1568 |
||
6319 | 1569 |
currentDescription file:(self getString). |
6263 | 1570 |
! |
1571 |
||
1572 |
fc_fontformat |
|
1573 |
"helper for font listing" |
|
1574 |
||
6319 | 1575 |
currentDescription fontFormat:(self getString). |
6263 | 1576 |
! |
1577 |
||
1578 |
fc_fontversion |
|
1579 |
"helper for font listing" |
|
1580 |
||
6319 | 1581 |
currentDescription fontVersion:(self getInteger). |
6263 | 1582 |
! |
1583 |
||
1584 |
fc_foundry |
|
1585 |
"helper for font listing" |
|
1586 |
||
7121 | 1587 |
|foundry| |
1588 |
||
1589 |
foundry := self getString. |
|
1590 |
foundry ~= 'unknown' ifTrue:[ |
|
1591 |
currentDescription foundry:foundry. |
|
1592 |
]. |
|
6263 | 1593 |
! |
1594 |
||
6264 | 1595 |
fc_fullname |
1596 |
"helper for font listing" |
|
1597 |
||
7121 | 1598 |
currentDescription name:self getString. |
6264 | 1599 |
! |
1600 |
||
1601 |
fc_fullnamelang |
|
1602 |
"helper for font listing" |
|
1603 |
||
6319 | 1604 |
"currentDescription fullnamelang:" (self getString). |
6264 | 1605 |
! |
1606 |
||
6338 | 1607 |
fc_hash |
1608 |
"helper for font listing" |
|
1609 |
||
1610 |
"currentDescription hash:" self getString. |
|
1611 |
! |
|
1612 |
||
6264 | 1613 |
fc_index |
1614 |
"helper for font listing" |
|
1615 |
||
6319 | 1616 |
"currentDescription index:" (self getInteger). |
6264 | 1617 |
! |
1618 |
||
6263 | 1619 |
fc_lang |
1620 |
"helper for font listing" |
|
1621 |
||
6319 | 1622 |
"/ currentDescription characterSet:(self getString). |
6263 | 1623 |
! |
1624 |
||
1625 |
fc_outline |
|
1626 |
"helper for font listing" |
|
1627 |
||
6319 | 1628 |
currentDescription isOutlineFont:(self getBoolean). |
6263 | 1629 |
! |
1630 |
||
1631 |
fc_pixelsize |
|
1632 |
"helper for font listing" |
|
1633 |
||
6325 | 1634 |
currentDescription setPixelSize:(self getInteger). |
1635 |
currentDescription setSizeUnit:#px. |
|
1636 |
"/ currentDescription setSize:(self getInteger). |
|
1637 |
"/ currentDescription setSizeUnit:#pt. |
|
6263 | 1638 |
! |
1639 |
||
6338 | 1640 |
fc_postscriptname |
1641 |
"helper for font listing" |
|
1642 |
||
1643 |
"currentDescription postscriptname:" self getString. |
|
1644 |
! |
|
1645 |
||
6263 | 1646 |
fc_scalable |
1647 |
"helper for font listing" |
|
1648 |
||
6957 | 1649 |
currentDescription isScalableFont:self getBoolean. |
6263 | 1650 |
! |
1651 |
||
1652 |
fc_slant |
|
1653 |
"helper for font listing" |
|
1654 |
||
6319 | 1655 |
currentDescription slant:(self getInteger). |
6263 | 1656 |
! |
1657 |
||
1658 |
fc_spacing |
|
1659 |
"helper for font listing" |
|
1660 |
||
6319 | 1661 |
currentDescription spacing:(self getInteger). |
6263 | 1662 |
! |
1663 |
||
1664 |
fc_style |
|
1665 |
"helper for font listing" |
|
1666 |
||
6319 | 1667 |
|xftStyle| |
1668 |
||
7121 | 1669 |
xftStyle := self getString asLowercase. |
1670 |
(xftStyle includesString:'italic') ifTrue:[ |
|
1671 |
currentDescription style:#italic. |
|
1672 |
^ self. |
|
6319 | 1673 |
]. |
7121 | 1674 |
(xftStyle includesString:'oblique') ifTrue:[ |
1675 |
currentDescription style:#oblique. |
|
1676 |
^ self. |
|
1677 |
]. |
|
1678 |
currentDescription style:#roman. |
|
6263 | 1679 |
! |
1680 |
||
6264 | 1681 |
fc_stylelang |
1682 |
"helper for font listing" |
|
1683 |
||
6319 | 1684 |
"currentDescription stylelang:" (self getString). |
6264 | 1685 |
! |
1686 |
||
6263 | 1687 |
fc_weight |
1688 |
"helper for font listing" |
|
1689 |
||
6319 | 1690 |
currentDescription weight:(self getInteger). |
6263 | 1691 |
! |
1692 |
||
1693 |
fc_width |
|
1694 |
"helper for font listing" |
|
1695 |
||
6319 | 1696 |
currentDescription width:(self getInteger). |
6263 | 1697 |
! ! |
1698 |
||
1699 |
!XftFontDescription::FCFontListParser methodsFor:'helpers'! |
|
1700 |
||
6319 | 1701 |
getBoolean |
6263 | 1702 |
"helper for font listing" |
1703 |
||
1704 |
|s| |
|
1705 |
||
1706 |
lineStream skipSeparators. |
|
6319 | 1707 |
s := lineStream nextAlphaNumericWord. |
6957 | 1708 |
^ (s indexOfSubCollection:'True') ~~ 0. "/ match at least 'True' and 'FCTrue' |
6963 | 1709 |
|
1710 |
" |
|
7114 | 1711 |
'xxFalse' indexOfSubCollection:'True' |
1712 |
'FcTrue' indexOfSubCollection:'True' |
|
6963 | 1713 |
" |
6263 | 1714 |
! |
1715 |
||
6264 | 1716 |
getInteger |
1717 |
"helper for font listing" |
|
1718 |
||
1719 |
lineStream skipSeparators. |
|
6319 | 1720 |
^ Integer readFrom:lineStream. |
6264 | 1721 |
! |
1722 |
||
6319 | 1723 |
getString |
6263 | 1724 |
"helper for font listing" |
1725 |
||
7116 | 1726 |
lineStream skipThrough:$". |
1727 |
^ lineStream upTo:$". |
|
6263 | 1728 |
! ! |
1729 |
||
7114 | 1730 |
!XftFontDescription::FCPatternHandle class methodsFor:'instance creation'! |
1731 |
||
1732 |
create |
|
1733 |
^ self new create |
|
1734 |
||
1735 |
" |
|
1736 |
self new create destroy |
|
1737 |
" |
|
1738 |
! ! |
|
1739 |
||
1740 |
!XftFontDescription::FCPatternHandle methodsFor:'primitives'! |
|
1741 |
||
1742 |
add:attribute value: value |
|
1743 |
"Add a value to the specified pattern element after existing values" |
|
1744 |
||
1745 |
^ self add: attribute value: value append: true. |
|
1746 |
! |
|
1747 |
||
1748 |
add:attribute value: value append: append |
|
1749 |
"Add a value to the specified pattern element. If 'append' is true, the value |
|
1750 |
is added after existing values, otherwise it is added before them." |
|
1751 |
||
1752 |
| error | |
|
1753 |
||
1754 |
%{ |
|
1755 |
#ifdef XFT |
|
1756 |
XftValue v; |
|
1757 |
Bool b; |
|
1758 |
||
1759 |
if (__INST(address_) == 0) { |
|
1760 |
error = @symbol(NullReceiver); |
|
1761 |
goto err; |
|
1762 |
} |
|
1763 |
if ( ! __isStringLike ( attribute ) ) { |
|
1764 |
error = @symbol(BadArg1); |
|
1765 |
goto err; |
|
1766 |
} |
|
1767 |
if ( append != true && append != false ) { |
|
1768 |
error = @symbol(BadArg3); |
|
1769 |
goto err; |
|
1770 |
} |
|
1771 |
if ( __isStringLike ( value ) ) { |
|
1772 |
v.type = FcTypeString; |
|
1773 |
/* Passing pointer inside Smalltalk should be safe, |
|
1774 |
* Xft/FontConfig libraries seem to allocate and store |
|
1775 |
* a __copy__ of the string (if I understood the code correctly) |
|
1776 |
*/ |
|
1777 |
v.u.s = __stringVal( value); |
|
1778 |
} else if ( __isSmallInteger( value ) ) { |
|
1779 |
v.type = XftTypeInteger; |
|
1780 |
v.u.i = (int)__intVal( value ); |
|
1781 |
} else if ( value == true || value == false ) { |
|
1782 |
v.type = XftTypeBool; |
|
1783 |
v.u.b = value == true ? True : False; |
|
1784 |
} else if ( __isFloat ( value ) ) { |
|
1785 |
v.type = XftTypeDouble; |
|
1786 |
v.u.d = __floatVal( value ); |
|
1787 |
} else if ( value == nil ) { |
|
1788 |
v.type = XftTypeVoid; |
|
1789 |
v.u.f = NULL; |
|
1790 |
} else { |
|
1791 |
error = @symbol(BadArg2); |
|
1792 |
goto err; |
|
1793 |
} |
|
1794 |
b = XftPatternAdd((XftPattern*)__INST(address_), __stringVal(attribute), v, append == true ? True : False ); |
|
1795 |
RETURN ( b == True ? true : false ); |
|
1796 |
||
1797 |
err:; |
|
1798 |
#endif |
|
1799 |
%}. |
|
1800 |
self primitiveFailed: error |
|
1801 |
||
1802 |
"Created: / 20-12-2013 / 21:50:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1803 |
! |
|
1804 |
||
1805 |
create |
|
1806 |
%{ |
|
1807 |
#ifdef XFT |
|
1808 |
__INST(address_) = (void *)XftPatternCreate(); |
|
1809 |
#endif |
|
1810 |
%}. |
|
1811 |
! |
|
1812 |
||
1813 |
delete: pattern attribute: attribute |
|
1814 |
| error | |
|
1815 |
%{ |
|
1816 |
#ifdef XFT |
|
1817 |
if (__INST(address_) == 0) { |
|
1818 |
error = @symbol(BadHandle); |
|
1819 |
goto err; |
|
1820 |
} |
|
1821 |
if ( ! __isStringLike ( attribute ) ) { |
|
1822 |
error = @symbol(BadArg1); |
|
1823 |
goto err; |
|
1824 |
} |
|
1825 |
XftPatternDel( (XftPattern*)__INST(address_), __stringVal ( attribute ) ); |
|
1826 |
RETURN ( self ); |
|
1827 |
||
1828 |
err:; |
|
1829 |
#endif |
|
1830 |
%}. |
|
1831 |
self primitiveFailed: error |
|
1832 |
! |
|
1833 |
||
1834 |
destroy |
|
1835 |
%{ |
|
1836 |
#ifdef XFT |
|
1837 |
if (__INST(address_) != 0) { |
|
1838 |
XftPatternDestroy((XftPattern*)__INST(address_)); |
|
1839 |
__INST(address_) = 0; |
|
1840 |
RETURN ( self ); |
|
1841 |
} |
|
1842 |
#endif |
|
1843 |
%}. |
|
1844 |
self primitiveFailed. |
|
1845 |
! |
|
1846 |
||
1847 |
duplicate |
|
1848 |
| error | |
|
1849 |
||
1850 |
%{ |
|
1851 |
#ifdef XFT |
|
1852 |
if (__INST(address_) != 0) { |
|
1853 |
RETURN (FC_PATTERN_HANDLE_NEW((XftPattern*)__INST(address_))); |
|
1854 |
RETURN ( self ); |
|
1855 |
} |
|
1856 |
#endif |
|
1857 |
%}. |
|
1858 |
self primitiveFailed |
|
1859 |
! |
|
1860 |
||
1861 |
get:attribute index: index |
|
1862 |
"Return a value from the specified element -- multiple values can be indexed |
|
1863 |
with 'index' starting at zero." |
|
1864 |
||
1865 |
| error | |
|
1866 |
||
1867 |
%{ |
|
1868 |
#ifdef XFT |
|
1869 |
XftValue v; |
|
1870 |
XftResult r; |
|
1871 |
||
1872 |
if (__INST(address_) == 0) { |
|
1873 |
error = @symbol(NullReceiver); |
|
1874 |
goto err; |
|
1875 |
} |
|
1876 |
if ( ! __isStringLike ( attribute ) ) { |
|
1877 |
error = @symbol(BadArg1); |
|
1878 |
goto err; |
|
1879 |
} |
|
1880 |
if ( ! __isSmallInteger( index ) ) { |
|
1881 |
error = @symbol(BadArg2); |
|
1882 |
goto err; |
|
1883 |
} |
|
1884 |
r = XftPatternGet((XftPattern*)__INST(address_), __stringVal( attribute ), __intVal( index ), &v); |
|
1885 |
if ( r != XftResultMatch) { |
|
1886 |
RETURN ( nil ); |
|
1887 |
} |
|
1888 |
if ( v.type == XftTypeString) { |
|
1889 |
RETURN ( __MKSTRING(v.u.s) ); |
|
1890 |
} else if ( v.type == XftTypeInteger ) { |
|
1891 |
RETURN ( __MKINT (v.u.i) ); |
|
1892 |
} else if ( v.type == XftTypeBool ) { |
|
1893 |
RETURN ( v.u.b == True ? true : false ); |
|
1894 |
} else if ( v.type == XftTypeDouble ) { |
|
1895 |
RETURN ( __MKFLOAT (v.u.d) ); |
|
1896 |
} else if ( v.type == XftTypeVoid ) { |
|
1897 |
RETURN ( nil ); |
|
1898 |
} else { |
|
1899 |
error = @symbol(UnssuportedTypeValue); |
|
1900 |
goto err; |
|
1901 |
} |
|
1902 |
err:; |
|
1903 |
#endif |
|
1904 |
%}. |
|
1905 |
self primitiveFailed: error |
|
1906 |
! |
|
1907 |
||
1908 |
getFontOnDisplayId:displayId |
|
1909 |
"Note: the pattern is destroyed when the font is closed" |
|
1910 |
||
1911 |
| error | |
|
1912 |
||
1913 |
%{ /* STACK: 64000 */ |
|
1914 |
#ifdef XFT |
|
1915 |
XftFont* f; |
|
1916 |
if (!__isExternalAddressLike(displayId) ) { |
|
1917 |
error = @symbol(BadArg1); |
|
1918 |
goto err; |
|
1919 |
} |
|
1920 |
if (__INST(address_) == 0) { |
|
1921 |
error = @symbol(BadHandle); |
|
1922 |
goto err; |
|
1923 |
} |
|
1924 |
||
1925 |
f = XftFontOpenPattern(DISPLAY(displayId), (XftPattern*)__INST(address_)); |
|
1926 |
if (f == NULL) { |
|
1927 |
RETURN (nil); |
|
1928 |
} else { |
|
1929 |
RETURN (XFT_FONT_HANDLE_NEW(f)); |
|
1930 |
} |
|
1931 |
err:; |
|
1932 |
#endif |
|
1933 |
%}. |
|
1934 |
self primitiveFailed: error |
|
1935 |
||
1936 |
"Created: / 20-12-2013 / 23:53:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1937 |
! |
|
1938 |
||
1939 |
matchFontOnDisplayId:displayId screen:screen |
|
1940 |
| error | |
|
1941 |
||
1942 |
%{ /* STACK: 64000 */ |
|
1943 |
#ifdef XFT |
|
1944 |
XftPattern *p; |
|
1945 |
XftResult r; |
|
1946 |
||
1947 |
if (!__isExternalAddressLike(displayId)) { |
|
1948 |
error = @symbol(BadArg1); |
|
1949 |
goto err; |
|
1950 |
} |
|
1951 |
if (!__isSmallInteger( screen) ) { |
|
1952 |
error = @symbol(BadArg2); |
|
1953 |
goto err; |
|
1954 |
} |
|
1955 |
if (__INST(address_) == 0) { |
|
1956 |
error = @symbol(BadHandle); |
|
1957 |
goto err; |
|
1958 |
} |
|
1959 |
||
1960 |
// Already done in match: |
|
1961 |
// XftConfigSubstitute(FC_PATTERN( patternId )); |
|
1962 |
// XftDefaultSubstitute(DISPLAY(displayId), SCREEN( screen ), FC_PATTERN( patternId )); |
|
1963 |
p = XftFontMatch(DISPLAY(displayId), SCREEN(screen), (XftPattern*)__INST(address_), &r); |
|
1964 |
if (p) { |
|
1965 |
RETURN (FC_PATTERN_HANDLE_NEW(p) ); |
|
1966 |
} else { |
|
1967 |
error = @symbol(XftFontMatchReturnedNull); |
|
1968 |
} |
|
1969 |
err:; |
|
1970 |
#endif |
|
1971 |
%}. |
|
1972 |
self primitiveFailed: error |
|
1973 |
||
1974 |
"Created: / 21-12-2013 / 00:08:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1975 |
! ! |
|
1976 |
||
1977 |
!XftFontDescription::XftDrawHandle class methodsFor:'instance creation'! |
|
1978 |
||
1979 |
createForDisplayId:displayId screen:screen drawable:drawableId |
|
1980 |
^ self new createForDisplayId:displayId screen:screen drawable:drawableId |
|
1981 |
! ! |
|
1982 |
||
1983 |
!XftFontDescription::XftDrawHandle methodsFor:'primitives'! |
|
1984 |
||
1985 |
createForDisplayId:displayId screen:screen drawable:drawableId |
|
1986 |
| error | |
|
1987 |
||
1988 |
%{ /* STACK: 64000 */ |
|
1989 |
#ifdef XFT |
|
1990 |
if ( ! __isExternalAddressLike(displayId) ) { |
|
1991 |
error = @symbol(BadArg1); |
|
1992 |
goto err; |
|
1993 |
} |
|
1994 |
if ( ! __isSmallInteger(screen) ) { |
|
1995 |
error = @symbol(BadArg2); |
|
1996 |
goto err; |
|
1997 |
} |
|
1998 |
if ( ! __isExternalAddressLike(drawableId) ) { |
|
1999 |
error = @symbol(BadArg3); |
|
2000 |
goto err; |
|
2001 |
} |
|
2002 |
__INST(address_) = (void *) XftDrawCreate ( DISPLAY(displayId) , |
|
2003 |
DRAWABLE(drawableId) , |
|
2004 |
DefaultVisual(DISPLAY(displayId), SCREEN (screen)) , |
|
2005 |
DefaultColormap(DISPLAY(displayId), SCREEN (screen))); |
|
2006 |
err:; |
|
2007 |
#endif |
|
2008 |
%}. |
|
2009 |
self primitiveFailed: error |
|
2010 |
||
2011 |
"Created: / 21-12-2013 / 21:12:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2012 |
! |
|
2013 |
||
2014 |
destroy |
|
2015 |
%{ /* STACK: 64000 */ |
|
2016 |
#ifdef XFT |
|
2017 |
if (__INST(address_) != 0) { |
|
2018 |
XftDrawDestroy((XftDraw*)__INST(address_)); |
|
2019 |
__INST(address_) = 0; |
|
2020 |
RETURN ( self ); |
|
2021 |
} |
|
2022 |
#endif |
|
2023 |
%}. |
|
2024 |
self primitiveFailed. |
|
2025 |
! |
|
2026 |
||
2027 |
disassociateFrom:drawableId |
|
2028 |
"Disassociate the XftDrawable from drawableId. |
|
2029 |
This mist be done before the drawable is destroyed, |
|
2030 |
otherwise the XftDrawable is destroyed together with the drawable, |
|
2031 |
and X11 errors will be signaled." |
|
2032 |
||
2033 |
| error | |
|
2034 |
||
2035 |
%{ /* STACK: 64000 */ |
|
2036 |
#ifdef XFT |
|
2037 |
if (__INST(address_) == 0) { |
|
2038 |
// nothing to disasassociate from... |
|
2039 |
RETURN(self); |
|
2040 |
} |
|
2041 |
if (!__isExternalAddressLike(drawableId)) { |
|
2042 |
error = @symbol(BadArg); |
|
2043 |
goto err; |
|
2044 |
} |
|
2045 |
if (XftDrawDrawable((XftDraw*)__INST(address_)) == DRAWABLE(drawableId)) { |
|
2046 |
XftDrawChange((XftDraw*)__INST(address_), None); |
|
2047 |
} |
|
2048 |
RETURN(self); |
|
2049 |
err:; |
|
2050 |
#endif |
|
2051 |
%}. |
|
2052 |
self primitiveFailed: error |
|
2053 |
||
2054 |
"Created: / 26-12-2013 / 12:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2055 |
! |
|
2056 |
||
2057 |
drawChange:drawableId |
|
2058 |
| error | |
|
2059 |
||
2060 |
%{ /* STACK: 64000 */ |
|
2061 |
#ifdef XFT |
|
2062 |
if (drawableId == nil) { |
|
2063 |
XftDrawChange((XftDraw*)__INST(address_), None); |
|
2064 |
RETURN (self); |
|
2065 |
} |
|
2066 |
if (!__isExternalAddressLike(drawableId)) { |
|
2067 |
error = @symbol(BadArg1); |
|
2068 |
goto err; |
|
2069 |
} |
|
2070 |
if (XftDrawDrawable((XftDraw*)__INST(address_)) != DRAWABLE( drawableId)) { |
|
2071 |
XftDrawChange((XftDraw*)__INST(address_), DRAWABLE( drawableId)); |
|
2072 |
} |
|
2073 |
RETURN (self); |
|
2074 |
err:; |
|
2075 |
#endif |
|
2076 |
%}. |
|
2077 |
self primitiveFailed: error |
|
2078 |
||
2079 |
"Created: / 26-12-2013 / 12:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2080 |
! |
|
2081 |
||
2082 |
drawRectWithColor:aColor x:x y:y width:w height:h |
|
2083 |
| error r g b a pix | |
|
2084 |
||
2085 |
aColor isColor ifFalse:[^self primitiveFailed: #BadArg1]. |
|
2086 |
||
2087 |
r := aColor scaledRed. |
|
2088 |
g := aColor scaledGreen. |
|
2089 |
b := aColor scaledBlue. |
|
2090 |
a := aColor alpha * 65535. |
|
2091 |
r isNil ifTrue:[ |
|
2092 |
"/ when drawing into a pixmap... |
|
2093 |
aColor colorId == 0 ifTrue:[ |
|
2094 |
r := g := b := 0. |
|
2095 |
] ifFalse:[ |
|
2096 |
r := g := b := 16rFFFF. |
|
2097 |
] |
|
2098 |
]. |
|
2099 |
pix := aColor colorId. |
|
2100 |
%{ /* STACK: 64000 */ |
|
2101 |
#ifdef XFT |
|
2102 |
XftColor clr; |
|
2103 |
||
2104 |
if (__INST(address_) == 0) { |
|
2105 |
error = @symbol(BadHandle); |
|
2106 |
goto err; |
|
2107 |
} |
|
2108 |
if (!__isSmallInteger(pix)) { |
|
2109 |
error = @symbol(BadColorId); |
|
2110 |
goto err; |
|
2111 |
} |
|
2112 |
if (!__isSmallInteger(x)) { |
|
2113 |
error = @symbol(BadArg2); |
|
2114 |
goto err; |
|
2115 |
} |
|
2116 |
if (! __isSmallInteger(y)) { |
|
2117 |
error = @symbol(BadArg3); |
|
2118 |
goto err; |
|
2119 |
} |
|
2120 |
if (!__isSmallInteger(w)) { |
|
2121 |
error = @symbol(BadArg4); |
|
2122 |
goto err; |
|
2123 |
} |
|
2124 |
if (!__isSmallInteger(h)) { |
|
2125 |
error = @symbol(BadArg5); |
|
2126 |
goto err; |
|
2127 |
} |
|
2128 |
clr.pixel = (unsigned long)__intVal(pix); |
|
2129 |
clr.color.red = __intVal(r); |
|
2130 |
clr.color.green = __intVal(g); |
|
2131 |
clr.color.blue = __intVal(b); |
|
2132 |
clr.color.alpha = __intVal(a); |
|
2133 |
||
2134 |
XftDrawRect((XftDraw*)__INST(address_), &clr, |
|
2135 |
__intVal(x), __intVal(y), __intVal(w) ,__intVal(h)); |
|
2136 |
||
2137 |
RETURN (self); |
|
2138 |
err:; |
|
2139 |
#endif |
|
2140 |
%}. |
|
2141 |
self primitiveFailed: error. |
|
2142 |
||
2143 |
"Created: / 28-12-2013 / 23:35:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2144 |
"Modified: / 31-12-2013 / 00:37:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2145 |
! |
|
2146 |
||
2147 |
drawString:aString color:aColor font:fontIdArg x:x y:y from:start to:stop |
|
2148 |
| error r g b a pix | |
|
2149 |
||
2150 |
aColor isColor ifFalse:[^self primitiveFailed: #BadArg2]. |
|
2151 |
||
2152 |
pix := aColor colorId. |
|
2153 |
r := aColor scaledRed. |
|
2154 |
r isNil ifTrue:[ |
|
2155 |
"/ when drawing into a pixmap... |
|
2156 |
pix == 0 ifTrue:[ |
|
2157 |
r := g := b := a := 0. |
|
2158 |
] ifFalse:[ |
|
2159 |
r := g := b := a := 16rFFFF. |
|
2160 |
] |
|
2161 |
] ifFalse:[ |
|
2162 |
g := aColor scaledGreen. |
|
2163 |
b := aColor scaledBlue. |
|
2164 |
a := aColor alpha * 65535. |
|
2165 |
]. |
|
2166 |
%{ /* STACK: 64000 */ |
|
2167 |
#ifdef XFT |
|
2168 |
int _start, _stop; |
|
2169 |
int __x, __y; |
|
2170 |
XftColor clr; |
|
2171 |
||
2172 |
if (__INST(address_) == 0) { |
|
2173 |
error = @symbol(BadHandle); |
|
2174 |
goto err; |
|
2175 |
} |
|
2176 |
if ( ! __isSmallInteger(pix) ) { |
|
2177 |
error = @symbol(BadColorId); |
|
2178 |
goto err; |
|
2179 |
} |
|
2180 |
if ( ! __isSmallInteger(x) ) { |
|
2181 |
error = @symbol(BadArg4); |
|
2182 |
goto err; |
|
2183 |
} |
|
2184 |
__x = __intVal(x); |
|
2185 |
if ( ! __isSmallInteger(y) ) { |
|
2186 |
error = @symbol(BadArg5); |
|
2187 |
goto err; |
|
2188 |
} |
|
2189 |
__y = __intVal(y); |
|
2190 |
||
2191 |
||
2192 |
if ( ! __isSmallInteger(start) ) { |
|
2193 |
error = @symbol(BadArg6); |
|
2194 |
goto err; |
|
2195 |
} |
|
2196 |
_start = __intVal(start); |
|
2197 |
if ( ! __isSmallInteger(stop) ) { |
|
2198 |
error = @symbol(BadArg7); |
|
2199 |
goto err; |
|
2200 |
} |
|
2201 |
_stop = __intVal(stop); |
|
2202 |
||
2203 |
clr.pixel = (unsigned long)__intVal(pix); |
|
2204 |
clr.color.red = __intVal(r); |
|
2205 |
clr.color.green = __intVal(g); |
|
2206 |
clr.color.blue = __intVal(b); |
|
2207 |
clr.color.alpha = __intVal(a); |
|
2208 |
||
2209 |
if ( __isStringLike(aString) ) { |
|
2210 |
XftDrawString8((XftDraw*)__INST(address_), &clr, XFT_FONT(fontIdArg), |
|
2211 |
__x, __y, |
|
2212 |
__stringVal(aString) + (_start - 1), _stop - _start + 1); |
|
2213 |
RETURN ( self ); |
|
2214 |
} else { |
|
2215 |
error = @symbol(BadArg1); |
|
2216 |
goto err; |
|
2217 |
} |
|
2218 |
err:; |
|
2219 |
#endif |
|
2220 |
%}. |
|
2221 |
self primitiveFailed: error. |
|
2222 |
||
2223 |
"Created: / 28-12-2013 / 12:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2224 |
"Modified: / 30-12-2013 / 20:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2225 |
! |
|
2226 |
||
2227 |
setClipRect:rect |
|
2228 |
| error xObj yObj wObj hObj | |
|
2229 |
||
2230 |
rect notNil ifTrue:[ |
|
2231 |
xObj := rect left. |
|
2232 |
yObj := rect top. |
|
2233 |
wObj := rect width. |
|
2234 |
hObj := rect height. |
|
2235 |
]. |
|
2236 |
%{ /* STACK: 64000 */ |
|
2237 |
#ifdef XFT |
|
2238 |
if (__INST(address_) == 0) { |
|
2239 |
error = @symbol(BadHandle); |
|
2240 |
goto err; |
|
2241 |
} |
|
2242 |
if (rect != nil) { |
|
2243 |
XRectangle r; |
|
2244 |
||
2245 |
r.x = __intVal(xObj); |
|
2246 |
r.y = __intVal(yObj); |
|
2247 |
r.width = __intVal(wObj); |
|
2248 |
r.height = __intVal(hObj); |
|
2249 |
XftDrawSetClipRectangles((XftDraw*)__INST(address_), 0, 0, &r, 1); |
|
2250 |
} else { |
|
2251 |
XftDrawSetClipRectangles((XftDraw*)__INST(address_), 0, 0, (XRectangle*)NULL, 0); |
|
2252 |
} |
|
2253 |
RETURN ( self ); |
|
2254 |
err:; |
|
2255 |
#endif |
|
2256 |
%}. |
|
2257 |
self primitiveFailed: error. |
|
2258 |
||
2259 |
"Created: / 31-12-2013 / 01:24:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2260 |
! ! |
|
2261 |
||
6176 | 2262 |
!XftFontDescription class methodsFor:'documentation'! |
2263 |
||
2264 |
version |
|
6936 | 2265 |
^ '$Header$' |
6176 | 2266 |
! |
2267 |
||
2268 |
version_CVS |
|
6936 | 2269 |
^ '$Header$' |
6176 | 2270 |
! ! |
6180
6034bf4c5022
More work on XftFontDescription.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
2271 |
|
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
|
2272 |
|
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
|
2273 |
XftFontDescription initialize! |