Mercurial > emacs
comparison src/ftfont.c @ 91294:299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
glyphs.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 27 Dec 2007 01:15:39 +0000 |
parents | fed5211f4809 |
children | 9b6270bcd1a7 |
comparison
equal
deleted
inserted
replaced
91293:c45d16b39212 | 91294:299c64a7a9fb |
---|---|
1305 if (OTF_drive_gsub (otf, &otf_gstring, script, langsys, gsub_features) | 1305 if (OTF_drive_gsub (otf, &otf_gstring, script, langsys, gsub_features) |
1306 < 0) | 1306 < 0) |
1307 goto simple_copy; | 1307 goto simple_copy; |
1308 if (out->allocated < out->used + otf_gstring.used) | 1308 if (out->allocated < out->used + otf_gstring.used) |
1309 return -2; | 1309 return -2; |
1310 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++, otfg++) | 1310 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; ) |
1311 { | 1311 { |
1312 MFLTGlyph *g = out->glyphs + out->used; | 1312 OTF_Glyph *endg; |
1313 MFLTGlyph *g; | |
1314 int min_from, max_to; | |
1313 int j; | 1315 int j; |
1314 | 1316 |
1317 g = out->glyphs + out->used; | |
1315 *g = in->glyphs[from + otfg->f.index.from]; | 1318 *g = in->glyphs[from + otfg->f.index.from]; |
1316 g->c = 0; | |
1317 for (j = from + otfg->f.index.from; j <= from + otfg->f.index.to; j++) | |
1318 if (in->glyphs[j].code == otfg->glyph_id) | |
1319 { | |
1320 g->c = in->glyphs[j].c; | |
1321 break; | |
1322 } | |
1323 if (g->code != otfg->glyph_id) | 1319 if (g->code != otfg->glyph_id) |
1324 { | 1320 { |
1321 g->c = 0; | |
1325 g->code = otfg->glyph_id; | 1322 g->code = otfg->glyph_id; |
1326 g->measured = 0; | 1323 g->measured = 0; |
1327 } | 1324 } |
1328 out->used++; | 1325 out->used++; |
1326 min_from = g->from; | |
1327 max_to = g->to; | |
1328 if (otfg->f.index.from < otfg->f.index.to) | |
1329 { | |
1330 /* OTFG substitutes multiple glyphs in IN. */ | |
1331 for (j = from + otfg->f.index.from + 1; | |
1332 j <= from + otfg->f.index.to; j++) | |
1333 { | |
1334 if (min_from > in->glyphs[j].from) | |
1335 min_from = in->glyphs[j].from; | |
1336 if (max_to < in->glyphs[j].to) | |
1337 max_to = in->glyphs[j].to; | |
1338 } | |
1339 g->from = min_from; | |
1340 g->to = max_to; | |
1341 } | |
1342 for (i++, otfg++; (i < otf_gstring.used | |
1343 && otfg->f.index.from == otfg[-1].f.index.from); | |
1344 i++, otfg++) | |
1345 { | |
1346 g = out->glyphs + out->used; | |
1347 *g = in->glyphs[from + otfg->f.index.to]; | |
1348 if (g->code != otfg->glyph_id) | |
1349 { | |
1350 g->c = 0; | |
1351 g->code = otfg->glyph_id; | |
1352 g->measured = 0; | |
1353 } | |
1354 out->used++; | |
1355 } | |
1329 } | 1356 } |
1330 } | 1357 } |
1331 else | 1358 else |
1332 { | 1359 { |
1333 if (out->allocated < out->used + len) | 1360 if (out->allocated < out->used + len) |