[comp.windows.x] X Fonts: 2Byte vs. 16Bit

bcking@io.UUCP (Christine King x4426) (08/02/90)

I'm having a problem with 2byte fonts in X, and I hope somebody can
help.  We are an application (Interleaf) that has to run on various
kinds of clients and servers, some of which have "Motorola" byte-order
and some "VAX" byte-order.  The important difference for this problem
is the representation of a short int: Motorola's are like 00 41, where
the 00 is the high-order byte but the lower address; VAX's are like 41
00.

  (I think I have that right.  If not, I'm sure I'll get flamed.
  Anyway, the two are the reverse of each other, which is what matters
  here.)

For X 2byte fonts, we use arrays of "short" to represent strings of
character codes.  In the Motorola case, for a particular font that has
an "A" in position 0041, the "A" is displayed.  In the VAX case, I
have to swap the bytes of the code to get the "A".  This is all as
described in Scheifler/Gettys/Newman "X Window System".

Howevermuch of a Pain-in-the-Neck this swapping is, I accept it
because it's documented.  But: Scheifler/Gettys/Newman also mention
"16bit fonts" in several places, which seem to be a different thing
from "2byte fonts".

  Do 16-bit fonts really exist in X?

  Are they (in the VAX case) differently indexed than 2-byte fonts?

  Are the BDF descriptions different from a 2byte font?

  Could I use the same code (no swapping), and the same BDF fontfiles
for Motorola and for VAX?

Note that it is a client-side application problem to get the
byte-order correct for a 2byte font.  For a 16bit font, however, I
think it would be a client-side X-implementation problem.  Surely the
server need make no distinction between a 2byte and a 16bit font,
particularly since there is no difference for a Motorola server.


-- 
		--Christine King (bcking@ileaf.com)

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (08/03/90)

    Do 16-bit fonts really exist in X?

Yes.  There is a difference between the encoding form of a font and the
encoding form of the string data.  For drawing text, you can use 1-byte
or 2-byte string data.  Both forms work with all fonts.  For fonts,
the encoding vector can be represented as linear or matrix.  Linear font
encodings are permitted to be up to 65535 glyphs, but this is not expected
to be a normal case, matrix fonts are expected to be normal for large fonts.
There is no 16-bit data format for text strings.  When 2-byte string data
is used with a linear font (regardless of how many glyphs it has), the
linear index is always constructed by using the first byte as the most
significant byte.  String data is never byte swapped.

    Are they (in the VAX case) differently indexed than 2-byte fonts?

I hope I've answered this.

    Are the BDF descriptions different from a 2byte font?

Actually, BDF doesn't specify what encoding to use!  Whether this is a bug
or a feature is unclear.  It is similarly unclear whether bdftosnf always
makes a sensible choice for the encoding.