freetype-devel
[Top][All Lists]
Advanced

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

Proposed change for z1load.c


From: Tom Kacvinsky
Subject: Proposed change for z1load.c
Date: Sun, 15 Oct 2000 15:16:00 -0400 (EDT)

Aatached is patch for z1load.c.  I don't want to commit it without
review.

The general idea is this:

1. Initialize the encoding array to contain all .notdefs.
This will avoid some possible problems with strcmp later
on.

2. Populate the encoding array based on the Type 1 font's
Encoding array.

3. Find the glyph index of the .notdef glyph.

4. Build encoding.char_index and encoding.char_name based
on the encoding array.  Place the .notdef glyph index into
char_index[n], where encoding_table.elements[n] == .notdef.

5. Change min/max encoded char code based on whether the
codepoint is .notdef or not.  This only makes sense if 
the glyph index for .notdef is 0 (i.e., we adopt Just's
idea of sorting the charstrings dictionary).

Problems I see/forsee:

1. Right now, we have:

  type1->encoding.char_index[charcode] = notdef_index;
  type1->encoding.char_name [charcode] = (char *)".notdef";

Where encoding.char_index and encoding.char_name are malloc'd.
I am not comfortable with

  type1->encoding.char_name [charcode] = (char *)".notdef";

because (char *)".notdef" has local scope.  Perhaps using
the psaux table functions would be better?

2. In point 5 above, any char code outside of the min/max
encoded char code is going to result in 0 being returned
(c.f. Get_Char_Index in z1driver.c).  This is fine
if .notdef has code index 0.

3. The search for the index of .notdef can go away, iff
.notdef is guaranteed to have index 0.

4. Supposing we don't sort the charstrings dictionary
(so that glyph index 0 corresponds to .notdef), perhaps
we ought to store the .notdef index in something like
encoding.notdef_index, so that Get_Char_Index can
return an error if a char code maps to the .notdef
index.  See Werner's earlier note about changing
FT_Get_Char_Index to:

    FT_Error  FT_Get_Char_Index( FT_Face   face,
                                 FT_ULong  charcode,
                                 FT_UInt*  index );

If this were to happen (Werner's propsed change were
adopted), we could get the index of the charcode passed,
and return -1 if index matches the .notdef index.

Attachment: z1load.ch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]