[self-interest] primitiveMaker and proxies

Chris Double chris.double at double.co.nz
Mon Sep 23 14:24:14 UTC 2013

Answering some of my questions in case they come up in a search:

> Are 'proxy XftFont* XftFont_seal' and 'XftFont' funtionally equivalent?
> When would you use one over the other?

They are equivalent. The long form of using 'proxy...' is used if you
want to pass by value. So 'proxy XRenderColor XRenderColor_seal' is by
value and 'proxy XRenderColor* XRenderColor_seal' is by pointer. The
latter is equivalent to just 'XRenderColor'. The long form is also used
if you want to change the seal so that any type can be passed. This is
used for the Xevents and 'Drawable' parameters in places.

> I'm using 'string' in the definition. Other templates use 'string_null'
> and 'string_len_null'. What's the difference?

'string_len_null' passes two parameters. The string  and the length. So:

  Foo withString: string_len_null = void call Blah 

The calling self code here takes one argument, a string, and calls a C
function that has two functions - a char* and a length. Self
automatically finds out the length of the string and passes it.

> Once I did these steps and rebuilt the VM plus world then calling the
> function gave me an XftFont object I could inspect, success!

I've got enough Xft working now to display nicer fonts on Linux using
the raw API calls. Verdana at last! Next step is to change the font
display code to use these routines so that Linux font display is on par
with the Mac OS X rendering.


More information about the Self-interest mailing list