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