author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 17 Feb 2016 06:43:31 +0000 | |
changeset 40 | 28dfc583beb5 |
parent 30 | c8fe298c8cc7 |
child 43 | 1006839761af |
permissions | -rw-r--r-- |
1 | 1 |
"{ Package: 'stx:goodies/libcairo' }" |
2 |
||
3 |
"{ NameSpace: Cairo }" |
|
4 |
||
30
c8fe298c8cc7
GraphicsContext refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
5 |
CObject subclass:#FontFace |
1 | 6 |
instanceVariableNames:'' |
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
12 | 9 |
category:'Cairo-Objects' |
1 | 10 |
! |
11 |
||
7
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
12 |
|
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
13 |
!FontFace class methodsFor:'instance creation'! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
14 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
15 |
fromFontDescription: aFontDescription |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
16 |
Screen current platformName == #X11 ifTrue:[ |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
17 |
| pattern | |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
18 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
19 |
pattern := FcPattern fromFontDescription: aFontDescription. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
20 |
^ CPrimitives cairo_ft_font_face_create_for_pattern: pattern. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
21 |
]. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
22 |
self error: 'Noy yet implemented'. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
23 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
24 |
" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
25 |
Cairo::FontFace fromFontDescription: CodeView defaultFont |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
26 |
" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
27 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
28 |
"Created: / 17-02-2016 / 20:01:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
29 |
! ! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
30 |
|
1 | 31 |
!FontFace class methodsFor:'accessing'! |
32 |
||
12 | 33 |
dllPath |
34 |
||
35 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
36 |
^ #( 'C:\Windows' 'C:\Windows\System32' "Wild guess, should not harm" ) |
|
37 |
]. |
|
38 |
||
39 |
OperatingSystem isUNIXlike ifTrue:[ |
|
40 |
OperatingSystem getSystemType == #linux ifTrue:[ |
|
41 |
| path | |
|
42 |
||
43 |
path := #( '/lib' '/usr/lib' '/usr/local/lib' ). |
|
44 |
(OperatingSystem getSystemInfo at:#machine) = 'x86_64' ifTrue:[ |
|
45 |
"If the machine is 64bit, prepend standard path for 32bit libs. |
|
46 |
Leave standard paths at the end, as the system might be completely |
|
47 |
32bit but running on 64bit-capable CPU. |
|
48 |
||
49 |
CAVEAT: This is bit dangerous, as on 64bit OS, if ia32 libs are |
|
50 |
not installed byt 64bit sqlite libs are, then 64bit libs are found |
|
51 |
and when a function is called, segfault will occur!! |
|
52 |
||
53 |
Q: Is there a way how to figure out if the OS itself is 32bit, |
|
54 |
regardles on CPU?" |
|
55 |
path := #( '/lib32' '/usr/lib32' '/usr/local/lib32' ) , path. |
|
56 |
]. |
|
57 |
^path |
|
58 |
||
59 |
]. |
|
60 |
]. |
|
61 |
||
62 |
self error:'Unsupported operating system' |
|
63 |
||
64 |
" |
|
65 |
SqliteLibrary dllPath |
|
66 |
" |
|
67 |
||
68 |
"Created: / 31-08-2011 / 18:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
69 |
! |
|
70 |
||
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
71 |
sizeof |
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
72 |
"Returns size of undelaying structure in bytes" |
1 | 73 |
|
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
74 |
^0 |
1 | 75 |
! ! |
76 |
||
40
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
77 |
!FontFace methodsFor:'accessing'! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
78 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
79 |
referenceCount |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
80 |
"Return value or reference counter" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
81 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
82 |
^ CPrimitives cairo_font_face_get_reference_count: self |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
83 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
84 |
"Modified: / 17-02-2016 / 19:54:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
85 |
! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
86 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
87 |
type |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
88 |
"This function returns the type of the backend used to create a font face. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
89 |
See FontType for available types." |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
90 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
91 |
^ CPrimitives cairo_font_face_get_type: self |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
92 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
93 |
"Created: / 17-02-2016 / 19:54:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
94 |
! ! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
95 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
96 |
!FontFace methodsFor:'private'! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
97 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
98 |
destroy |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
99 |
"Tell Cairo library to destroy the corresponding C object. |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
100 |
Remember that object is physically destroyed only if internal |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
101 |
refcounter goes to zero. However, after calling destroy, |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
102 |
this instance should be treated as invalid." |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
103 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
104 |
^ CPrimitives cairo_font_face_destroy: self |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
105 |
|
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
106 |
"Modified: / 17-02-2016 / 19:54:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
107 |
! ! |
28dfc583beb5
#displayString: in CairoGraphicsContext revamped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
30
diff
changeset
|
108 |
|
7
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
109 |
!FontFace class methodsFor:'documentation'! |
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
110 |
|
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
111 |
version |
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
112 |
^'$Id$' |
11 | 113 |
! |
114 |
||
23
38ee47dbd976
Added version_HG to make Mercurial happy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20
diff
changeset
|
115 |
version_HG |
38ee47dbd976
Added version_HG to make Mercurial happy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20
diff
changeset
|
116 |
^ '$Changeset: <not expanded> $' |
7
392289f92fab
- DLL path is set automatically.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
117 |
! ! |
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
118 |