From: Luc Moulinier on 28 Jun 2010 07:14 Hello ! I'm trying to write a new widget using the Tk C API. For the moment, I'm training with the API. I encounter a problem with fonts. To set a font in a GC, I tried two things : - proper Tk : (according to man pages) Tk_Font tkfont; Font myfont; tkfont = Tk_GetFont(squarePtr->interp, tkwin, "-adobe-courier-bold- r-normal--24-240-75-75-m-150-iso10646-1"); myfont = Tk_FontId(tkfont); - using xlib : Font myfont; myfont = XLoadFont(Tk_Display(tkwin), "-adobe-courier-bold-r- normal--24-240-75-75-m-150-iso10646-1"); and then : XGCValues gcv; gcv.function = GXcopy; gcv.graphics_exposures = False; gcv.font = myfont; gcv.foreground = Tk_GetColor(squarePtr->interp, tkwin, "cyan")- >pixel; squarePtr->gc = Tk_GetGC(tkwin,GCFunction|GCGraphicsExposures| GCFont|GCForeground, &gcv); Note the selected font is Courier 24 bold. The "xlib" way does the right thing. Using Tk form, the size of the font seems correct (width and height), but the draw characters are not of size 24. Can someone give me some explanations and solutions ? Many newbie thanks !! Luc
From: Luc Moulinier on 29 Jun 2010 07:36 To precise : working with Tcl/Tk 8.5.8 under Linux (redhat) Luc
|
Pages: 1 Prev: String to integer conversion in expect script Next: differences in font metrics ... |