logo_90
Uni ZH | Informatikdienste | PostScript

Ueberblick: X11-Fonts

  1. Das Konzept des Font-Servers
  2. X11 Font Formats
  3. AFM
  4. Einen Schriftzug zeichnen
Die X11-Fonts sind grundsätzlich Bitmap-Fonts. Es gibt jedoch einige Ausnahmen von dieser Regel. Im Gegensatz zu skalierbaren Umriss-Fonts müssen Bitmap-Fonts in allen gewünschten Grössen abgelegt sein. Der grösste Nachteil liegt darin, dass automatisch vergrösserte Bitmaps fast durchwegs hässlich aussehen ("Treppen-Muster"): XFONT
Beispiel: Bitmaps in 133 Punkt mit Treppen-Effekt

1. Das Konzept des Font-Servers

X11R5 unterstützt einen Font-Server, der Fonts via TCP/IP-Protokoll zur Verfügung stellt. Damit wird es möglich, die X11-Fonts zentral zu verwalten. Das UNIX-Kommando "xset -q" gibt an, welcher Font-Server an Ihrem X-Terminal genutzt wird.

Um eine Uebersicht über die verfügbaren Fonts zu erhalten, können Sie die UNIX-Kommandos xlsfonts und xfontsel aufrufen.

2. X11 Font Formats

There are many different font formats that can play a role in an X11 system configuration. The following table summarizes some of the common formats:

* BDF The Bitmap Distribution Format (BDF) is the standard format for distribution of fonts. It is an ASCII format so it can easily be edited it with your favourite editor or E-mailed to other users. As the name suggests, it stores bitmap fonts only. Another virtue of the BDF format is that most font format converters convert to or from this format. Means if you want to go from format A to format B, neither of which is BDF, then you are likely to convert A to BDF, then BDF to B. The BDF format is defined by Adobe. A document describing the format is available by ftp from Adobe's file server at "ps-file-server@adobe.com". It is also available in the standard X distribution. Look under ../X11R4(5)/mit/hardcopy/BDF. This document is also reproduced in any text describing the X standard.

* SNF The Server Normal Format (SNF) is an older format for bitmap fonts. The format is X Server and host dependent. This means that if you have two SNF files, their actual format may be different. Also, if you have an "snftobdf" utility, it may not be able to read font files from other systems. Convert to BDF format before you move it off the host system.
Dieses Format ist veraltet.

* PCF The Portable Compiled Font (PCF) format is a binary format for bitmap fonts. The binary contains sufficient information to be readable by other systems.
Dieses Format wird auch am Zentrum Informatikdienste der Uni Zürich verwendet. Das Dienstprogramm bdftopcf erlaubt es, Font-Files in das moderne PCF-Format zu konvertieren.

* PHIGS These fonts are only applicable in PEX environments. PHIGS fonts don't really have any relationship to the normal X font mechanism.

* DWF The DECWindows Fonts (DWF) are bitmap fonts.

* Intellifont These are HP scalable fonts.
Dieses Font-Format wird auch von gewissen Non-PostScript-Druckern verwendet.

* PFA/PFB These are Adobe Type 1 PostScript fonts. They can be used in X11R5 based X servers and font servers because IBM has donated a renderer for this format to the X Consortium. The renderer can be found on the X11R5 contrib, and on ftp.x.org.
Diese Font-Formate werden auch vom PostScript-Interpreter gs sowie vom Adobe Type Manager (ATM) verwendet. Siehe Eine Zeichenbeschreibung, Font-Technologie.

* Speedo This is a format from Bitstream, Inc. Bitstream has also donated a font renderer to the X Consortium, and a couple of fonts. I have been told that in order to use commercial fonts from BitStream, you must patch the renderer somewhat to make it use the right decryption code for the font.

* FB These are Sun X11/NeWS format bitmap fonts used by the Sun OpenWindows system. You can use "convertfont" which comes with OpenWindows to convert to/from BDF.

* F3/F3B This is the scalable Sun Folio format, also used by OpenWindows. You can use "convertfont" to convert to (not from) BDF.

Im UNIX-Filesystem sind die Fonts meist unter /usr/lib/X11/fonts abgelegt.

3. AFM

Adobe Font Metrics: Die AFM-Dateien enthalten Breiten- und Kerning-Angaben für die Schriftzeichen bzw. Zeichenkombinationen: Character Metrics und Kerning Data. Diese in einer AFM-Datei abgelegten Daten werden von Textverarbeitungsprogrammen eingelesen, um die Zeilenumbrüche berechnen zu können.

Beispiel für eine AFM-Datei (ZapfChancery-MediumItalic.afm).

4. Einen Schriftzug zeichnen

Hier finden Sie ein Quellenbeispiel für eine ganz einfache X11-Anwendung. Das Programm, das mit Kommentaren versehen ist, demonstriert die X-Window-Programmierung. Diese Applikation öffnet ein Fenster, übernimmt dann alle Maus-Ereignisse des Typs ButtonRelease und zeichnet bei jedem Klick einen Schriftzug "hallo, ..." an der entsprechenden Stelle. Beim Xlib-Aufruf XDrawImageString verwendet der X-Server einen einfachen Font der Terminalemulation, z.B. Courier -- also eine Schrift, bei der alle Zeichen die gleiche Breite aufweisen (nichtproportional). Man benutzt XDrawImageString, um eine einfache Zeichenkette zu zeichnen. Wenn der Arbeitsplatzrechner (d.h. X-Server) eine XDrawImageString-Prozedur ausführt, weist er den Vordergrund-Pixel jedes Zeichens den Pixel-Wert foreground und den Hintergrund-Pixel jedes Zeichens den Pixel-Wert background zu.


X Was ist das X-Window-System?

Go to the Ghostview client.


Uni ZH | Informatikdienste | PostScript
HTML 3.2 Last update: Thursday, 11-Oct-2001 21:41:06 CEST by vo