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