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