Creating named font from c 
Author Message
 Creating named font from c

I use the Tk_MeasureChars() function from my c code, so I need
access to a Tk_Font token, which I get from Tk_GetFont.

When creating the font, using Tk_GetFont(), I would like to
return a font name to the calling Tcl code, for use in -font
attributes when creating new widgets (from Tcl), but I have
been unable to find how to do this in the doc - Tk_GetFont()
wants *either* a font name (which I assume must be already
known as a font name) *or* a definition - not both (I have
tried, and it returns the rather strange error message
'expected integer but got "-family"' - I surely provided
a '-family' attribute, but why does it expext an *integer*??)

It must be possible - the "font create" command does it!

I do have workarounds; the tcl code now obtains the font
*definition* from the c data structures. This is ugly and
inelegant. An alternative would be to do font defs from tcl
and hand the result over to the c code. The reason why I do
not want to do this is that the user, who does not know tcl,
should be able to customize the fonts by writing simple
statements into an *rc file - these statements are calls
to my c function. Requiring that the user first makes a
font create call and then transfers the result to my
proc is asking too much, and it opens up for a whole new
world of errors (obviously, my function does sanity checks
on the parameters, with user-oriented error reporting).

So: Is there a syntax for both naming and specifying the
font in the Tk_GetFont() call? Or can I name the font
after creation (so that the name is recognized at Tcl
level as a font name)? Or is there another function, which
I haven't been able to find in the doc, to let me create
a name/definition pair before I call Tk_GetFont?


Tue, 01 Aug 2000 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Why am I creating named fonts if....

2. Get true names for fonts ??

3. Another Font name irregularity?

4. Drag'n'dropping font names onto parts

5. How can I use phonetic fonts for cursors name

6. MacOberon and Mac fonts (with special names)...

7. Variable name with different font size

8. Name of font in Symbolics logo?

9. How to specify font name in TCL/Win95

10. Font names in Windows TK

11. Font names on Win95

12. Font names on Windows?


Powered by phpBB® Forum Software