Re: [gtk-list] GdkFonts (or rather, fonts in X)




Derek Simkowiak <dereks@kd-dev.com> writes:
> 	I have some easy questions about using fonts in X (using Gdk).  
> I'm hoping this documentation is online somewhere, if so please just give
> me the URL.  I don't mean to seem like an idiot, but I've read what I
> could find and I'm new to font handling in X.
>

X comes with a file called XLFD.PS (or something like that, it
contains "xlfd") explaining the X font stuff. Also in the Xlib book by
Nye, and very briefly summarized in my book.
 
> 	Regarding underlining, I take it that underlining is not part of
> the font and I need to draw the line underneath the text myself?
> 

Yes.

> 	What are "TrueType" fonts (I've seen them on Microsoft computers
> before)?  Are they anyhow different from "scalable" fonts in X?  Is it
> possible to use "TrueType" fonts with Gdk?
> 

TrueType is an on-disk font format, and X can read them and make them
available as scalable or non-scalable X fonts. Typically you use a
font server for this. All on-disk font formats are accessed via XLFD
by X programs.

> 	Is it possible to display scaled fonts with anti-aliasing?  If so,
> how?
> 

No.

> 	Let's say I let the user choose a font (by "family") to display
> text in my application.  Something like, "Babelfish" or "Brand New".  I
> also want them to be able to click on in "i" button to turn on italics, or
> a "b" button to turn on bold.  And they should be able to choose the size
> of the font.  Imagine something like Microsoft's Write program.
> 
> 	Now, on my system, I only have the following installed:
> 
> -macromedia-babelfish-medium-r-normal--0-0-0-0-p-0-iso8859-1 
> -macromedia-brand new-medium-r-normal--0-0-0-0-p-0-iso8859-1
> 
> 	I do not have "-i-" or "-b-" (italics or bold) versions of these
> fonts on my system.  Does that mean I cannot display an italicized version
> of this font?  I would have to remove both "Babelfish" and "Brand New"
> from the font drop-down list in my application?
> 

Yep.

> 	Is it true that the *only* fonts I could let my user choose from
> would be those which have "-b-" and "-i-" versions installed on their
> system? 

Yes.

> Is it like that with TrueType fonts?
> 

It is if you're using TrueType via the X font API. I think Windows can
"make up" italic and bold versions of fonts by leaning the original
font over or beefing it up, but the computer-generated bold/italic
versions are sort of ugly. Anyway, there is no X feature to do that.

> 	And regarding scaling:  If the font type is not "scalable", does
> that mean the only font sizes the user can choose from are the ones they
> have installed?

Yes.

>  Can I "scale" a bitmap font?  

GnomeCanvasText does the following:
 - draws all characters in the bitmap font to a Pixmap
 - copies the Pixmap to an XImage
 - grabs the pixels from the XImage
 - scales the whole font as a single huge bitmap
 - draws characters by copying out regions of the huge bitmap

So, I guess "yes" but it is a) butt slow and b) butt ugly and c) the
most gruesome hack imaginable.

> I've seen some really
> horrid (blocky, mis-sized) fonts in Netscape under Linux, implying that
> you could scale bitmap fonts but that they will look like crap.  Is that
> true?
> 

I'm not sure which aspect of X font suckiness causes this particular
sucky effect.

Anyway, congratulations - you've discovered that X fonts suck.

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]