diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2023-05-03 01:31:37 +0000 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2023-05-03 01:31:37 +0000 |
commit | be15811c4602a1c2584684eb7ed5242e2bf16a5e (patch) | |
tree | 0cfafeedd801e4c66af9ba8a71a54538441c80b4 /src/cid/cidriver.c | |
parent | 77bbfc5960f47412f8d433948bcb3317e9c93b7c (diff) | |
download | freetype2-be15811c4602a1c2584684eb7ed5242e2bf16a5e.tar.gz |
[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.
Diffstat (limited to 'src/cid/cidriver.c')
-rw-r--r-- | src/cid/cidriver.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index f7499237d..10cb8c1fd 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -150,11 +150,23 @@ FT_UInt *cid ) { FT_Error error = FT_Err_Ok; - FT_UNUSED( face ); - if ( cid ) - *cid = glyph_index; /* identity mapping */ + /* + * Currently, FreeType does not support an incrementally- + * defined CID-keyed font that stores the glyph description + * data in /GlyphDirectory array or dictionary. + * Thus the font loaded by the incremental loading feature + * is not handled in here. + */ + error = cid_compute_fd_and_offsets( face, glyph_index, + NULL, NULL, NULL ); + + + if ( error ) + *cid = 0; + else + *cid = glyph_index; return error; } |