[Xcb] Carbon, the new xcb based terminal emulator.
Jamey Sharp
jamey at minilop.net
Thu Mar 11 04:28:28 PST 2010
Hi Simon! Congratulations, you've triggered a more vocal discussion than
we usually have. :-) Hey everybody, let's lay off the core vs. client
fonts debate and try to answer the question. :-)
On Wed, Mar 10, 2010 at 08:16:17PM -0500, Simon Gomizelj wrote:
> Hello, new guy here. My name is Simon Gomizelj and I recently took it upon
> myself to try to write a terminal emulator build on xcb.
I'm honestly excited to hear that. There's probably something wrong with
me.
> I've got much of the plumbing done on the terminal side of things, but I'm
> having issues with the xcb side of things. Right now I'm trying to print a
> series of lines of text with xcb as a test. However I can't seem to get a
> correct character height querying the font. The following code is returning
> these values:
This is tricky for me: I've been working on XCB since 2001 and I still
don't know the protocol very well. But I think I see the problem here.
> gc = getfontgc(w, "-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*");
>
> fontcookie = xcb_query_font(w->conn, gc);
> fontreply = xcb_query_font_reply(w->conn, fontcookie, NULL);
> info = xcb_query_font_char_infos(fontreply);
>
> info->ascent is 8, should be 10
> info->descent is 0, should be 2
xcb_query_font_char_infos returns an array containing all the individual
character metrics, so you've requested metrics for character 0. I think
instead you wanted fontreply->font_ascent and fontreply->font_descent?
The values you expected also show up in fontreply->maxbounds.ascent and
fontreply->maxbounds.descent, so I guess you might have meant that.
I checked this with xlsfonts (after installing xfonts-terminus and
running `xset fp rehash`):
xlsfonts -lll -m -o -fn "-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*"
...
ascent: 10
descent: 2
font type: Character Cell
bounds: width left right asc desc attr keysym
min 6 0 0 0 -9 0x0000
max 6 2 6 10 2 0x0000
character metrics:
0x0000 (0) 6 0 5 8 0 0x0000 .
...
I hope that helps!
Jamey
p.s. I do think everybody should be using client-side fonts though. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20100311/a34b4c42/attachment.pgp>
More information about the Xcb
mailing list