Solved GetFontDescription() on Windows and Mac


I am using GeClipMap::GetFontDescription() to retrieve a BaseContainer with data that I can use to draw nice looking text into a GeClipMap.

This is the code on Mac:

	BaseContainer fontSettings;
	if (!GeClipMap::GetFontDescription(String("Helvetica Bold"), GE_FONT_NAME_POSTSCRIPT, &fontSettings))
		return false;

This is the code on Windows:

	BaseContainer fontSettings;
	if (!GeClipMap::GetFontDescription(String("Arial"), GE_FONT_NAME_POSTSCRIPT, &fontSettings))
		return false;

On Mac, it works just fine. It is very fast (I actually do this call from within SceneHookData::Draw() with no performance issues). On Windows, this call needs almost a second to finish, and then always returns false. Why?

I tried with different font names on Windows ("Arial", "Courier", "Segoe UI" (which is the one Cinema 4D is using for its UI)), no success. GetFontDescription() always returns false.
Only asking personal code questions here.


there is definitely something broken here for Windows and it seems to go deeper than just GetFontDescription. I have to go now, but this is how far I got:

EDIT: FYI, I am aware that you are on C++

"""Some tests for GeClipMap.GetFontDescription.

import c4d
import itertools
import time

    "Helvetica Bold",
    "Times New Roman"

def time_it_get_font_description(ctx, name, flag):
    """Runs GeClipMap.GetFontDescription and measures its execution time.
    t0 = time.time()
    res = ctx.GetFontDescription(name, FONT_FLAGS[flag])
    t = time.time() - t0

    # Note that here the container itself does not seem to be malformed, i.e.
    # len(res) won't freeze Cinema.
    if isinstance(res, c4d.BaseContainer) and len(res) is 0:
        res = None

    msg = "name: {}, flag: {}, res: {}, time: {}."
    print msg.format(name, flag, res, t)

def main():
    ctx = c4d.bitmaps.GeClipMap()
    ctx.Init(512, 512, 32)

    # Run all possible combinations of our GeClipMap.GetFontDescription
    # arguments and pretty print the execution time and results.
    for name, flag in itertools.product(FONT_NAMES, FONT_FLAGS):
        time_it_get_font_description(ctx, name, flag)

    # Running this we will take about half a second for the flag
    # "GE_FONT_NAME_POSTSCRIPT" on my machine. Other flags are fine, 
    # the returned containers are however empty for all flags.

    # This commented line will freeze Cinema 4D WIN R20, where the
    # culprit is len(bc), i.e. the returned font container seems to
    # be somehow malformed.
    print "\n All fonts:"
    for cid, bc in ctx.EnumerateFonts(c4d.GE_CM_FONTSORT_FLAT):
        # print cid, bc if len(bc) != 0 else None
        print cid, bc

if __name__ == '__main__':

The output is:

name: Arial, flag: c4d.GE_FONT_NAME_POSTSCRIPT, res: None, time: 0.56299996376.
name: Arial, flag: c4d.GE_FONT_NAME_STYLE, res: None, time: 0.0.
name: Arial, flag: c4d.GE_FONT_NAME_DISPLAY, res: None, time: 0.0.
name: Arial, flag: c4d.GE_FONT_NAME_FAMILY, res: None, time: 0.0.
name: Bold, flag: c4d.GE_FONT_NAME_POSTSCRIPT, res: None, time: 0.663000106812.
name: Bold, flag: c4d.GE_FONT_NAME_STYLE, res: None, time: 0.0.
name: Bold, flag: c4d.GE_FONT_NAME_DISPLAY, res: None, time: 0.0.
name: Bold, flag: c4d.GE_FONT_NAME_FAMILY, res: None, time: 0.0.
name: Helvetica, flag: c4d.GE_FONT_NAME_POSTSCRIPT, res: None, time: 0.766000032425.
name: Helvetica, flag: c4d.GE_FONT_NAME_STYLE, res: None, time: 0.0.
name: Helvetica, flag: c4d.GE_FONT_NAME_DISPLAY, res: None, time: 0.0.
name: Helvetica, flag: c4d.GE_FONT_NAME_FAMILY, res: None, time: 0.0.
name: Helvetica Bold, flag: c4d.GE_FONT_NAME_POSTSCRIPT, res: None, time: 0.757999897003.
name: Helvetica Bold, flag: c4d.GE_FONT_NAME_STYLE, res: None, time: 0.0.
name: Helvetica Bold, flag: c4d.GE_FONT_NAME_DISPLAY, res: None, time: 0.0.
name: Helvetica Bold, flag: c4d.GE_FONT_NAME_FAMILY, res: None, time: 0.0.
name: Helvetica-Bold, flag: c4d.GE_FONT_NAME_POSTSCRIPT, res: None, time: 0.762000083923.
name: Helvetica-Bold, flag: c4d.GE_FONT_NAME_STYLE, res: None, time: 0.0.
name: Helvetica-Bold, flag: c4d.GE_FONT_NAME_DISPLAY, res: None, time: 0.0.
name: Helvetica-Bold, flag: c4d.GE_FONT_NAME_FAMILY, res: None, time: 0.0.
name: Times New Roman, flag: c4d.GE_FONT_NAME_POSTSCRIPT, res: None, time: 0.69000005722.
name: Times New Roman, flag: c4d.GE_FONT_NAME_STYLE, res: None, time: 0.0.
name: Times New Roman, flag: c4d.GE_FONT_NAME_DISPLAY, res: None, time: 0.0.
name: Times New Roman, flag: c4d.GE_FONT_NAME_FAMILY, res: None, time: 0.0.

 All fonts:
0 <c4d.BaseContainer object at 0x00000265F2480BD0>
1 <c4d.BaseContainer object at 0x00000265F2480BA0>
2 <c4d.BaseContainer object at 0x00000265F2471F90>
3 <c4d.BaseContainer object at 0x00000265F2471F00>
4 <c4d.BaseContainer object at 0x00000265F2471B40>
5 <c4d.BaseContainer object at 0x00000265F2471AB0>
6 <c4d.BaseContainer object at 0x00000265F2471780>
7 <c4d.BaseContainer object at 0x00000265F2832120>
8 <c4d.BaseContainer object at 0x00000265F2832210>
9 <c4d.BaseContainer object at 0x00000265F28320F0>
10 <c4d.BaseContainer object at 0x00000265F2832360>
11 <c4d.BaseContainer object at 0x00000265F28322D0>
12 <c4d.BaseContainer object at 0x00000265F2832270>
13 <c4d.BaseContainer object at 0x00000265F28322A0>
14 <c4d.BaseContainer object at 0x00000265F2832240>
15 <c4d.BaseContainer object at 0x00000265F28321E0>
16 <c4d.BaseContainer object at 0x00000265F2832180>
17 <c4d.BaseContainer object at 0x00000265F28321B0>
18 <c4d.BaseContainer object at 0x00000265F2832150>
19 <c4d.BaseContainer object at 0x00000265F28320C0>
20 <c4d.BaseContainer object at 0x00000265F2832060>
21 <c4d.BaseContainer object at 0x00000265F2832030>
22 <c4d.BaseContainer object at 0x00000265F2832390>
23 <c4d.BaseContainer object at 0x00000265F28323C0>
24 <c4d.BaseContainer object at 0x00000265F28323F0>
25 <c4d.BaseContainer object at 0x00000265F2832420>
26 <c4d.BaseContainer object at 0x00000265F2832450>
27 <c4d.BaseContainer object at 0x00000265F2832480>
28 <c4d.BaseContainer object at 0x00000265F28324B0>
29 <c4d.BaseContainer object at 0x00000265F28324E0>
30 <c4d.BaseContainer object at 0x00000265F2832510>
31 <c4d.BaseContainer object at 0x00000265F2832540>
32 <c4d.BaseContainer object at 0x00000265F2832570>
33 <c4d.BaseContainer object at 0x00000265F28325A0>
34 <c4d.BaseContainer object at 0x00000265F28325D0>
35 <c4d.BaseContainer object at 0x00000265F2832600>
36 <c4d.BaseContainer object at 0x00000265F2832630>
37 <c4d.BaseContainer object at 0x00000265F2832660>
38 <c4d.BaseContainer object at 0x00000265F2832690>
39 <c4d.BaseContainer object at 0x00000265F28326C0>
40 <c4d.BaseContainer object at 0x00000265F28326F0>
41 <c4d.BaseContainer object at 0x00000265F2832720>
42 <c4d.BaseContainer object at 0x00000265F2832750>
43 <c4d.BaseContainer object at 0x00000265F2832780>
44 <c4d.BaseContainer object at 0x00000265F28327B0>
45 <c4d.BaseContainer object at 0x00000265F28327E0>
46 <c4d.BaseContainer object at 0x00000265F2832810>
47 <c4d.BaseContainer object at 0x00000265F2832840>
48 <c4d.BaseContainer object at 0x00000265F2832870>
49 <c4d.BaseContainer object at 0x00000265F28328A0>
50 <c4d.BaseContainer object at 0x00000265F28328D0>
51 <c4d.BaseContainer object at 0x00000265F2832900>
52 <c4d.BaseContainer object at 0x00000265F2832930>
53 <c4d.BaseContainer object at 0x00000265F2832960>
54 <c4d.BaseContainer object at 0x00000265F2832990>
55 <c4d.BaseContainer object at 0x00000265F28329C0>
56 <c4d.BaseContainer object at 0x00000265F28329F0>
57 <c4d.BaseContainer object at 0x00000265F2832A20>
58 <c4d.BaseContainer object at 0x00000265F2832A50>
59 <c4d.BaseContainer object at 0x00000265F2832A80>
60 <c4d.BaseContainer object at 0x00000265F2832AB0>
61 <c4d.BaseContainer object at 0x00000265F2832AE0>
62 <c4d.BaseContainer object at 0x00000265F2832B10>
63 <c4d.BaseContainer object at 0x00000265F2832B40>
64 <c4d.BaseContainer object at 0x00000265F2832B70>
65 <c4d.BaseContainer object at 0x00000265F2832BA0>
66 <c4d.BaseContainer object at 0x00000265F2832BD0>
67 <c4d.BaseContainer object at 0x00000265F2832C00>
68 <c4d.BaseContainer object at 0x00000265F2832C30>
69 <c4d.BaseContainer object at 0x00000265F2832C60>
70 <c4d.BaseContainer object at 0x00000265F2832C90>
71 <c4d.BaseContainer object at 0x00000265F2832CC0>
72 <c4d.BaseContainer object at 0x00000265F2832CF0>
73 <c4d.BaseContainer object at 0x00000265F2832D20>
74 <c4d.BaseContainer object at 0x00000265F2832D50>
75 <c4d.BaseContainer object at 0x00000265F2832D80>
76 <c4d.BaseContainer object at 0x00000265F2832DB0>
77 <c4d.BaseContainer object at 0x00000265F2832DE0>
78 <c4d.BaseContainer object at 0x00000265F2832E10>
79 <c4d.BaseContainer object at 0x00000265F2832E40>
80 <c4d.BaseContainer object at 0x00000265F2832E70>
81 <c4d.BaseContainer object at 0x00000265F2832EA0>
82 <c4d.BaseContainer object at 0x00000265F2832ED0>
83 <c4d.BaseContainer object at 0x00000265F2832F00>
84 <c4d.BaseContainer object at 0x00000265F2832F30>
85 <c4d.BaseContainer object at 0x00000265F2832F60>
86 <c4d.BaseContainer object at 0x00000265F2832F90>
87 <c4d.BaseContainer object at 0x00000265F2832FC0>
88 <c4d.BaseContainer object at 0x00000265F281D7B0>
89 <c4d.BaseContainer object at 0x00000265F281DEA0>
90 <c4d.BaseContainer object at 0x00000265F281DD80>
91 <c4d.BaseContainer object at 0x00000265F281DDE0>
92 <c4d.BaseContainer object at 0x00000265F281DE40>
93 <c4d.BaseContainer object at 0x00000265F281DB40>
94 <c4d.BaseContainer object at 0x00000265F281DE70>
95 <c4d.BaseContainer object at 0x00000265F281DE10>
96 <c4d.BaseContainer object at 0x00000265F281D6F0>
97 <c4d.BaseContainer object at 0x00000265F281D5D0>
98 <c4d.BaseContainer object at 0x00000265F281D630>
99 <c4d.BaseContainer object at 0x00000265F281D690>
100 <c4d.BaseContainer object at 0x00000265F281D390>
101 <c4d.BaseContainer object at 0x00000265F281D6C0>
102 <c4d.BaseContainer object at 0x00000265F281D660>
103 <c4d.BaseContainer object at 0x00000265F281DF00>
104 <c4d.BaseContainer object at 0x00000265F281DCC0>
105 <c4d.BaseContainer object at 0x00000265F2489930>
106 <c4d.BaseContainer object at 0x00000265F265A030>
107 <c4d.BaseContainer object at 0x00000265F265A060>
108 <c4d.BaseContainer object at 0x00000265F265A090>
109 <c4d.BaseContainer object at 0x00000265F265A0C0>
110 <c4d.BaseContainer object at 0x00000265F265A0F0>
111 <c4d.BaseContainer object at 0x00000265F265A120>
112 <c4d.BaseContainer object at 0x00000265F265A150>
113 <c4d.BaseContainer object at 0x00000265F265A180>
114 <c4d.BaseContainer object at 0x00000265F265A1B0>
115 <c4d.BaseContainer object at 0x00000265F265A1E0>
116 <c4d.BaseContainer object at 0x00000265F265A210>
117 <c4d.BaseContainer object at 0x00000265F265A240>
118 <c4d.BaseContainer object at 0x00000265F265A270>
119 <c4d.BaseContainer object at 0x00000265F265A2A0>
120 <c4d.BaseContainer object at 0x00000265F265A2D0>
121 <c4d.BaseContainer object at 0x00000265F265A300>
122 <c4d.BaseContainer object at 0x00000265F265A330>
123 <c4d.BaseContainer object at 0x00000265F265A360>
124 <c4d.BaseContainer object at 0x00000265F265A390>
125 <c4d.BaseContainer object at 0x00000265F265A3C0>
126 <c4d.BaseContainer object at 0x00000265F265A3F0>
127 <c4d.BaseContainer object at 0x00000265F265A420>
128 <c4d.BaseContainer object at 0x00000265F265A450>
129 <c4d.BaseContainer object at 0x00000265F265A480>
130 <c4d.BaseContainer object at 0x00000265F265A4B0>
131 <c4d.BaseContainer object at 0x00000265F265A4E0>
132 <c4d.BaseContainer object at 0x00000265F265A510>
133 <c4d.BaseContainer object at 0x00000265F265A540>
134 <c4d.BaseContainer object at 0x00000265F265A570>
135 <c4d.BaseContainer object at 0x00000265F265A5A0>
136 <c4d.BaseContainer object at 0x00000265F265A5D0>
137 <c4d.BaseContainer object at 0x00000265F265A600>
138 <c4d.BaseContainer object at 0x00000265F265A630>
139 <c4d.BaseContainer object at 0x00000265F265A660>
140 <c4d.BaseContainer object at 0x00000265F265A690>
141 <c4d.BaseContainer object at 0x00000265F265A6C0>
142 <c4d.BaseContainer object at 0x00000265F265A6F0>
143 <c4d.BaseContainer object at 0x00000265F265A720>
144 <c4d.BaseContainer object at 0x00000265F265A750>
145 <c4d.BaseContainer object at 0x00000265F265A780>
146 <c4d.BaseContainer object at 0x00000265F265A7B0>
147 <c4d.BaseContainer object at 0x00000265F265A7E0>
148 <c4d.BaseContainer object at 0x00000265F265A810>
149 <c4d.BaseContainer object at 0x00000265F265A840>
150 <c4d.BaseContainer object at 0x00000265F265A870>
151 <c4d.BaseContainer object at 0x00000265F265A8A0>
152 <c4d.BaseContainer object at 0x00000265F265A8D0>
153 <c4d.BaseContainer object at 0x00000265F265A900>
154 <c4d.BaseContainer object at 0x00000265F265A930>
155 <c4d.BaseContainer object at 0x00000265F265A960>
156 <c4d.BaseContainer object at 0x00000265F265A990>
157 <c4d.BaseContainer object at 0x00000265F265A9C0>
158 <c4d.BaseContainer object at 0x00000265F265A9F0>
159 <c4d.BaseContainer object at 0x00000265F265AA20>
160 <c4d.BaseContainer object at 0x00000265F265AA50>
161 <c4d.BaseContainer object at 0x00000265F265AA80>
162 <c4d.BaseContainer object at 0x00000265F265AAB0>
163 <c4d.BaseContainer object at 0x00000265F265AAE0>
164 <c4d.BaseContainer object at 0x00000265F265AB10>
165 <c4d.BaseContainer object at 0x00000265F265AB40>
166 <c4d.BaseContainer object at 0x00000265F265AB70>
167 <c4d.BaseContainer object at 0x00000265F265ABA0>
168 <c4d.BaseContainer object at 0x00000265F265ABD0>
169 <c4d.BaseContainer object at 0x00000265F265AC00>
170 <c4d.BaseContainer object at 0x00000265F265AC30>
171 <c4d.BaseContainer object at 0x00000265F265AC60>
172 <c4d.BaseContainer object at 0x00000265F265AC90>
173 <c4d.BaseContainer object at 0x00000265F265ACC0>
174 <c4d.BaseContainer object at 0x00000265F265ACF0>
175 <c4d.BaseContainer object at 0x00000265F265AD20>
176 <c4d.BaseContainer object at 0x00000265F265AD50>
177 <c4d.BaseContainer object at 0x00000265F265AD80>
178 <c4d.BaseContainer object at 0x00000265F265ADB0>
179 <c4d.BaseContainer object at 0x00000265F265ADE0>
180 <c4d.BaseContainer object at 0x00000265F265AE10>
181 <c4d.BaseContainer object at 0x00000265F265AE40>
182 <c4d.BaseContainer object at 0x00000265F265AE70>
183 <c4d.BaseContainer object at 0x00000265F265AEA0>
184 <c4d.BaseContainer object at 0x00000265F265AED0>
185 <c4d.BaseContainer object at 0x00000265F265AF00>
186 <c4d.BaseContainer object at 0x00000265F265AF30>
187 <c4d.BaseContainer object at 0x00000265F265AF60>
188 <c4d.BaseContainer object at 0x00000265F265AF90>
189 <c4d.BaseContainer object at 0x00000265F265AFC0>
190 <c4d.BaseContainer object at 0x00000265F2666030>
191 <c4d.BaseContainer object at 0x00000265F2666060>
192 <c4d.BaseContainer object at 0x00000265F2666090>
193 <c4d.BaseContainer object at 0x00000265F26660C0>
194 <c4d.BaseContainer object at 0x00000265F26660F0>
195 <c4d.BaseContainer object at 0x00000265F2666120>
196 <c4d.BaseContainer object at 0x00000265F2666150>
197 <c4d.BaseContainer object at 0x00000265F2666180>
198 <c4d.BaseContainer object at 0x00000265F26661B0>
199 <c4d.BaseContainer object at 0x00000265F26661E0>
200 <c4d.BaseContainer object at 0x00000265F2666210>
201 <c4d.BaseContainer object at 0x00000265F2666240>
202 <c4d.BaseContainer object at 0x00000265F2666270>
203 <c4d.BaseContainer object at 0x00000265F26662A0>
204 <c4d.BaseContainer object at 0x00000265F26662D0>
205 <c4d.BaseContainer object at 0x00000265F2666300>
206 <c4d.BaseContainer object at 0x00000265F2666330>
207 <c4d.BaseContainer object at 0x00000265F2666360>
208 <c4d.BaseContainer object at 0x00000265F2666390>
209 <c4d.BaseContainer object at 0x00000265F26663C0>
210 <c4d.BaseContainer object at 0x00000265F26663F0>
211 <c4d.BaseContainer object at 0x00000265F2666420>
212 <c4d.BaseContainer object at 0x00000265F2666450>
213 <c4d.BaseContainer object at 0x00000265F2666480>
214 <c4d.BaseContainer object at 0x00000265F26664B0>
215 <c4d.BaseContainer object at 0x00000265F26664E0>
216 <c4d.BaseContainer object at 0x00000265F2666510>
217 <c4d.BaseContainer object at 0x00000265F2666540>
218 <c4d.BaseContainer object at 0x00000265F2666570>
219 <c4d.BaseContainer object at 0x00000265F26665A0>
220 <c4d.BaseContainer object at 0x00000265F26665D0>
221 <c4d.BaseContainer object at 0x00000265F2666600>
222 <c4d.BaseContainer object at 0x00000265F2666630>
223 <c4d.BaseContainer object at 0x00000265F2666660>
224 <c4d.BaseContainer object at 0x00000265F2666690>
225 <c4d.BaseContainer object at 0x00000265F26666C0>
226 <c4d.BaseContainer object at 0x00000265F26666F0>
227 <c4d.BaseContainer object at 0x00000265F2666720>
228 <c4d.BaseContainer object at 0x00000265F2666750>
229 <c4d.BaseContainer object at 0x00000265F2666780>
230 <c4d.BaseContainer object at 0x00000265F26667B0>
231 <c4d.BaseContainer object at 0x00000265F26667E0>
232 <c4d.BaseContainer object at 0x00000265F2666810>
233 <c4d.BaseContainer object at 0x00000265F2666840>
234 <c4d.BaseContainer object at 0x00000265F2666870>
235 <c4d.BaseContainer object at 0x00000265F26668A0>
236 <c4d.BaseContainer object at 0x00000265F26668D0>
237 <c4d.BaseContainer object at 0x00000265F2666900>
238 <c4d.BaseContainer object at 0x00000265F2666930>
239 <c4d.BaseContainer object at 0x00000265F2666960>
240 <c4d.BaseContainer object at 0x00000265F2666990>
241 <c4d.BaseContainer object at 0x00000265F26669C0>
242 <c4d.BaseContainer object at 0x00000265F26669F0>
243 <c4d.BaseContainer object at 0x00000265F2666A20>
244 <c4d.BaseContainer object at 0x00000265F2666A50>
245 <c4d.BaseContainer object at 0x00000265F2666A80>
246 <c4d.BaseContainer object at 0x00000265F2666AB0>
247 <c4d.BaseContainer object at 0x00000265F2666AE0>
248 <c4d.BaseContainer object at 0x00000265F2666B10>
249 <c4d.BaseContainer object at 0x00000265F2666B40>
250 <c4d.BaseContainer object at 0x00000265F2666B70>
251 <c4d.BaseContainer object at 0x00000265F2666BA0>
252 <c4d.BaseContainer object at 0x00000265F2666BD0>
253 <c4d.BaseContainer object at 0x00000265F2666C00>
254 <c4d.BaseContainer object at 0x00000265F2666C30>
255 <c4d.BaseContainer object at 0x00000265F2666C60>
256 <c4d.BaseContainer object at 0x00000265F2666C90>
257 <c4d.BaseContainer object at 0x00000265F2666CC0>
258 <c4d.BaseContainer object at 0x00000265F2666CF0>
259 <c4d.BaseContainer object at 0x00000265F2666D20>
260 <c4d.BaseContainer object at 0x00000265F2666D50>
261 <c4d.BaseContainer object at 0x00000265F2666D80>
262 <c4d.BaseContainer object at 0x00000265F2666DB0>
263 <c4d.BaseContainer object at 0x00000265F2666DE0>
264 <c4d.BaseContainer object at 0x00000265F2666E10>
265 <c4d.BaseContainer object at 0x00000265F2666E40>
266 <c4d.BaseContainer object at 0x00000265F2666E70>
267 <c4d.BaseContainer object at 0x00000265F2666EA0>
268 <c4d.BaseContainer object at 0x00000265F2666ED0>
269 <c4d.BaseContainer object at 0x00000265F2666F00>
270 <c4d.BaseContainer object at 0x00000265F2666F30>
271 <c4d.BaseContainer object at 0x00000265F2666F60>
272 <c4d.BaseContainer object at 0x00000265F2666F90>
273 <c4d.BaseContainer object at 0x00000265F2666FC0>
274 <c4d.BaseContainer object at 0x00000265F2653030>
275 <c4d.BaseContainer object at 0x00000265F2653060>
276 <c4d.BaseContainer object at 0x00000265F2653090>
277 <c4d.BaseContainer object at 0x00000265F26530C0>
278 <c4d.BaseContainer object at 0x00000265F26530F0>
279 <c4d.BaseContainer object at 0x00000265F2653120>
280 <c4d.BaseContainer object at 0x00000265F2653150>
281 <c4d.BaseContainer object at 0x00000265F2653180>
282 <c4d.BaseContainer object at 0x00000265F26531B0>
283 <c4d.BaseContainer object at 0x00000265F26531E0>
284 <c4d.BaseContainer object at 0x00000265F2653210>
285 <c4d.BaseContainer object at 0x00000265F2653240>
286 <c4d.BaseContainer object at 0x00000265F2653270>
287 <c4d.BaseContainer object at 0x00000265F26532A0>
288 <c4d.BaseContainer object at 0x00000265F26532D0>
289 <c4d.BaseContainer object at 0x00000265F2653300>
290 <c4d.BaseContainer object at 0x00000265F2653330>
291 <c4d.BaseContainer object at 0x00000265F2653360>
292 <c4d.BaseContainer object at 0x00000265F2653390>
293 <c4d.BaseContainer object at 0x00000265F26533C0>
294 <c4d.BaseContainer object at 0x00000265F26533F0>
295 <c4d.BaseContainer object at 0x00000265F2653420>
296 <c4d.BaseContainer object at 0x00000265F2653450>
297 <c4d.BaseContainer object at 0x00000265F2653480>
298 <c4d.BaseContainer object at 0x00000265F26534B0>
299 <c4d.BaseContainer object at 0x00000265F26534E0>
300 <c4d.BaseContainer object at 0x00000265F2653510>


MAXON SDK Specialist

I just found one possible solution: Just ignore the return value of GetFontDescription(). It returns false, but if I use the data from the container anyway, I actually can draw text successfully. Strange...

Thanks for testing this, @zipit ! Hope to hear something from the SDK Team about this, too :-)

That really does look fishy.

Only asking personal code questions here.

@fwilleke80 said in GetFontDescription() on Windows and Mac:


on both OS, this function will only work with the flag GE_FONT_NAME_POSTSCRIPT

on mac, it does almost nothing, it just pick the name passed as argument and insert it in the BaseContainer at ID FONT_POSTSCRIPT_NAME
this function will return false only if you use another flag.

on windows,
it does use the function EnumFontFamiliesExW (from microsoft). As written on this page it does create a LOGFONTW

It's calling another function that will feed the basecontainer it will only work with font type == TRUETYPE_FONTTYPE or DEVICE_FONTTYPE. Other cases it will return false.

If it's a familly it will loop to retrieve all the fonts.
If not it will return the informations.

So this look like a bug, I'll ask the dev team why on OSX it does nothing. :)

By the way, the Draw function isn't the right place to do this even if it's fast on osx.


MAXON SDK Specialist

MAXON Registered Developer


fast reply, confirmation it's normal.

The name used to select a font on macOS is its postscript font name, hence nothing to do here. On Windows you have to enumerate all fonts to find the right one and get the postscript name of its 'post' table.


MAXON SDK Specialist

MAXON Registered Developer


without further feedback i'll set this thread as solved tomorrow.


MAXON SDK Specialist

MAXON Registered Developer

Go ahead ;-)
Only asking personal code questions here.

Hello to all

@zipit said in GetFontDescription() on Windows and Mac:


Thank you
i miss flags in