Re: freetype module sometimes gets font height (descent?) wrong

Chisato Yamauchi <[email protected]>
Newsgroups gmane.comp.xfree86.fonts
Message-ID <[email protected]>
From: Michael Lampe <[email protected]>
Subject: [Fonts] freetype module sometimes gets font height (descent?) wrong
Date: Fri, 20 Feb 2004 17:39:58 +0100

> xlsfonts lists the font in question.
> 
> Emacs bluntly says "No fonts match ..." and aborts.
> 
> xfd seems to use it, but displays "unknown font" in the first line. And 
> contrary to what I said before you can see the overall problem with xfd 
> too if you increase the font size.

  OK. That patch was broken.  I somewhat misunderstood...

> I'm still wondering if you are able to reproduce what I'm talking about. 
>   Please try
> 
> xedit
>   -fn "-monotype-courier new-medium-r-normal--12-0-100-100-m-0-iso8859-1"
> 
> Two small images of what it looks like for me are here:
> 
> http://cox.iwr.uni-heidelberg.de/~lampe/xedit-xtt.png
> http://cox.iwr.uni-heidelberg.de/~lampe/xedit-freetype.png

  I cannot reprodeuce them using xedit... Why?   How is your 
"resolution" of xdpyinfo.  100x100 dots per inch?

  I attach "fontpropdump.c".  Would you tell me the results of
"freetype" and "xtt"?

  usage:

  ./fontpropdump "-monotype-courier new-medium-r-normal--12-0-100-100-m-0-iso8859-1"

  Here are my results:

[X-TT]
PIXEL_SIZE : 12
POINT_SIZE : 87
RESOLUTION_X : 100
RESOLUTION_Y : 100
AVERAGE_WIDTH : 70
RAW_AVERAGE_WIDTH : 6001
FONT_ASCENT : 11
RAW_ASCENT : (none)
FONT_DESCENT : 4
RAW_DESCENT : (none)
SUBSCRIPT_SIZE : 8
SUBSCRIPT_X : 0
SUBSCRIPT_Y : 2
SUPERSCRIPT_SIZE : 8
SUPERSCRIPT_X : 0
SUPERSCRIPT_Y : 5
UNDERLINE_THICKNESS : 1
UNDERLINE_POSITION : 3
RAW_PIXEL_SIZE : (none)
RAW_POINT_SIZE : (none)

[FreeType]
PIXEL_SIZE : 12
POINT_SIZE : 87
RESOLUTION_X : 100
RESOLUTION_Y : 100
AVERAGE_WIDTH : 70
RAW_AVERAGE_WIDTH : 600
FONT_ASCENT : (none)
RAW_ASCENT : 832
FONT_DESCENT : (none)
RAW_DESCENT : 300
SUBSCRIPT_SIZE : (none)
SUBSCRIPT_X : (none)
SUBSCRIPT_Y : (none)
SUPERSCRIPT_SIZE : (none)
SUPERSCRIPT_X : (none)
SUPERSCRIPT_Y : (none)
UNDERLINE_THICKNESS : (none)
UNDERLINE_POSITION : (none)
RAW_PIXEL_SIZE : 1000
RAW_POINT_SIZE : 723

  The resolution of Xserver is 100x100 dots per inch.

------------------------------------------------------------
    Chisato Yamauchi
fontpropdump.c (text/plain, 979 B)
#include <stdio.h>
#include <X11/Xlib.h>

int main( int argc, char *argv[] )
{
    Display *dis;
    XFontStruct *fs;
    Atom atom;
    unsigned long val;
    char *name;
    Bool result;
    char *props[] = {
	"PIXEL_SIZE",
	"POINT_SIZE",
	"RESOLUTION_X",
	"RESOLUTION_Y",
	"AVERAGE_WIDTH",
	"RAW_AVERAGE_WIDTH",
	"FONT_ASCENT",
	"RAW_ASCENT",
	"FONT_DESCENT",
	"RAW_DESCENT",
	"SUBSCRIPT_SIZE",
	"SUBSCRIPT_X",
	"SUBSCRIPT_Y",
	"SUPERSCRIPT_SIZE",
	"SUPERSCRIPT_X",
	"SUPERSCRIPT_Y",
	"UNDERLINE_THICKNESS",
	"UNDERLINE_POSITION",
	"RAW_PIXEL_SIZE",
	"RAW_POINT_SIZE",
	NULL,
    };
    int i;

    if( argc < 2 ) return -1;
    dis=XOpenDisplay(NULL);
    fs = XLoadQueryFont(dis,argv[1]);
    if( fs==NULL ) return -1;

    i=0;
    while ( props[i] != NULL ) {
	atom = XInternAtom(dis, props[i], True);
	result = XGetFontProperty(fs,atom,&val);
	if ( result )
	    printf("%s : %d\n",props[i],val);
	else
	    printf("%s : (none)\n",props[i]);
	i++;
    }
    return 0;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.