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