[t1cid] Improve cid_get_cid_from_glyph_index().

Update cid_get_cid_from_glyph_index() to
return an error and CID=0 in the case that
the specified glyph index points to an invalid
entry.

cidgload.h (cid_compute_fd_and_offsets):
Declare new helper function to set the
fd_select and 2 offsets to access the glyph
description data.

cidgload.c (cid_compute_fd_and_offsets):
Move the part loading fd_select and 2 offsets
from cid_load_glyph() to here.  If the loaded
parameters are broken, return the Invalid_Offset
error.  This function does not load the glyph
data, only fills these parameters.

(cid_load_glyph): Use new helper function in above.

cidriver.c (cid_get_cid_from_glyph_index):
Check whether the requested glyph index points
to a valid entry, by calling cid_compute_fd_and_offsets().
If it is valid, fill the cid by the glyph
index (=CID).  If it is invalid, return an
error and fill the cid by 0.
3 files changed