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